Source Code
Overview
ETH Balance
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 23350973 | 133 days ago | 0 ETH | ||||
| 23350973 | 133 days ago | 0.00016147 ETH | ||||
| 23350867 | 133 days ago | 0 ETH | ||||
| 22762773 | 147 days ago | 0 ETH | ||||
| 22463871 | 154 days ago | 0 ETH | ||||
| 21698663 | 172 days ago | 0 ETH | ||||
| 21698663 | 172 days ago | 0.0001828 ETH | ||||
| 21698616 | 172 days ago | 0.00018279 ETH | ||||
| 21279428 | 184 days ago | 0 ETH | ||||
| 21051675 | 190 days ago | 0 ETH | ||||
| 21051675 | 190 days ago | 0.00052346 ETH | ||||
| 21051467 | 190 days ago | 0 ETH | ||||
| 21051203 | 190 days ago | 0 ETH | ||||
| 21051203 | 190 days ago | 0.00018259 ETH | ||||
| 20728019 | 200 days ago | 0 ETH | ||||
| 20728019 | 200 days ago | 0.00113846 ETH | ||||
| 20489571 | 208 days ago | 0 ETH | ||||
| 20085427 | 223 days ago | 0 ETH | ||||
| 20034834 | 224 days ago | 0 ETH | ||||
| 19987999 | 226 days ago | 0 ETH | ||||
| 19986742 | 226 days ago | 0 ETH | ||||
| 19860302 | 229 days ago | 0 ETH | ||||
| 19836389 | 230 days ago | 0 ETH | ||||
| 19766569 | 232 days ago | 0 ETH | ||||
| 19766569 | 232 days ago | 0.00053143 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
NFT721Bridge
Compiler Version
v0.8.14+commit.80d49f37
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/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./util/BytesLib.sol";
import "./token/ZKBridgeErc721.sol";
import "./interfaces/IBridgeHandle.sol";
import "./interfaces/IUserApplication.sol";
contract NFT721Bridge is Initializable, OwnableUpgradeable, IUserApplication {
using BytesLib for bytes;
event TransferNFT(uint64 indexed nonce, address token, uint256 tokenID, uint16 dstChainId, address sender, address recipient);
event ReceiveNFT(uint64 indexed nonce, address sourceToken, address token, uint256 tokenID, uint16 sourceChain, uint16 sendChain, address recipient);
event NewWrappedAssets(uint16 indexed nativeChainId, address indexed nativeContract, address wrapper);
event NewBridgeHandle(uint16 chainId, address bridgeHandle);
event NewDefaultBridgeHandle(address defaultBridgeHandle);
event SetFee(uint16 dstChainId, uint256 fee);
event ClaimFee(address operator, uint256 amount);
struct WrappedAsset {
uint16 nativeChainId;
address nativeContract;
}
struct Transfer {
uint64 nonce;
// Address of the token.
address tokenAddress;
// Chain ID of the token
uint16 tokenChain;
// Symbol of the token
bytes32 symbol;
// Name of the token
bytes32 name;
// TokenID of the token
uint256 tokenId;
// URI of the token metadata (UTF-8)
string uri;
// Address of the recipient
address to;
// Chain ID of the recipient
uint16 toChain;
}
uint16 public chainId;
IBridgeHandle public defaultBridgeHandle;
// Mapping of wrapped assets (chainID => nativeAddress => wrappedAddress)
mapping(uint16 => mapping(address => address)) public wrappedAssets;
// Mapping of wrapped assets data(wrappedAddress => WrappedAsset)
mapping(address => WrappedAsset) public wrappedAssetData;
// Mapping of receive chain fee
mapping(uint16 => uint256) public fee;
// chainId => handle
mapping(uint16 => IBridgeHandle) bridgeHandle;
// chainId => nonce
mapping(uint16 => uint64) nonce;
function initialize(uint16 _chainId) public initializer {
__Ownable_init();
chainId = _chainId;
}
function transferNFT(address _token, uint256 _tokenId, uint16 _dstChainId, address _recipient, bytes calldata _adapterParams) external payable returns (uint64 currentNonce) {
IBridgeHandle handle = getBridgeHandle(_dstChainId);
require(address(handle) != address(0), "Not Supported");
currentNonce = nonce[_dstChainId];
(bytes memory payload) = _getPayload(_token, _tokenId, _dstChainId, _recipient);
require(msg.value >= _estimateFee(_dstChainId, payload, _adapterParams), "Insufficient Fee");
IERC721(_token).safeTransferFrom(msg.sender, address(this), _tokenId);
if (wrappedAssetData[_token].nativeChainId != 0) {
ZKBridgeErc721(_token).zkBridgeBurn(_tokenId);
}
uint256 bridgeFee = msg.value - fee[_dstChainId];
handle.sendMessage{value : bridgeFee}(_dstChainId, payload, payable(msg.sender), _adapterParams, bridgeFee);
nonce[_dstChainId]++;
emit TransferNFT(currentNonce, _token, _tokenId, _dstChainId, msg.sender, _recipient);
}
function receiveMessage(uint16 _srcChainId, address /*_srcAddress*/, uint64 /*_nonce*/, bytes memory _payload) external {
require(msg.sender == address(getBridgeHandle(_srcChainId)), "invalid bridgeHandle caller");
Transfer memory transfer = _parseTransfer(_payload);
require(transfer.toChain == chainId, "invalid target chain");
address transferToken;
if (transfer.tokenChain == chainId) {
transferToken = transfer.tokenAddress;
IERC721(transferToken).safeTransferFrom(address(this), transfer.to, transfer.tokenId);
} else {
address wrapped = wrappedAssets[transfer.tokenChain][transfer.tokenAddress];
// If the wrapped asset does not exist yet, create it
if (wrapped == address(0)) {
wrapped = _createWrapped(transfer.tokenChain, transfer.tokenAddress, transfer.name, transfer.symbol);
}
transferToken = wrapped;
// mint wrapped asset
ZKBridgeErc721(wrapped).zkBridgeMint(transfer.to, transfer.tokenId, transfer.uri);
}
emit ReceiveNFT(transfer.nonce, transfer.tokenAddress, transferToken, transfer.tokenId, transfer.tokenChain, _srcChainId, transfer.to);
}
function getBridgeHandle(uint16 _remoteChainId) public view returns (IBridgeHandle) {
IBridgeHandle handle = bridgeHandle[_remoteChainId];
if (address(handle) == address(0)) {
return defaultBridgeHandle;
}
return handle;
}
function _getPayload(address _token, uint256 _tokenId, uint16 _dstChainId, address _recipient) internal view returns (bytes memory payload) {
uint16 tokenChain = chainId;
address tokenAddress = _token;
WrappedAsset memory wrappedAsset = wrappedAssetData[_token];
if (wrappedAsset.nativeChainId != 0) {
tokenChain = wrappedAsset.nativeChainId;
tokenAddress = wrappedAsset.nativeContract;
} else {
// Verify that the correct interfaces are implemented
require(ERC165(_token).supportsInterface(type(IERC721).interfaceId), "must support the ERC721 interface");
require(ERC165(_token).supportsInterface(type(IERC721Metadata).interfaceId), "must support the ERC721-Metadata extension");
}
string memory symbolString = IERC721Metadata(_token).symbol();
string memory nameString = IERC721Metadata(_token).name();
string memory uriString = IERC721Metadata(_token).tokenURI(_tokenId);
bytes32 symbol;
bytes32 name;
assembly {
symbol := mload(add(symbolString, 32))
name := mload(add(nameString, 32))
}
payload = _encodeTransfer(Transfer(nonce[_dstChainId], tokenAddress, tokenChain, symbol, name, _tokenId, uriString, _recipient, _dstChainId));
}
function _encodeTransfer(Transfer memory _transfer) internal pure returns (bytes memory encoded) {
encoded = abi.encodePacked(
_transfer.nonce,
_transfer.tokenAddress,
_transfer.tokenChain,
_transfer.symbol,
_transfer.name,
_transfer.tokenId,
_transfer.to,
_transfer.toChain,
_transfer.uri
);
}
// Creates a wrapped asset using AssetMeta
function _createWrapped(uint16 _tokenChain, address _tokenAddress, bytes32 _name, bytes32 _symbol) internal returns (address token) {
require(_tokenChain != chainId, "can only wrap tokens from foreign chains");
require(wrappedAssets[_tokenChain][_tokenAddress] == address(0), "wrapped asset already exists");
bytes memory constructorArgs = abi.encode(_bytes32ToString(_name), _bytes32ToString(_symbol));
bytes memory bytecode = abi.encodePacked(type(ZKBridgeErc721).creationCode, constructorArgs);
bytes32 salt = keccak256(abi.encodePacked(_tokenChain, _tokenAddress));
assembly {
token := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
if iszero(extcodesize(token)) {
revert(0, 0)
}
}
_setWrappedAsset(_tokenChain, _tokenAddress, token);
}
function _parseTransfer(bytes memory _encoded) internal pure returns (Transfer memory transfer) {
uint index = 0;
transfer.nonce = _encoded.toUint64(index);
index += 8;
transfer.tokenAddress = _encoded.toAddress(index);
index += 20;
transfer.tokenChain = _encoded.toUint16(index);
index += 2;
transfer.symbol = _encoded.toBytes32(index);
index += 32;
transfer.name = _encoded.toBytes32(index);
index += 32;
transfer.tokenId = _encoded.toUint256(index);
index += 32;
transfer.to = _encoded.toAddress(index);
index += 20;
transfer.toChain = _encoded.toUint16(index);
index += 2;
transfer.uri = string(_encoded.slice(index, _encoded.length - index));
}
function _bytes32ToString(bytes32 input) internal pure returns (string memory) {
uint256 i;
while (i < 32 && input[i] != 0) {
i++;
}
bytes memory array = new bytes(i);
for (uint c = 0; c < i; c++) {
array[c] = input[c];
}
return string(array);
}
function _estimateFee(uint16 _dstChainId, bytes memory _payload, bytes memory _adapterParams) internal view returns (uint256){
uint256 bridgeFee = getBridgeHandle(_dstChainId).estimateFees(_dstChainId, _payload, _adapterParams);
return bridgeFee + fee[_dstChainId];
}
function _setWrappedAsset(uint16 _nativeChainId, address _nativeContract, address _wrapper) internal {
wrappedAssets[_nativeChainId][_nativeContract] = _wrapper;
wrappedAssetData[_wrapper] = WrappedAsset(_nativeChainId, _nativeContract);
emit NewWrappedAssets(_nativeChainId, _nativeContract, _wrapper);
}
function estimateFee(address _token, uint256 _tokenId, uint16 _dstChainId, address _recipient, bytes calldata _adapterParams) external view returns (uint256){
(bytes memory payload) = _getPayload(_token, _tokenId, _dstChainId, _recipient);
return _estimateFee(_dstChainId, payload, _adapterParams);
}
function onERC721Received(
address operator,
address,
uint256,
bytes calldata
) external view returns (bytes4){
require(operator == address(this), "can only bridge tokens via transferNFT method");
return type(IERC721Receiver).interfaceId;
}
//----------------------------------------------------------------------------------
// onlyOwner
function claimFees() external onlyOwner {
emit ClaimFee(msg.sender, address(this).balance);
payable(owner()).transfer(address(this).balance);
}
function setFee(uint16 _dstChainId, uint256 _fee) public onlyOwner {
fee[_dstChainId] = _fee;
emit SetFee(_dstChainId, _fee);
}
function setWrappedAsset(uint16 _nativeChainId, address _nativeContract, address _wrapper) external onlyOwner {
_setWrappedAsset(_nativeChainId, _nativeContract, _wrapper);
}
function setBridgeHandle(uint16 _dstChainId, address _bridgeHandle) external onlyOwner {
require(_bridgeHandle != address(0), "cannot be zero address");
bridgeHandle[_dstChainId] = IBridgeHandle(_bridgeHandle);
emit NewBridgeHandle(_dstChainId, _bridgeHandle);
}
function setDefaultBridgeHandle(address _defaultBridgeHandle) external onlyOwner {
require(_defaultBridgeHandle != address(0), "cannot be zero address");
defaultBridgeHandle = IBridgeHandle(_defaultBridgeHandle);
emit NewDefaultBridgeHandle(_defaultBridgeHandle);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_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. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: address zero is not a valid owner");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _ownerOf(tokenId);
require(owner != address(0), "ERC721: invalid token ID");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
_requireMinted(tokenId);
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not token owner or approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
_safeTransfer(from, to, tokenId, data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
*/
function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
return _owners[tokenId];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _ownerOf(tokenId) != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId, 1);
// Check that tokenId was not minted by `_beforeTokenTransfer` hook
require(!_exists(tokenId), "ERC721: token already minted");
unchecked {
// Will not overflow unless all 2**256 token ids are minted to the same owner.
// Given that tokens are minted one by one, it is impossible in practice that
// this ever happens. Might change if we allow batch minting.
// The ERC fails to describe this case.
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId, 1);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
* This is an internal function that does not check if the sender is authorized to operate on the token.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId, 1);
// Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
owner = ERC721.ownerOf(tokenId);
// Clear approvals
delete _tokenApprovals[tokenId];
unchecked {
// Cannot overflow, as that would require more tokens to be burned/transferred
// out than the owner initially received through minting and transferring in.
_balances[owner] -= 1;
}
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId, 1);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId, 1);
// Check that tokenId was not transferred by `_beforeTokenTransfer` hook
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
// Clear approvals from the previous owner
delete _tokenApprovals[tokenId];
unchecked {
// `_balances[from]` cannot overflow for the same reason as described in `_burn`:
// `from`'s balance is the number of token held, which is at least one before the current
// transfer.
// `_balances[to]` could overflow in the conditions described in `_mint`. That would require
// all 2**256 token ids to be minted, which in practice is impossible.
_balances[from] -= 1;
_balances[to] += 1;
}
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId, 1);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Reverts if the `tokenId` has not been minted yet.
*/
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
/// @solidity memory-safe-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
* - When `from` is zero, the tokens will be minted for `to`.
* - When `to` is zero, ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
* used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
* - When `from` is zero, the tokens were minted for `to`.
* - When `to` is zero, ``from``'s tokens were burned.
* - `from` and `to` are never both zero.
* - `batchSize` is non-zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}
/**
* @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
*
* WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
* being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
* that `ownerOf(tokenId)` is `a`.
*/
// solhint-disable-next-line func-name-mixedcase
function __unsafe_increaseBalance(address account, uint256 amount) internal {
_balances[account] += amount;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IBridgeHandle {
function sendMessage(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, bytes memory _adapterParams, uint256 _nativeFee) payable external;
function estimateFees(uint16 _dstChainId, bytes calldata _payload, bytes calldata _adapterParam) external view returns (uint256 fee);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUserApplication {
// @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 receiveMessage(uint16 srcChainId, address srcAddress, uint64 nonce, bytes calldata payload) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IZKBridgeErc721 {
function zkBridgeMint(address _to, uint256 _tokenId, string memory tokenURI_) external;
function zkBridgeBurn(uint256 _tokenId) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "../interfaces/IZKBridgeErc721.sol";
contract ZKBridgeErc721 is IZKBridgeErc721, ERC721 {
address public bridge;
mapping(uint256 => string) private tokenURIs;
modifier onlyBridge() {
require(msg.sender == bridge, "caller is not the bridge");
_;
}
constructor(
string memory _name,
string memory _symbol
) ERC721(_name, _symbol) {
bridge = msg.sender;
}
function zkBridgeMint(
address _to,
uint256 _tokenId,
string memory tokenURI_
) external override onlyBridge {
_mint(_to, _tokenId);
_setTokenURI(_tokenId, tokenURI_);
}
function zkBridgeBurn(uint256 _tokenId) external override onlyBridge {
require(_exists(_tokenId), "Burn of nonexistent token");
_burn(_tokenId);
}
function tokenURI(
uint256 _tokenId
) public view override(ERC721) returns (string memory) {
require(_exists(_tokenId), "URI query for nonexistent token");
return tokenURIs[_tokenId];
}
function _setTokenURI(uint256 _tokenId, string memory tokenURI_) internal {
require(_exists(_tokenId), "URI set of nonexistent token");
tokenURIs[_tokenId] = tokenURI_;
}
}// 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, uint _start, uint _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, uint _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, uint _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, uint _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, uint _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, uint _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, uint _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, uint _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, uint _start) internal pure returns (uint) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint _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; } }
{
"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
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"chainId","type":"uint16"},{"indexed":false,"internalType":"address","name":"bridgeHandle","type":"address"}],"name":"NewBridgeHandle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"defaultBridgeHandle","type":"address"}],"name":"NewDefaultBridgeHandle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"nativeChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"nativeContract","type":"address"},{"indexed":false,"internalType":"address","name":"wrapper","type":"address"}],"name":"NewWrappedAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"nonce","type":"uint64"},{"indexed":false,"internalType":"address","name":"sourceToken","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"sourceChain","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"sendChain","type":"uint16"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"ReceiveNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"SetFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"nonce","type":"uint64"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"dstChainId","type":"uint16"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"TransferNFT","type":"event"},{"inputs":[],"name":"chainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultBridgeHandle","outputs":[{"internalType":"contract IBridgeHandle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getBridgeHandle","outputs":[{"internalType":"contract IBridgeHandle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_chainId","type":"uint16"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"receiveMessage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"address","name":"_bridgeHandle","type":"address"}],"name":"setBridgeHandle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_defaultBridgeHandle","type":"address"}],"name":"setDefaultBridgeHandle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_nativeChainId","type":"uint16"},{"internalType":"address","name":"_nativeContract","type":"address"},{"internalType":"address","name":"_wrapper","type":"address"}],"name":"setWrappedAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"transferNFT","outputs":[{"internalType":"uint64","name":"currentNonce","type":"uint64"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wrappedAssetData","outputs":[{"internalType":"uint16","name":"nativeChainId","type":"uint16"},{"internalType":"address","name":"nativeContract","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"address","name":"","type":"address"}],"name":"wrappedAssets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b50613de9806100206000396000f3fe6080604052600436106200012b5760003560e01c80639823bb0411620000ad578063b6399876116200006c578063b639987614620003a7578063c7f0da131462000410578063cfc932741462000435578063d294f0931462000465578063f2fde38b146200047d57600080fd5b80639823bb0414620002b35780639a8a059214620002f85780639eef9edb14620003295780639f2f1e061462000351578063abd6aef5146200038257600080fd5b806350c9c70211620000fa57806350c9c70214620001e45780635ec5d92e1462000209578063715018a6146200024757806386533d97146200025f5780638da5cb5b146200029357600080fd5b806303c9e62e1462000130578063137509461462000157578063150b7a02146200017c5780634b642e7814620001bf575b600080fd5b3480156200013d57600080fd5b50620001556200014f36600462001f3f565b620004a2565b005b3480156200016457600080fd5b50620001556200017636600462002008565b62000783565b3480156200018957600080fd5b50620001a16200019b36600462002078565b620008b0565b6040516001600160e01b031990911681526020015b60405180910390f35b348015620001cc57600080fd5b5062000155620001de366004620020ee565b62000934565b348015620001f157600080fd5b5062000155620002033660046200210c565b620009ed565b3480156200021657600080fd5b506200022e6200022836600462002008565b62000aad565b6040516001600160a01b039091168152602001620001b6565b3480156200025457600080fd5b506200015562000aef565b3480156200026c57600080fd5b50620002846200027e36600462002144565b62000b07565b604051908152602001620001b6565b348015620002a057600080fd5b506033546001600160a01b03166200022e565b348015620002c057600080fd5b506200022e620002d23660046200210c565b60666020908152600092835260408084209091529082529020546001600160a01b031681565b3480156200030557600080fd5b50606554620003159061ffff1681565b60405161ffff9091168152602001620001b6565b3480156200033657600080fd5b506065546200022e906201000090046001600160a01b031681565b3480156200035e57600080fd5b50620002846200037036600462002008565b60686020526000908152604090205481565b3480156200038f57600080fd5b5062000155620003a1366004620021cc565b62000b69565b348015620003b457600080fd5b50620003ed620003c6366004620020ee565b60676020526000908152604090205461ffff8116906201000090046001600160a01b031682565b6040805161ffff90931683526001600160a01b03909116602083015201620001b6565b3480156200041d57600080fd5b50620001556200042f36600462002216565b62000b85565b6200044c6200044636600462002144565b62000bdc565b6040516001600160401b039091168152602001620001b6565b3480156200047257600080fd5b506200015562000f1d565b3480156200048a57600080fd5b50620001556200049c366004620020ee565b62000f9c565b620004ad8462000aad565b6001600160a01b0316336001600160a01b031614620005135760405162461bcd60e51b815260206004820152601b60248201527f696e76616c69642062726964676548616e646c652063616c6c6572000000000060448201526064015b60405180910390fd5b6000620005208262001018565b60655461010082015191925061ffff9182169116146200057a5760405162461bcd60e51b815260206004820152601460248201527334b73b30b634b2103a30b933b2ba1031b430b4b760611b60448201526064016200050a565b606554604082015160009161ffff908116911603620006155750602081015160e082015160a0830151604051632142170760e11b81523060048201526001600160a01b0392831660248201526044810191909152908216906342842e0e90606401600060405180830381600087803b158015620005f657600080fd5b505af11580156200060b573d6000803e3d6000fd5b50505050620006e4565b60408083015161ffff16600090815260666020908152828220818601516001600160a01b03908116845291529190205416806200066d576200066a8360400151846020015185608001518660600151620011a9565b90505b809150806001600160a01b0316632a4a361d8460e001518560a001518660c001516040518463ffffffff1660e01b8152600401620006ae93929190620022a4565b600060405180830381600087803b158015620006c957600080fd5b505af1158015620006de573d6000803e3d6000fd5b50505050505b81600001516001600160401b03167f32aae95950c2e1f2c1a419165ba01c63c49604db10ee1b95d9960c0f5b9b9fa88360200151838560a0015186604001518b8860e0015160405162000773969594939291906001600160a01b0396871681529486166020860152604085019390935261ffff918216606085015216608083015290911660a082015260c00190565b60405180910390a2505050505050565b600054610100900460ff1615808015620007a45750600054600160ff909116105b80620007c05750303b158015620007c0575060005460ff166001145b620008255760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016200050a565b6000805460ff19166001179055801562000849576000805461ff0019166101001790555b6200085362001395565b6065805461ffff191661ffff84161790558015620008ac576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b5050565b60006001600160a01b0386163014620009225760405162461bcd60e51b815260206004820152602d60248201527f63616e206f6e6c792062726964676520746f6b656e7320766961207472616e7360448201526c19995c939195081b595d1a1bd9609a1b60648201526084016200050a565b50630a85bd0160e11b95945050505050565b6200093e620013c9565b6001600160a01b0381166200098f5760405162461bcd60e51b815260206004820152601660248201527563616e6e6f74206265207a65726f206164647265737360501b60448201526064016200050a565b6065805462010000600160b01b031916620100006001600160a01b038416908102919091179091556040519081527f8c50b74d1b39acb1cf584c32dc754c0363d1e332ecf0f5685a2c07b90a3618cc9060200160405180910390a150565b620009f7620013c9565b6001600160a01b03811662000a485760405162461bcd60e51b815260206004820152601660248201527563616e6e6f74206265207a65726f206164647265737360501b60448201526064016200050a565b61ffff821660008181526069602090815260409182902080546001600160a01b0319166001600160a01b0386169081179091558251938452908301527f4e8cc4d358a86e40b05f3b3055827d060d9bd07a51ca0ae28d479b7782d22d199101620008a3565b61ffff81166000908152606960205260408120546001600160a01b03168062000ae95750506065546201000090046001600160a01b0316919050565b92915050565b62000af9620013c9565b62000b05600062001425565b565b60008062000b188888888862001477565b905062000b5d868286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506200188792505050565b98975050505050505050565b62000b73620013c9565b62000b8083838362001936565b505050565b62000b8f620013c9565b61ffff8216600081815260686020908152604091829020849055815192835282018390527f47d9066e07019286c19790aa54f97c9830127e71edff41b453c7adeaa15d2fe89101620008a3565b60008062000bea8662000aad565b90506001600160a01b03811662000c345760405162461bcd60e51b815260206004820152600d60248201526c139bdd0814dd5c1c1bdc9d1959609a1b60448201526064016200050a565b61ffff86166000908152606a60205260408120546001600160401b0316925062000c618989898962001477565b905062000ca6878287878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506200188792505050565b34101562000cea5760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742046656560801b60448201526064016200050a565b604051632142170760e11b8152336004820152306024820152604481018990526001600160a01b038a16906342842e0e90606401600060405180830381600087803b15801562000d3957600080fd5b505af115801562000d4e573d6000803e3d6000fd5b505050506001600160a01b03891660009081526067602052604090205461ffff161562000dd257604051635d4dacc960e01b8152600481018990526001600160a01b038a1690635d4dacc990602401600060405180830381600087803b15801562000db857600080fd5b505af115801562000dcd573d6000803e3d6000fd5b505050505b61ffff871660009081526068602052604081205462000df29034620022e3565b9050826001600160a01b031663f4a6c3e6828a85338b8b886040518863ffffffff1660e01b815260040162000e2d96959493929190620022fd565b6000604051808303818588803b15801562000e4757600080fd5b505af115801562000e5c573d6000803e3d6000fd5b50505061ffff8a166000908152606a6020526040812080546001600160401b03169350915062000e8c8362002367565b82546101009290920a6001600160401b03818102199093169183160217909155604080516001600160a01b038e81168252602082018e905261ffff8d1692820192909252336060820152908a16608082015290861691507fe11d2ca26838f15acb41450029a785bb3d6f909b7f622ebf9c45524ded76f4119060a00160405180910390a25050509695505050505050565b62000f27620013c9565b604080513381524760208201527ff40b9ca28516abde647ef8ed0e7b155e16347eb4d8dd6eb29989ed2c0c3d27e8910160405180910390a16033546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801562000f99573d6000803e3d6000fd5b50565b62000fa6620013c9565b6001600160a01b0381166200100d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016200050a565b62000f998162001425565b604080516101208101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082015260e081018290526101008101829052906200106c8382620019ef565b6001600160401b031682526200108460088262002390565b905062001092838262001a50565b6001600160a01b03166020830152620010ad60148262002390565b9050620010bb838262001ab9565b61ffff166040830152620010d160028262002390565b9050620010df838262001b1a565b6060830152620010f160208262002390565b9050620010ff838262001b1a565b60808301526200111160208262002390565b90506200111f838262001b7c565b60a08301526200113160208262002390565b90506200113f838262001a50565b6001600160a01b031660e08301526200115a60148262002390565b905062001168838262001ab9565b61ffff166101008301526200117f60028262002390565b90506200119e81828551620011959190620022e3565b85919062001bd5565b60c083015250919050565b60655460009061ffff90811690861603620012185760405162461bcd60e51b815260206004820152602860248201527f63616e206f6e6c79207772617020746f6b656e732066726f6d20666f726569676044820152676e20636861696e7360c01b60648201526084016200050a565b61ffff851660009081526066602090815260408083206001600160a01b0388811685529252909120541615620012915760405162461bcd60e51b815260206004820152601c60248201527f7772617070656420617373657420616c7265616479206578697374730000000060448201526064016200050a565b60006200129e8462001cee565b620012a98462001cee565b604051602001620012bc929190620023ab565b6040516020818303038152906040529050600060405180602001620012e19062001e8e565b601f1982820381018352601f9091011660408190526200130791908490602001620023d4565b60408051601f19818403018152908290526001600160f01b031960f08a901b1660208301526bffffffffffffffffffffffff19606089901b1660228301529150600090603601604051602081830303815290604052805190602001209050808251602084016000f59350833b6200137d57600080fd5b6200138a88888662001936565b505050949350505050565b600054610100900460ff16620013bf5760405162461bcd60e51b81526004016200050a9062002407565b62000b0562001df9565b6033546001600160a01b0316331462000b055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200050a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6065546001600160a01b0380861660009081526067602090815260409182902082518084019093525461ffff8181168085526201000090920490941691830191909152606093929092169187919015620014dd578051602082015190935091506200167a565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526001600160a01b038916906301ffc9a790602401602060405180830381865afa15801562001529573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200154f919062002452565b620015a75760405162461bcd60e51b815260206004820152602160248201527f6d75737420737570706f7274207468652045524337323120696e7465726661636044820152606560f81b60648201526084016200050a565b6040516301ffc9a760e01b8152635b5e139f60e01b60048201526001600160a01b038916906301ffc9a790602401602060405180830381865afa158015620015f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001619919062002452565b6200167a5760405162461bcd60e51b815260206004820152602a60248201527f6d75737420737570706f727420746865204552433732312d4d657461646174616044820152691032bc3a32b739b4b7b760b11b60648201526084016200050a565b6000886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620016bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620016e5919081019062002476565b90506000896001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa15801562001728573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001752919081019062002476565b60405163c87b56dd60e01b8152600481018b90529091506000906001600160a01b038c169063c87b56dd90602401600060405180830381865afa1580156200179e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620017c8919081019062002476565b9050600080602085015191506020840151905062001876604051806101200160405280606a60008f61ffff1661ffff16815260200190815260200160002060009054906101000a90046001600160401b03166001600160401b03168152602001896001600160a01b031681526020018a61ffff1681526020018481526020018381526020018e81526020018581526020018c6001600160a01b031681526020018d61ffff1681525062001e2e565b9d9c50505050505050505050505050565b600080620018958562000aad565b6001600160a01b03166345e380a38686866040518463ffffffff1660e01b8152600401620018c693929190620024ec565b602060405180830381865afa158015620018e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200190a919062002529565b61ffff86166000908152606860205260409020549091506200192d908262002390565b95945050505050565b61ffff83811660008181526066602090815260408083206001600160a01b0388811680865291845282852080546001600160a01b03191689831690811790915583518085018552878152808601848152828852606787529685902090518154975199166001600160b01b031990971696909617620100009890921697909702179093555193845290927f196ccefd5b4acc77efd509b94050d515754966df1a8fe6f6a2a6defef4e5ed8f910160405180910390a3505050565b6000620019fe82600862002390565b8351101562001a475760405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b60448201526064016200050a565b50016008015190565b600062001a5f82601462002390565b8351101562001aa95760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016200050a565b500160200151600160601b900490565b600062001ac882600262002390565b8351101562001b115760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b60448201526064016200050a565b50016002015190565b600062001b2982602062002390565b8351101562001b735760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b60448201526064016200050a565b50016020015190565b600062001b8b82602062002390565b8351101562001b735760405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b60448201526064016200050a565b60608162001be581601f62002390565b101562001c265760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016200050a565b62001c32828462002390565b8451101562001c785760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016200050a565b60608215801562001c99576040519150600082526020820160405262001ce5565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101562001cd457805183526020928301920162001cba565b5050858452601f01601f1916604052505b50949350505050565b606060005b60208110801562001d25575082816020811062001d145762001d1462002543565b1a60f81b6001600160f81b03191615155b1562001d40578062001d378162002559565b91505062001cf3565b6000816001600160401b0381111562001d5d5762001d5d62001ecc565b6040519080825280601f01601f19166020018201604052801562001d88576020820181803683370190505b50905060005b8281101562001df15784816020811062001dac5762001dac62002543565b1a60f81b82828151811062001dc55762001dc562002543565b60200101906001600160f81b031916908160001a9053508062001de88162002559565b91505062001d8e565b509392505050565b600054610100900460ff1662001e235760405162461bcd60e51b81526004016200050a9062002407565b62000b053362001425565b6060816000015182602001518360400151846060015185608001518660a001518760e001518861010001518960c0015160405160200162001e789998979695949392919062002575565b6040516020818303038152906040529050919050565b6117ac806200260883390190565b803561ffff8116811462001eaf57600080fd5b919050565b80356001600160a01b038116811462001eaf57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171562001f0d5762001f0d62001ecc565b604052919050565b60006001600160401b0382111562001f315762001f3162001ecc565b50601f01601f191660200190565b6000806000806080858703121562001f5657600080fd5b62001f618562001e9c565b935062001f716020860162001eb4565b925060408501356001600160401b03808216821462001f8f57600080fd5b9092506060860135908082111562001fa657600080fd5b508501601f8101871362001fb957600080fd5b803562001fd062001fca8262001f15565b62001ee2565b81815288602083850101111562001fe657600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000602082840312156200201b57600080fd5b620020268262001e9c565b9392505050565b60008083601f8401126200204057600080fd5b5081356001600160401b038111156200205857600080fd5b6020830191508360208285010111156200207157600080fd5b9250929050565b6000806000806000608086880312156200209157600080fd5b6200209c8662001eb4565b9450620020ac6020870162001eb4565b93506040860135925060608601356001600160401b03811115620020cf57600080fd5b620020dd888289016200202d565b969995985093965092949392505050565b6000602082840312156200210157600080fd5b620020268262001eb4565b600080604083850312156200212057600080fd5b6200212b8362001e9c565b91506200213b6020840162001eb4565b90509250929050565b60008060008060008060a087890312156200215e57600080fd5b620021698762001eb4565b955060208701359450620021806040880162001e9c565b9350620021906060880162001eb4565b925060808701356001600160401b03811115620021ac57600080fd5b620021ba89828a016200202d565b979a9699509497509295939492505050565b600080600060608486031215620021e257600080fd5b620021ed8462001e9c565b9250620021fd6020850162001eb4565b91506200220d6040850162001eb4565b90509250925092565b600080604083850312156200222a57600080fd5b620022358362001e9c565b946020939093013593505050565b60005b838110156200226057818101518382015260200162002246565b8381111562002270576000848401525b50505050565b600081518084526200229081602086016020860162002243565b601f01601f19169290920160200192915050565b60018060a01b03841681528260208201526060604082015260006200192d606083018462002276565b634e487b7160e01b600052601160045260246000fd5b600082821015620022f857620022f8620022cd565b500390565b61ffff8716815260a0602082015260006200231c60a083018862002276565b6001600160a01b03871660408401528281036060840152848152848660208301376000602086830101526020601f19601f870116820101915050826080830152979650505050505050565b60006001600160401b03808316818103620023865762002386620022cd565b6001019392505050565b60008219821115620023a657620023a6620022cd565b500190565b604081526000620023c0604083018562002276565b82810360208401526200192d818562002276565b60008351620023e881846020880162002243565b835190830190620023fe81836020880162002243565b01949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156200246557600080fd5b815180151581146200202657600080fd5b6000602082840312156200248957600080fd5b81516001600160401b03811115620024a057600080fd5b8201601f81018413620024b257600080fd5b8051620024c362001fca8262001f15565b818152856020838501011115620024d957600080fd5b6200192d82602083016020860162002243565b61ffff841681526060602082015260006200250b606083018562002276565b82810360408401526200251f818562002276565b9695505050505050565b6000602082840312156200253c57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016200256e576200256e620022cd565b5060010190565b6001600160401b0360c01b8a60c01b16815260006bffffffffffffffffffffffff19808b60601b16600884015261ffff60f01b808b60f01b16601c85015289601e85015288603e85015287605e850152818760601b16607e850152808660f01b16609285015250508251620025f281609485016020870162002243565b919091016094019a995050505050505050505056fe60806040523480156200001157600080fd5b50604051620017ac380380620017ac8339810160408190526200003491620001f4565b8151829082906200004d90600090602085019062000081565b5080516200006390600190602084019062000081565b5050600680546001600160a01b03191633179055506200029a915050565b8280546200008f906200025e565b90600052602060002090601f016020900481019282620000b35760008555620000fe565b82601f10620000ce57805160ff1916838001178555620000fe565b82800160010185558215620000fe579182015b82811115620000fe578251825591602001919060010190620000e1565b506200010c92915062000110565b5090565b5b808211156200010c576000815560010162000111565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200014f57600080fd5b81516001600160401b03808211156200016c576200016c62000127565b604051601f8301601f19908116603f0116810190828211818310171562000197576200019762000127565b81604052838152602092508683858801011115620001b457600080fd5b600091505b83821015620001d85785820183015181830184015290820190620001b9565b83821115620001ea5760008385830101525b9695505050505050565b600080604083850312156200020857600080fd5b82516001600160401b03808211156200022057600080fd5b6200022e868387016200013d565b935060208501519150808211156200024557600080fd5b5062000254858286016200013d565b9150509250929050565b600181811c908216806200027357607f821691505b6020821081036200029457634e487b7160e01b600052602260045260246000fd5b50919050565b61150280620002aa6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80636352211e11610097578063b88d4fde11610066578063b88d4fde1461021d578063c87b56dd14610230578063e78cea9214610243578063e985e9c51461025657600080fd5b80636352211e146101ce57806370a08231146101e157806395d89b4114610202578063a22cb4651461020a57600080fd5b806323b872dd116100d357806323b872dd146101825780632a4a361d1461019557806342842e0e146101a85780635d4dacc9146101bb57600080fd5b806301ffc9a71461010557806306fdde031461012d578063081812fc14610142578063095ea7b31461016d575b600080fd5b610118610113366004611038565b610292565b60405190151581526020015b60405180910390f35b6101356102e4565b60405161012491906110a9565b6101556101503660046110bc565b610376565b6040516001600160a01b039091168152602001610124565b61018061017b3660046110f1565b61039d565b005b61018061019036600461111b565b6104b7565b6101806101a33660046111e3565b6104e8565b6101806101b636600461111b565b610551565b6101806101c93660046110bc565b61056c565b6101556101dc3660046110bc565b610622565b6101f46101ef36600461124e565b610682565b604051908152602001610124565b610135610708565b610180610218366004611269565b610717565b61018061022b3660046112a5565b610726565b61013561023e3660046110bc565b61075e565b600654610155906001600160a01b031681565b610118610264366004611321565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b14806102c357506001600160e01b03198216635b5e139f60e01b145b806102de57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546102f390611354565b80601f016020809104026020016040519081016040528092919081815260200182805461031f90611354565b801561036c5780601f106103415761010080835404028352916020019161036c565b820191906000526020600020905b81548152906001019060200180831161034f57829003601f168201915b5050505050905090565b600061038182610853565b506000908152600460205260409020546001600160a01b031690565b60006103a882610622565b9050806001600160a01b0316836001600160a01b03160361041a5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061043657506104368133610264565b6104a85760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610411565b6104b283836108a3565b505050565b6104c13382610911565b6104dd5760405162461bcd60e51b81526004016104119061138e565b6104b2838383610990565b6006546001600160a01b0316331461053d5760405162461bcd60e51b815260206004820152601860248201527763616c6c6572206973206e6f74207468652062726964676560401b6044820152606401610411565b6105478383610af4565b6104b28282610c61565b6104b283838360405180602001604052806000815250610726565b6006546001600160a01b031633146105c15760405162461bcd60e51b815260206004820152601860248201527763616c6c6572206973206e6f74207468652062726964676560401b6044820152606401610411565b6105ca81610cd5565b6106165760405162461bcd60e51b815260206004820152601960248201527f4275726e206f66206e6f6e6578697374656e7420746f6b656e000000000000006044820152606401610411565b61061f81610cf2565b50565b6000818152600260205260408120546001600160a01b0316806102de5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610411565b60006001600160a01b0382166106ec5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610411565b506001600160a01b031660009081526003602052604090205490565b6060600180546102f390611354565b610722338383610d87565b5050565b6107303383610911565b61074c5760405162461bcd60e51b81526004016104119061138e565b61075884848484610e55565b50505050565b606061076982610cd5565b6107b55760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610411565b600082815260076020526040902080546107ce90611354565b80601f01602080910402602001604051908101604052809291908181526020018280546107fa90611354565b80156108475780601f1061081c57610100808354040283529160200191610847565b820191906000526020600020905b81548152906001019060200180831161082a57829003601f168201915b50505050509050919050565b61085c81610cd5565b61061f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610411565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906108d882610622565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061091d83610622565b9050806001600160a01b0316846001600160a01b0316148061096457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806109885750836001600160a01b031661097d84610376565b6001600160a01b0316145b949350505050565b826001600160a01b03166109a382610622565b6001600160a01b0316146109c95760405162461bcd60e51b8152600401610411906113db565b6001600160a01b038216610a2b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610411565b826001600160a01b0316610a3e82610622565b6001600160a01b031614610a645760405162461bcd60e51b8152600401610411906113db565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610b4a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610411565b610b5381610cd5565b15610ba05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610411565b610ba981610cd5565b15610bf65760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610411565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b610c6a82610cd5565b610cb65760405162461bcd60e51b815260206004820152601c60248201527f55524920736574206f66206e6f6e6578697374656e7420746f6b656e000000006044820152606401610411565b600082815260076020908152604090912082516104b292840190610f89565b6000908152600260205260409020546001600160a01b0316151590565b6000610cfd82610622565b9050610d0882610622565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610de85760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610411565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610e60848484610990565b610e6c84848484610e88565b6107585760405162461bcd60e51b815260040161041190611420565b60006001600160a01b0384163b15610f7e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610ecc903390899088908890600401611472565b6020604051808303816000875af1925050508015610f07575060408051601f3d908101601f19168201909252610f04918101906114af565b60015b610f64573d808015610f35576040519150601f19603f3d011682016040523d82523d6000602084013e610f3a565b606091505b508051600003610f5c5760405162461bcd60e51b815260040161041190611420565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610988565b506001949350505050565b828054610f9590611354565b90600052602060002090601f016020900481019282610fb75760008555610ffd565b82601f10610fd057805160ff1916838001178555610ffd565b82800160010185558215610ffd579182015b82811115610ffd578251825591602001919060010190610fe2565b5061100992915061100d565b5090565b5b80821115611009576000815560010161100e565b6001600160e01b03198116811461061f57600080fd5b60006020828403121561104a57600080fd5b813561105581611022565b9392505050565b6000815180845260005b8181101561108257602081850181015186830182015201611066565b81811115611094576000602083870101525b50601f01601f19169290920160200192915050565b602081526000611055602083018461105c565b6000602082840312156110ce57600080fd5b5035919050565b80356001600160a01b03811681146110ec57600080fd5b919050565b6000806040838503121561110457600080fd5b61110d836110d5565b946020939093013593505050565b60008060006060848603121561113057600080fd5b611139846110d5565b9250611147602085016110d5565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561118857611188611157565b604051601f8501601f19908116603f011681019082821181831017156111b0576111b0611157565b816040528093508581528686860111156111c957600080fd5b858560208301376000602087830101525050509392505050565b6000806000606084860312156111f857600080fd5b611201846110d5565b925060208401359150604084013567ffffffffffffffff81111561122457600080fd5b8401601f8101861361123557600080fd5b6112448682356020840161116d565b9150509250925092565b60006020828403121561126057600080fd5b611055826110d5565b6000806040838503121561127c57600080fd5b611285836110d5565b91506020830135801515811461129a57600080fd5b809150509250929050565b600080600080608085870312156112bb57600080fd5b6112c4856110d5565b93506112d2602086016110d5565b925060408501359150606085013567ffffffffffffffff8111156112f557600080fd5b8501601f8101871361130657600080fd5b6113158782356020840161116d565b91505092959194509250565b6000806040838503121561133457600080fd5b61133d836110d5565b915061134b602084016110d5565b90509250929050565b600181811c9082168061136857607f821691505b60208210810361138857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906114a59083018461105c565b9695505050505050565b6000602082840312156114c157600080fd5b81516110558161102256fea2646970667358221220445b72e64bf61c384ce0da911195e56bb77daec0759a00f7fc3aeb20002b73bf64736f6c634300080e0033a2646970667358221220265a3d98c1274fc84fb70bf79c8b2ac87eb8ac9c5b9e2ec1c4100de17a2cdba164736f6c634300080e0033
Deployed Bytecode
0x6080604052600436106200012b5760003560e01c80639823bb0411620000ad578063b6399876116200006c578063b639987614620003a7578063c7f0da131462000410578063cfc932741462000435578063d294f0931462000465578063f2fde38b146200047d57600080fd5b80639823bb0414620002b35780639a8a059214620002f85780639eef9edb14620003295780639f2f1e061462000351578063abd6aef5146200038257600080fd5b806350c9c70211620000fa57806350c9c70214620001e45780635ec5d92e1462000209578063715018a6146200024757806386533d97146200025f5780638da5cb5b146200029357600080fd5b806303c9e62e1462000130578063137509461462000157578063150b7a02146200017c5780634b642e7814620001bf575b600080fd5b3480156200013d57600080fd5b50620001556200014f36600462001f3f565b620004a2565b005b3480156200016457600080fd5b50620001556200017636600462002008565b62000783565b3480156200018957600080fd5b50620001a16200019b36600462002078565b620008b0565b6040516001600160e01b031990911681526020015b60405180910390f35b348015620001cc57600080fd5b5062000155620001de366004620020ee565b62000934565b348015620001f157600080fd5b5062000155620002033660046200210c565b620009ed565b3480156200021657600080fd5b506200022e6200022836600462002008565b62000aad565b6040516001600160a01b039091168152602001620001b6565b3480156200025457600080fd5b506200015562000aef565b3480156200026c57600080fd5b50620002846200027e36600462002144565b62000b07565b604051908152602001620001b6565b348015620002a057600080fd5b506033546001600160a01b03166200022e565b348015620002c057600080fd5b506200022e620002d23660046200210c565b60666020908152600092835260408084209091529082529020546001600160a01b031681565b3480156200030557600080fd5b50606554620003159061ffff1681565b60405161ffff9091168152602001620001b6565b3480156200033657600080fd5b506065546200022e906201000090046001600160a01b031681565b3480156200035e57600080fd5b50620002846200037036600462002008565b60686020526000908152604090205481565b3480156200038f57600080fd5b5062000155620003a1366004620021cc565b62000b69565b348015620003b457600080fd5b50620003ed620003c6366004620020ee565b60676020526000908152604090205461ffff8116906201000090046001600160a01b031682565b6040805161ffff90931683526001600160a01b03909116602083015201620001b6565b3480156200041d57600080fd5b50620001556200042f36600462002216565b62000b85565b6200044c6200044636600462002144565b62000bdc565b6040516001600160401b039091168152602001620001b6565b3480156200047257600080fd5b506200015562000f1d565b3480156200048a57600080fd5b50620001556200049c366004620020ee565b62000f9c565b620004ad8462000aad565b6001600160a01b0316336001600160a01b031614620005135760405162461bcd60e51b815260206004820152601b60248201527f696e76616c69642062726964676548616e646c652063616c6c6572000000000060448201526064015b60405180910390fd5b6000620005208262001018565b60655461010082015191925061ffff9182169116146200057a5760405162461bcd60e51b815260206004820152601460248201527334b73b30b634b2103a30b933b2ba1031b430b4b760611b60448201526064016200050a565b606554604082015160009161ffff908116911603620006155750602081015160e082015160a0830151604051632142170760e11b81523060048201526001600160a01b0392831660248201526044810191909152908216906342842e0e90606401600060405180830381600087803b158015620005f657600080fd5b505af11580156200060b573d6000803e3d6000fd5b50505050620006e4565b60408083015161ffff16600090815260666020908152828220818601516001600160a01b03908116845291529190205416806200066d576200066a8360400151846020015185608001518660600151620011a9565b90505b809150806001600160a01b0316632a4a361d8460e001518560a001518660c001516040518463ffffffff1660e01b8152600401620006ae93929190620022a4565b600060405180830381600087803b158015620006c957600080fd5b505af1158015620006de573d6000803e3d6000fd5b50505050505b81600001516001600160401b03167f32aae95950c2e1f2c1a419165ba01c63c49604db10ee1b95d9960c0f5b9b9fa88360200151838560a0015186604001518b8860e0015160405162000773969594939291906001600160a01b0396871681529486166020860152604085019390935261ffff918216606085015216608083015290911660a082015260c00190565b60405180910390a2505050505050565b600054610100900460ff1615808015620007a45750600054600160ff909116105b80620007c05750303b158015620007c0575060005460ff166001145b620008255760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016200050a565b6000805460ff19166001179055801562000849576000805461ff0019166101001790555b6200085362001395565b6065805461ffff191661ffff84161790558015620008ac576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15b5050565b60006001600160a01b0386163014620009225760405162461bcd60e51b815260206004820152602d60248201527f63616e206f6e6c792062726964676520746f6b656e7320766961207472616e7360448201526c19995c939195081b595d1a1bd9609a1b60648201526084016200050a565b50630a85bd0160e11b95945050505050565b6200093e620013c9565b6001600160a01b0381166200098f5760405162461bcd60e51b815260206004820152601660248201527563616e6e6f74206265207a65726f206164647265737360501b60448201526064016200050a565b6065805462010000600160b01b031916620100006001600160a01b038416908102919091179091556040519081527f8c50b74d1b39acb1cf584c32dc754c0363d1e332ecf0f5685a2c07b90a3618cc9060200160405180910390a150565b620009f7620013c9565b6001600160a01b03811662000a485760405162461bcd60e51b815260206004820152601660248201527563616e6e6f74206265207a65726f206164647265737360501b60448201526064016200050a565b61ffff821660008181526069602090815260409182902080546001600160a01b0319166001600160a01b0386169081179091558251938452908301527f4e8cc4d358a86e40b05f3b3055827d060d9bd07a51ca0ae28d479b7782d22d199101620008a3565b61ffff81166000908152606960205260408120546001600160a01b03168062000ae95750506065546201000090046001600160a01b0316919050565b92915050565b62000af9620013c9565b62000b05600062001425565b565b60008062000b188888888862001477565b905062000b5d868286868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506200188792505050565b98975050505050505050565b62000b73620013c9565b62000b8083838362001936565b505050565b62000b8f620013c9565b61ffff8216600081815260686020908152604091829020849055815192835282018390527f47d9066e07019286c19790aa54f97c9830127e71edff41b453c7adeaa15d2fe89101620008a3565b60008062000bea8662000aad565b90506001600160a01b03811662000c345760405162461bcd60e51b815260206004820152600d60248201526c139bdd0814dd5c1c1bdc9d1959609a1b60448201526064016200050a565b61ffff86166000908152606a60205260408120546001600160401b0316925062000c618989898962001477565b905062000ca6878287878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506200188792505050565b34101562000cea5760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742046656560801b60448201526064016200050a565b604051632142170760e11b8152336004820152306024820152604481018990526001600160a01b038a16906342842e0e90606401600060405180830381600087803b15801562000d3957600080fd5b505af115801562000d4e573d6000803e3d6000fd5b505050506001600160a01b03891660009081526067602052604090205461ffff161562000dd257604051635d4dacc960e01b8152600481018990526001600160a01b038a1690635d4dacc990602401600060405180830381600087803b15801562000db857600080fd5b505af115801562000dcd573d6000803e3d6000fd5b505050505b61ffff871660009081526068602052604081205462000df29034620022e3565b9050826001600160a01b031663f4a6c3e6828a85338b8b886040518863ffffffff1660e01b815260040162000e2d96959493929190620022fd565b6000604051808303818588803b15801562000e4757600080fd5b505af115801562000e5c573d6000803e3d6000fd5b50505061ffff8a166000908152606a6020526040812080546001600160401b03169350915062000e8c8362002367565b82546101009290920a6001600160401b03818102199093169183160217909155604080516001600160a01b038e81168252602082018e905261ffff8d1692820192909252336060820152908a16608082015290861691507fe11d2ca26838f15acb41450029a785bb3d6f909b7f622ebf9c45524ded76f4119060a00160405180910390a25050509695505050505050565b62000f27620013c9565b604080513381524760208201527ff40b9ca28516abde647ef8ed0e7b155e16347eb4d8dd6eb29989ed2c0c3d27e8910160405180910390a16033546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801562000f99573d6000803e3d6000fd5b50565b62000fa6620013c9565b6001600160a01b0381166200100d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016200050a565b62000f998162001425565b604080516101208101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c082015260e081018290526101008101829052906200106c8382620019ef565b6001600160401b031682526200108460088262002390565b905062001092838262001a50565b6001600160a01b03166020830152620010ad60148262002390565b9050620010bb838262001ab9565b61ffff166040830152620010d160028262002390565b9050620010df838262001b1a565b6060830152620010f160208262002390565b9050620010ff838262001b1a565b60808301526200111160208262002390565b90506200111f838262001b7c565b60a08301526200113160208262002390565b90506200113f838262001a50565b6001600160a01b031660e08301526200115a60148262002390565b905062001168838262001ab9565b61ffff166101008301526200117f60028262002390565b90506200119e81828551620011959190620022e3565b85919062001bd5565b60c083015250919050565b60655460009061ffff90811690861603620012185760405162461bcd60e51b815260206004820152602860248201527f63616e206f6e6c79207772617020746f6b656e732066726f6d20666f726569676044820152676e20636861696e7360c01b60648201526084016200050a565b61ffff851660009081526066602090815260408083206001600160a01b0388811685529252909120541615620012915760405162461bcd60e51b815260206004820152601c60248201527f7772617070656420617373657420616c7265616479206578697374730000000060448201526064016200050a565b60006200129e8462001cee565b620012a98462001cee565b604051602001620012bc929190620023ab565b6040516020818303038152906040529050600060405180602001620012e19062001e8e565b601f1982820381018352601f9091011660408190526200130791908490602001620023d4565b60408051601f19818403018152908290526001600160f01b031960f08a901b1660208301526bffffffffffffffffffffffff19606089901b1660228301529150600090603601604051602081830303815290604052805190602001209050808251602084016000f59350833b6200137d57600080fd5b6200138a88888662001936565b505050949350505050565b600054610100900460ff16620013bf5760405162461bcd60e51b81526004016200050a9062002407565b62000b0562001df9565b6033546001600160a01b0316331462000b055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200050a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6065546001600160a01b0380861660009081526067602090815260409182902082518084019093525461ffff8181168085526201000090920490941691830191909152606093929092169187919015620014dd578051602082015190935091506200167a565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526001600160a01b038916906301ffc9a790602401602060405180830381865afa15801562001529573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200154f919062002452565b620015a75760405162461bcd60e51b815260206004820152602160248201527f6d75737420737570706f7274207468652045524337323120696e7465726661636044820152606560f81b60648201526084016200050a565b6040516301ffc9a760e01b8152635b5e139f60e01b60048201526001600160a01b038916906301ffc9a790602401602060405180830381865afa158015620015f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001619919062002452565b6200167a5760405162461bcd60e51b815260206004820152602a60248201527f6d75737420737570706f727420746865204552433732312d4d657461646174616044820152691032bc3a32b739b4b7b760b11b60648201526084016200050a565b6000886001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620016bb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620016e5919081019062002476565b90506000896001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa15801562001728573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262001752919081019062002476565b60405163c87b56dd60e01b8152600481018b90529091506000906001600160a01b038c169063c87b56dd90602401600060405180830381865afa1580156200179e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620017c8919081019062002476565b9050600080602085015191506020840151905062001876604051806101200160405280606a60008f61ffff1661ffff16815260200190815260200160002060009054906101000a90046001600160401b03166001600160401b03168152602001896001600160a01b031681526020018a61ffff1681526020018481526020018381526020018e81526020018581526020018c6001600160a01b031681526020018d61ffff1681525062001e2e565b9d9c50505050505050505050505050565b600080620018958562000aad565b6001600160a01b03166345e380a38686866040518463ffffffff1660e01b8152600401620018c693929190620024ec565b602060405180830381865afa158015620018e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200190a919062002529565b61ffff86166000908152606860205260409020549091506200192d908262002390565b95945050505050565b61ffff83811660008181526066602090815260408083206001600160a01b0388811680865291845282852080546001600160a01b03191689831690811790915583518085018552878152808601848152828852606787529685902090518154975199166001600160b01b031990971696909617620100009890921697909702179093555193845290927f196ccefd5b4acc77efd509b94050d515754966df1a8fe6f6a2a6defef4e5ed8f910160405180910390a3505050565b6000620019fe82600862002390565b8351101562001a475760405162461bcd60e51b8152602060048201526014602482015273746f55696e7436345f6f75744f66426f756e647360601b60448201526064016200050a565b50016008015190565b600062001a5f82601462002390565b8351101562001aa95760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016200050a565b500160200151600160601b900490565b600062001ac882600262002390565b8351101562001b115760405162461bcd60e51b8152602060048201526014602482015273746f55696e7431365f6f75744f66426f756e647360601b60448201526064016200050a565b50016002015190565b600062001b2982602062002390565b8351101562001b735760405162461bcd60e51b8152602060048201526015602482015274746f427974657333325f6f75744f66426f756e647360581b60448201526064016200050a565b50016020015190565b600062001b8b82602062002390565b8351101562001b735760405162461bcd60e51b8152602060048201526015602482015274746f55696e743235365f6f75744f66426f756e647360581b60448201526064016200050a565b60608162001be581601f62002390565b101562001c265760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b60448201526064016200050a565b62001c32828462002390565b8451101562001c785760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016200050a565b60608215801562001c99576040519150600082526020820160405262001ce5565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101562001cd457805183526020928301920162001cba565b5050858452601f01601f1916604052505b50949350505050565b606060005b60208110801562001d25575082816020811062001d145762001d1462002543565b1a60f81b6001600160f81b03191615155b1562001d40578062001d378162002559565b91505062001cf3565b6000816001600160401b0381111562001d5d5762001d5d62001ecc565b6040519080825280601f01601f19166020018201604052801562001d88576020820181803683370190505b50905060005b8281101562001df15784816020811062001dac5762001dac62002543565b1a60f81b82828151811062001dc55762001dc562002543565b60200101906001600160f81b031916908160001a9053508062001de88162002559565b91505062001d8e565b509392505050565b600054610100900460ff1662001e235760405162461bcd60e51b81526004016200050a9062002407565b62000b053362001425565b6060816000015182602001518360400151846060015185608001518660a001518760e001518861010001518960c0015160405160200162001e789998979695949392919062002575565b6040516020818303038152906040529050919050565b6117ac806200260883390190565b803561ffff8116811462001eaf57600080fd5b919050565b80356001600160a01b038116811462001eaf57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171562001f0d5762001f0d62001ecc565b604052919050565b60006001600160401b0382111562001f315762001f3162001ecc565b50601f01601f191660200190565b6000806000806080858703121562001f5657600080fd5b62001f618562001e9c565b935062001f716020860162001eb4565b925060408501356001600160401b03808216821462001f8f57600080fd5b9092506060860135908082111562001fa657600080fd5b508501601f8101871362001fb957600080fd5b803562001fd062001fca8262001f15565b62001ee2565b81815288602083850101111562001fe657600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000602082840312156200201b57600080fd5b620020268262001e9c565b9392505050565b60008083601f8401126200204057600080fd5b5081356001600160401b038111156200205857600080fd5b6020830191508360208285010111156200207157600080fd5b9250929050565b6000806000806000608086880312156200209157600080fd5b6200209c8662001eb4565b9450620020ac6020870162001eb4565b93506040860135925060608601356001600160401b03811115620020cf57600080fd5b620020dd888289016200202d565b969995985093965092949392505050565b6000602082840312156200210157600080fd5b620020268262001eb4565b600080604083850312156200212057600080fd5b6200212b8362001e9c565b91506200213b6020840162001eb4565b90509250929050565b60008060008060008060a087890312156200215e57600080fd5b620021698762001eb4565b955060208701359450620021806040880162001e9c565b9350620021906060880162001eb4565b925060808701356001600160401b03811115620021ac57600080fd5b620021ba89828a016200202d565b979a9699509497509295939492505050565b600080600060608486031215620021e257600080fd5b620021ed8462001e9c565b9250620021fd6020850162001eb4565b91506200220d6040850162001eb4565b90509250925092565b600080604083850312156200222a57600080fd5b620022358362001e9c565b946020939093013593505050565b60005b838110156200226057818101518382015260200162002246565b8381111562002270576000848401525b50505050565b600081518084526200229081602086016020860162002243565b601f01601f19169290920160200192915050565b60018060a01b03841681528260208201526060604082015260006200192d606083018462002276565b634e487b7160e01b600052601160045260246000fd5b600082821015620022f857620022f8620022cd565b500390565b61ffff8716815260a0602082015260006200231c60a083018862002276565b6001600160a01b03871660408401528281036060840152848152848660208301376000602086830101526020601f19601f870116820101915050826080830152979650505050505050565b60006001600160401b03808316818103620023865762002386620022cd565b6001019392505050565b60008219821115620023a657620023a6620022cd565b500190565b604081526000620023c0604083018562002276565b82810360208401526200192d818562002276565b60008351620023e881846020880162002243565b835190830190620023fe81836020880162002243565b01949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000602082840312156200246557600080fd5b815180151581146200202657600080fd5b6000602082840312156200248957600080fd5b81516001600160401b03811115620024a057600080fd5b8201601f81018413620024b257600080fd5b8051620024c362001fca8262001f15565b818152856020838501011115620024d957600080fd5b6200192d82602083016020860162002243565b61ffff841681526060602082015260006200250b606083018562002276565b82810360408401526200251f818562002276565b9695505050505050565b6000602082840312156200253c57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016200256e576200256e620022cd565b5060010190565b6001600160401b0360c01b8a60c01b16815260006bffffffffffffffffffffffff19808b60601b16600884015261ffff60f01b808b60f01b16601c85015289601e85015288603e85015287605e850152818760601b16607e850152808660f01b16609285015250508251620025f281609485016020870162002243565b919091016094019a995050505050505050505056fe60806040523480156200001157600080fd5b50604051620017ac380380620017ac8339810160408190526200003491620001f4565b8151829082906200004d90600090602085019062000081565b5080516200006390600190602084019062000081565b5050600680546001600160a01b03191633179055506200029a915050565b8280546200008f906200025e565b90600052602060002090601f016020900481019282620000b35760008555620000fe565b82601f10620000ce57805160ff1916838001178555620000fe565b82800160010185558215620000fe579182015b82811115620000fe578251825591602001919060010190620000e1565b506200010c92915062000110565b5090565b5b808211156200010c576000815560010162000111565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200014f57600080fd5b81516001600160401b03808211156200016c576200016c62000127565b604051601f8301601f19908116603f0116810190828211818310171562000197576200019762000127565b81604052838152602092508683858801011115620001b457600080fd5b600091505b83821015620001d85785820183015181830184015290820190620001b9565b83821115620001ea5760008385830101525b9695505050505050565b600080604083850312156200020857600080fd5b82516001600160401b03808211156200022057600080fd5b6200022e868387016200013d565b935060208501519150808211156200024557600080fd5b5062000254858286016200013d565b9150509250929050565b600181811c908216806200027357607f821691505b6020821081036200029457634e487b7160e01b600052602260045260246000fd5b50919050565b61150280620002aa6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80636352211e11610097578063b88d4fde11610066578063b88d4fde1461021d578063c87b56dd14610230578063e78cea9214610243578063e985e9c51461025657600080fd5b80636352211e146101ce57806370a08231146101e157806395d89b4114610202578063a22cb4651461020a57600080fd5b806323b872dd116100d357806323b872dd146101825780632a4a361d1461019557806342842e0e146101a85780635d4dacc9146101bb57600080fd5b806301ffc9a71461010557806306fdde031461012d578063081812fc14610142578063095ea7b31461016d575b600080fd5b610118610113366004611038565b610292565b60405190151581526020015b60405180910390f35b6101356102e4565b60405161012491906110a9565b6101556101503660046110bc565b610376565b6040516001600160a01b039091168152602001610124565b61018061017b3660046110f1565b61039d565b005b61018061019036600461111b565b6104b7565b6101806101a33660046111e3565b6104e8565b6101806101b636600461111b565b610551565b6101806101c93660046110bc565b61056c565b6101556101dc3660046110bc565b610622565b6101f46101ef36600461124e565b610682565b604051908152602001610124565b610135610708565b610180610218366004611269565b610717565b61018061022b3660046112a5565b610726565b61013561023e3660046110bc565b61075e565b600654610155906001600160a01b031681565b610118610264366004611321565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b14806102c357506001600160e01b03198216635b5e139f60e01b145b806102de57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546102f390611354565b80601f016020809104026020016040519081016040528092919081815260200182805461031f90611354565b801561036c5780601f106103415761010080835404028352916020019161036c565b820191906000526020600020905b81548152906001019060200180831161034f57829003601f168201915b5050505050905090565b600061038182610853565b506000908152600460205260409020546001600160a01b031690565b60006103a882610622565b9050806001600160a01b0316836001600160a01b03160361041a5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061043657506104368133610264565b6104a85760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610411565b6104b283836108a3565b505050565b6104c13382610911565b6104dd5760405162461bcd60e51b81526004016104119061138e565b6104b2838383610990565b6006546001600160a01b0316331461053d5760405162461bcd60e51b815260206004820152601860248201527763616c6c6572206973206e6f74207468652062726964676560401b6044820152606401610411565b6105478383610af4565b6104b28282610c61565b6104b283838360405180602001604052806000815250610726565b6006546001600160a01b031633146105c15760405162461bcd60e51b815260206004820152601860248201527763616c6c6572206973206e6f74207468652062726964676560401b6044820152606401610411565b6105ca81610cd5565b6106165760405162461bcd60e51b815260206004820152601960248201527f4275726e206f66206e6f6e6578697374656e7420746f6b656e000000000000006044820152606401610411565b61061f81610cf2565b50565b6000818152600260205260408120546001600160a01b0316806102de5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610411565b60006001600160a01b0382166106ec5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610411565b506001600160a01b031660009081526003602052604090205490565b6060600180546102f390611354565b610722338383610d87565b5050565b6107303383610911565b61074c5760405162461bcd60e51b81526004016104119061138e565b61075884848484610e55565b50505050565b606061076982610cd5565b6107b55760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610411565b600082815260076020526040902080546107ce90611354565b80601f01602080910402602001604051908101604052809291908181526020018280546107fa90611354565b80156108475780601f1061081c57610100808354040283529160200191610847565b820191906000526020600020905b81548152906001019060200180831161082a57829003601f168201915b50505050509050919050565b61085c81610cd5565b61061f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610411565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906108d882610622565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008061091d83610622565b9050806001600160a01b0316846001600160a01b0316148061096457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806109885750836001600160a01b031661097d84610376565b6001600160a01b0316145b949350505050565b826001600160a01b03166109a382610622565b6001600160a01b0316146109c95760405162461bcd60e51b8152600401610411906113db565b6001600160a01b038216610a2b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610411565b826001600160a01b0316610a3e82610622565b6001600160a01b031614610a645760405162461bcd60e51b8152600401610411906113db565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b038216610b4a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610411565b610b5381610cd5565b15610ba05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610411565b610ba981610cd5565b15610bf65760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610411565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b610c6a82610cd5565b610cb65760405162461bcd60e51b815260206004820152601c60248201527f55524920736574206f66206e6f6e6578697374656e7420746f6b656e000000006044820152606401610411565b600082815260076020908152604090912082516104b292840190610f89565b6000908152600260205260409020546001600160a01b0316151590565b6000610cfd82610622565b9050610d0882610622565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031603610de85760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610411565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610e60848484610990565b610e6c84848484610e88565b6107585760405162461bcd60e51b815260040161041190611420565b60006001600160a01b0384163b15610f7e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610ecc903390899088908890600401611472565b6020604051808303816000875af1925050508015610f07575060408051601f3d908101601f19168201909252610f04918101906114af565b60015b610f64573d808015610f35576040519150601f19603f3d011682016040523d82523d6000602084013e610f3a565b606091505b508051600003610f5c5760405162461bcd60e51b815260040161041190611420565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610988565b506001949350505050565b828054610f9590611354565b90600052602060002090601f016020900481019282610fb75760008555610ffd565b82601f10610fd057805160ff1916838001178555610ffd565b82800160010185558215610ffd579182015b82811115610ffd578251825591602001919060010190610fe2565b5061100992915061100d565b5090565b5b80821115611009576000815560010161100e565b6001600160e01b03198116811461061f57600080fd5b60006020828403121561104a57600080fd5b813561105581611022565b9392505050565b6000815180845260005b8181101561108257602081850181015186830182015201611066565b81811115611094576000602083870101525b50601f01601f19169290920160200192915050565b602081526000611055602083018461105c565b6000602082840312156110ce57600080fd5b5035919050565b80356001600160a01b03811681146110ec57600080fd5b919050565b6000806040838503121561110457600080fd5b61110d836110d5565b946020939093013593505050565b60008060006060848603121561113057600080fd5b611139846110d5565b9250611147602085016110d5565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561118857611188611157565b604051601f8501601f19908116603f011681019082821181831017156111b0576111b0611157565b816040528093508581528686860111156111c957600080fd5b858560208301376000602087830101525050509392505050565b6000806000606084860312156111f857600080fd5b611201846110d5565b925060208401359150604084013567ffffffffffffffff81111561122457600080fd5b8401601f8101861361123557600080fd5b6112448682356020840161116d565b9150509250925092565b60006020828403121561126057600080fd5b611055826110d5565b6000806040838503121561127c57600080fd5b611285836110d5565b91506020830135801515811461129a57600080fd5b809150509250929050565b600080600080608085870312156112bb57600080fd5b6112c4856110d5565b93506112d2602086016110d5565b925060408501359150606085013567ffffffffffffffff8111156112f557600080fd5b8501601f8101871361130657600080fd5b6113158782356020840161116d565b91505092959194509250565b6000806040838503121561133457600080fd5b61133d836110d5565b915061134b602084016110d5565b90509250929050565b600181811c9082168061136857607f821691505b60208210810361138857634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906114a59083018461105c565b9695505050505050565b6000602082840312156114c157600080fd5b81516110558161102256fea2646970667358221220445b72e64bf61c384ce0da911195e56bb77daec0759a00f7fc3aeb20002b73bf64736f6c634300080e0033a2646970667358221220265a3d98c1274fc84fb70bf79c8b2ac87eb8ac9c5b9e2ec1c4100de17a2cdba164736f6c634300080e0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.