Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
14400655 | 4 days ago | 0 ETH | ||||
14400410 | 4 days ago | 0.00001888 ETH | ||||
14400370 | 4 days ago | 0.00001888 ETH | ||||
14400336 | 4 days ago | 0.00001888 ETH | ||||
14370387 | 5 days ago | 0 ETH | ||||
14370330 | 5 days ago | 0 ETH | ||||
14370218 | 5 days ago | 0 ETH | ||||
14370179 | 5 days ago | 0 ETH | ||||
14317190 | 6 days ago | 0 ETH | ||||
14317129 | 6 days ago | 0 ETH | ||||
14317067 | 6 days ago | 0 ETH | ||||
14316966 | 6 days ago | 0 ETH | ||||
14316709 | 6 days ago | 0.00001774 ETH | ||||
14316685 | 6 days ago | 0.00001774 ETH | ||||
14233186 | 8 days ago | 0 ETH | ||||
14233103 | 8 days ago | 0 ETH | ||||
14233071 | 8 days ago | 0 ETH | ||||
14233035 | 8 days ago | 0 ETH | ||||
14232674 | 8 days ago | 0.00001694 ETH | ||||
14232570 | 8 days ago | 0.00001694 ETH | ||||
14166676 | 10 days ago | 0 ETH | ||||
14166598 | 10 days ago | 0 ETH | ||||
14166549 | 10 days ago | 0 ETH | ||||
14166514 | 10 days ago | 0 ETH | ||||
14166126 | 10 days ago | 0.00001689 ETH |
Loading...
Loading
Contract Name:
Battlemon
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "./interfaces/IBattlemonGem.sol"; import "./interfaces/IBattlemon.sol"; import "./lz/oapp/OApp.sol"; contract Battlemon is Initializable, ERC721Upgradeable, OApp, IBattlemon { using StringsUpgradeable for uint256; uint256 private _randNonce; uint256 public _nextTokenId; address public itemsContract; address public boxAddress; address public gemsAddress; address public raids; address public tresuary; // Must end with "/" string private _uri; uint16 public totalAlphaSupply; uint256 public totalOmegaSupply; bytes1 public alphaPrefix; // a1 bytes1 public omegaPrefix; // b1 // Map Lemon id to Items mapping(uint256 => EquippedItem[10]) public equipment; // Lemon id => Metadata mapping(uint256 => Metadata) private _lemonData; /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( address tresuary_, string calldata uri, address _endpoint, uint256 startTokenId ) public initializer { __ERC721_init("Battlemon", "BL"); __OApp_init(_endpoint, msg.sender); __Ownable_init(); alphaPrefix = toBytes(161); // a1 omegaPrefix = toBytes(177); // b1 tresuary = tresuary_; _uri = uri; _nextTokenId = startTokenId; } function boxMint(address to) external { require(msg.sender == boxAddress, "Lemons: Caller not the boxAddress"); _innerMint(to, alphaPrefix); } function levelUp(uint256 lemonId, uint256 gemId) external { require( _lemonData[lemonId].lemonType == 1, "Lemons:levelUp: Must be only Alpha" ); require( ownerOf(lemonId) == msg.sender, "Lemons:levelUp: Not lemon owner" ); IBattlemonGem gem = IBattlemonGem(gemsAddress); require( gem.checkOwnerOf(gemId, msg.sender), "Lemons:levelUp: Not gem owner" ); uint256 _lemonLevel = levelOf(lemonId); require( gem.levelOf(gemId) == _lemonLevel + 1, "Lemons:levelUp: Wrong gem level" ); gem.burn(gemId); _lemonData[lemonId].level += 1; _mintOmega(msg.sender, lemonId); emit Lvlup( lemonId, 1, levelOf(lemonId), _lemonData[lemonId].agility, _lemonData[lemonId].speed, _lemonData[lemonId].luck, _lemonData[lemonId].dna ); } function _innerMint(address to, bytes1 prefix) private { uint8 level = 1; uint256 tokenId = _nextTokenId++; _safeMint(to, tokenId); uint256 agility = 3; uint256 speed = 3; uint256 luck = 3; bytes memory randomSkin = abi.encodePacked( bytes12(keccak256(abi.encodePacked(_random(10000)))) ); bytes memory dna = abi.encodePacked(prefix, randomSkin); _lemonData[tokenId] = Metadata({ level: level, lemonType: 1, agility: agility, speed: speed, luck: luck, dna: dna }); totalAlphaSupply += 1; emit Create(to, tokenId, 1, agility, speed, luck, dna, level); } function _mintOmega(address to, uint256 lemonId) private { uint256 tokenId = _nextTokenId++; _safeMint(to, tokenId); uint256 agility = 1; uint256 speed = 1; uint256 luck = 1; bytes memory dna = _lemonData[lemonId].dna; dna[0] = bytes1(omegaPrefix); _lemonData[tokenId] = Metadata({ level: 1, lemonType: 0, agility: agility, speed: speed, luck: luck, dna: dna }); totalOmegaSupply++; emit Create(to, tokenId, 0, agility, speed, luck, dna, 1); } /** * * @param _lemonId Id of lemon token * @notice To unequip specific item set it's id to -1 * @notice To skip item set it's id to -2 or less */ function changeEquipmentBatch( uint256 _lemonId, int[] calldata items ) external { require(items.length == 10, "Lemons: Wrong equipment amount"); require(ownerOf(_lemonId) == msg.sender, "Lemons: Not token owner"); IBattlemonItems.Metadata[10] memory itemsMetadata; for (uint256 itemType = 0; itemType < 10; itemType++) { // item ownership check located in Items.sol int id = items[itemType]; require(id >= -1, "Lemons: wrong id"); // Sender wants to equip if (id > -1) { IBattlemonItems.Metadata memory data = IBattlemonItems( itemsContract ).getItemData(uint256(id)); // Check that item is suitable require( data.itemType == itemType, "Lemons: Wrong item type for slot" ); // Return item to it's owner if (equipment[_lemonId][itemType].equipped == true) { uint256 itemToReturn = equipment[_lemonId][itemType].itemId; _lemonData[_lemonId].agility -= data.agility; _lemonData[_lemonId].speed -= data.speed; _lemonData[_lemonId].luck -= data.luck; IBattlemonItems(itemsContract).unequipItem( itemToReturn, msg.sender ); } // Start equipping process _lemonData[_lemonId].agility += data.agility; _lemonData[_lemonId].speed += data.speed; _lemonData[_lemonId].luck += data.luck; IBattlemonItems(itemsContract).equipItem( uint256(id), msg.sender ); itemsMetadata[itemType] = IBattlemonItems(itemsContract) .getItemData(uint256(id)); equipment[_lemonId][itemType].equipped = true; equipment[_lemonId][itemType].itemId = uint256(id); } // Sender wants to unequip if (id == -1) { if (equipment[_lemonId][itemType].equipped) { IBattlemonItems.Metadata memory data = IBattlemonItems( itemsContract ).getItemData(equipment[_lemonId][itemType].itemId); uint256 itemToReturn = equipment[_lemonId][itemType].itemId; _lemonData[_lemonId].agility -= data.agility; _lemonData[_lemonId].speed -= data.speed; _lemonData[_lemonId].luck -= data.luck; IBattlemonItems(itemsContract).unequipItem( itemToReturn, msg.sender ); equipment[_lemonId][itemType].equipped = false; equipment[_lemonId][itemType].itemId = 0; } } } emit EquipmentChanged( msg.sender, _lemonId, _lemonData[_lemonId], items, itemsMetadata ); } function getEquipment( uint256 tokenId, uint256 itemType ) public view returns (int) { if (!equipment[tokenId][itemType].equipped) { return -1; } return int(equipment[tokenId][itemType].itemId); } function slotEquipped( uint256 tokenId, uint256 itemType ) public view returns (bool) { return equipment[tokenId][itemType].equipped; } function getAllEquipment( uint256 tokenId ) public view returns (int[10] memory) { int[10] memory res; for (uint256 itemType = 0; itemType < 10; ++itemType) { if (equipment[tokenId][itemType].equipped == true) { res[itemType] = int(equipment[tokenId][itemType].itemId); } else { res[itemType] = -1; } } return res; } function tokenURI( uint256 tokenId ) public view override returns (string memory) { _requireMinted(tokenId); return string(abi.encodePacked(_baseURI(), tokenId.toString())); } function _baseURI() internal view override returns (string memory) { return _uri; } function setAddresses( address _items, address _gems, address _box, address _raids ) public onlyOwner { require( _items != address(0) && _gems != address(0) && _box != address(0) && _raids != address(0), "Lemons: Zero address" ); itemsContract = _items; gemsAddress = _gems; boxAddress = _box; raids = _raids; } function setBaseURI(string memory newURI) public onlyOwner { _uri = newURI; } function levelOf(uint256 id) public view returns (uint8) { return _lemonData[id].level; } function withdraw() public onlyOwner { (bool s, ) = payable(tresuary).call{value: address(this).balance}(""); require(s, "Lemons: Withdraw went wrong"); } function _random(uint256 mod) private returns (uint256) { _randNonce++; return uint256( keccak256( abi.encodePacked(block.timestamp, msg.sender, _randNonce) ) ) % mod; } // For cases when user transfers lemons with items // Items also will be transfered function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 ) internal override { // If minting if (from == address(0)) return; // Get all items int[10] memory equip = getAllEquipment(firstTokenId); // For every item (if equipped) do transfer to new owner for (uint256 i = 0; i < equip.length; i++) { if (equip[i] >= 0) { IBattlemonItems(itemsContract).transferEquippedItem( to, uint256(equip[i]) ); } } } function sendLemonToRaid(uint256 lemonId, address caller) external { require(msg.sender == raids, "Lemons: Not raids address"); require(ownerOf(lemonId) == caller, "Lemons: Not owner"); _transfer(caller, msg.sender, lemonId); } function changeAlphaPrefix(uint8 newPrefix) public onlyOwner { alphaPrefix = toBytes(newPrefix); } function changeOmegaPrefix(uint8 newPrefix) public onlyOwner { omegaPrefix = toBytes(newPrefix); } function toBytes(uint8 x) public pure returns (bytes1) { return bytes1(abi.encodePacked(x)); } function lemonData( uint id ) public view returns (IBattlemon.Metadata memory) { return _lemonData[id]; } function totalSupply() public view returns (uint) { return totalAlphaSupply + totalOmegaSupply; } function quote( uint32 _dstEid, string memory _message, bytes memory _options, bool _payInLzToken ) public view returns (MessagingFee memory fee) { bytes memory message = abi.encode(_message); fee = _quote(_dstEid, message, _options, _payInLzToken); } function lzSend( uint32 dstEid, uint256 tokenId, bytes calldata _options ) public payable returns (MessagingReceipt memory) { for (uint256 itemType = 0; itemType < 10; itemType++) { require( !slotEquipped(tokenId, itemType), "Lemons: Can't execute crosschain with equipped items" ); } _burn(tokenId); MessagingReceipt memory receipt; Metadata memory data = _lemonData[tokenId]; bytes memory _payload = abi.encode( msg.sender, tokenId, data.level, data.lemonType, data.dna, data.agility, data.speed, data.luck ); receipt = _lzSend( dstEid, _payload, _options, MessagingFee(msg.value, 0), payable(msg.sender) ); return receipt; } // struct Origin { // uint32 srcEid; // bytes32 sender; // uint64 nonce; // } function _lzReceive( Origin calldata, bytes32, bytes calldata _message, address, bytes calldata ) internal virtual override { ( address sender, uint256 tokenId, uint8 level, uint8 lemonType, bytes memory dna, uint256 agility, uint256 speed, uint256 luck ) = abi.decode( _message, ( address, uint256, uint8, uint8, bytes, uint256, uint256, uint256 ) ); _mint(sender, tokenId); _lemonData[tokenId] = Metadata({ level: level, lemonType: lemonType, agility: agility, speed: speed, luck: luck, dna: dna }); emit CrosschainTransfer( sender, tokenId, 1, agility, speed, luck, dna, level ); } function airdrop( address[] calldata to, bytes[] calldata dna ) public onlyOwner { require(to.length == dna.length, "Airdrop: Different length"); uint8 level = 1; for (uint i = 0; i < to.length; i++) { uint256 tokenId = _nextTokenId++; _safeMint(to[i], tokenId); _lemonData[tokenId] = Metadata({ level: level, lemonType: 1, agility: 3, speed: 3, luck: 3, dna: dna[i] }); emit Create(to[i], tokenId, 1, 3, 3, 3, dna[i], level); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { IMessageLibManager } from "./IMessageLibManager.sol"; import { IMessagingComposer } from "./IMessagingComposer.sol"; import { IMessagingChannel } from "./IMessagingChannel.sol"; import { IMessagingContext } from "./IMessagingContext.sol"; struct MessagingParams { uint32 dstEid; bytes32 receiver; bytes message; bytes options; bool payInLzToken; } struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; } struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; } struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; } interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext { event PacketSent(bytes encodedPayload, bytes options, address sendLibrary); event PacketVerified(Origin origin, address receiver, bytes32 payloadHash); event PacketDelivered(Origin origin, address receiver); event LzReceiveAlert( address indexed receiver, address indexed executor, Origin origin, bytes32 guid, uint256 gas, uint256 value, bytes message, bytes extraData, bytes reason ); event LzTokenSet(address token); event DelegateSet(address sender, address delegate); function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory); function send( MessagingParams calldata _params, address _refundAddress ) external payable returns (MessagingReceipt memory); function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external; function verifiable(Origin calldata _origin, address _receiver) external view returns (bool); function initializable(Origin calldata _origin, address _receiver) external view returns (bool); function lzReceive( Origin calldata _origin, address _receiver, bytes32 _guid, bytes calldata _message, bytes calldata _extraData ) external payable; // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external; function setLzToken(address _lzToken) external; function lzToken() external view returns (address); function nativeToken() external view returns (address); function setDelegate(address _delegate) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { Origin } from "./ILayerZeroEndpointV2.sol"; interface ILayerZeroReceiver { function allowInitializePath(Origin calldata _origin) external view returns (bool); function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64); function lzReceive( Origin calldata _origin, bytes32 _guid, bytes calldata _message, address _executor, bytes calldata _extraData ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; struct SetConfigParam { uint32 eid; uint32 configType; bytes config; } interface IMessageLibManager { struct Timeout { address lib; uint256 expiry; } event LibraryRegistered(address newLib); event DefaultSendLibrarySet(uint32 eid, address newLib); event DefaultReceiveLibrarySet(uint32 eid, address newLib); event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry); event SendLibrarySet(address sender, uint32 eid, address newLib); event ReceiveLibrarySet(address receiver, uint32 eid, address newLib); event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout); function registerLibrary(address _lib) external; function isRegisteredLibrary(address _lib) external view returns (bool); function getRegisteredLibraries() external view returns (address[] memory); function setDefaultSendLibrary(uint32 _eid, address _newLib) external; function defaultSendLibrary(uint32 _eid) external view returns (address); function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external; function defaultReceiveLibrary(uint32 _eid) external view returns (address); function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external; function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry); function isSupportedEid(uint32 _eid) external view returns (bool); function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool); /// ------------------- OApp interfaces ------------------- function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external; function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib); function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool); function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external; function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault); function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external; function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry); function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external; function getConfig( address _oapp, address _lib, uint32 _eid, uint32 _configType ) external view returns (bytes memory config); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingChannel { event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce); event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); function eid() external view returns (uint32); // this is an emergency function if a message cannot be verified for some reasons // required to provide _nextNonce to avoid race condition function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external; function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32); function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64); function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64); function inboundPayloadHash( address _receiver, uint32 _srcEid, bytes32 _sender, uint64 _nonce ) external view returns (bytes32); function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingComposer { event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message); event ComposeDelivered(address from, address to, bytes32 guid, uint16 index); event LzComposeAlert( address indexed from, address indexed to, address indexed executor, bytes32 guid, uint16 index, uint256 gas, uint256 value, bytes message, bytes extraData, bytes reason ); function composeQueue( address _from, address _to, bytes32 _guid, uint16 _index ) external view returns (bytes32 messageHash); function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external; function lzCompose( address _from, address _to, bytes32 _guid, uint16 _index, bytes calldata _message, bytes calldata _extraData ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingContext { function isSendingMessage() external view returns (bool); function getSendContext() external view returns (uint32 dstEid, address sender); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import {Initializable} from "../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) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267Upgradeable { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// 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) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable 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. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).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 = ERC721Upgradeable.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 = ERC721Upgradeable.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 = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721Upgradeable.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(ERC721Upgradeable.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(ERC721Upgradeable.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(ERC721Upgradeable.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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.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; } /** * @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[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @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.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 IERC721ReceiverUpgradeable { /** * @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) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @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.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 (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; import {Initializable} from "../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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } /** * @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) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSAUpgradeable.sol"; import "../../interfaces/IERC5267Upgradeable.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:storage-size 52 */ abstract contract EIP712Upgradeable is Initializable, IERC5267Upgradeable { bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /// @custom:oz-renamed-from _HASHED_NAME bytes32 private _hashedName; /// @custom:oz-renamed-from _HASHED_VERSION bytes32 private _hashedVersion; string private _name; string private _version; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { _name = name; _version = version; // Reset prior values in storage if upgrading _hashedName = 0; _hashedVersion = 0; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(); } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized // and the EIP712 domain is not reliable, as it will be missing name and version. require(_hashedName == 0 && _hashedVersion == 0, "EIP712: Uninitialized"); return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Name() internal virtual view returns (string memory) { return _name; } /** * @dev The version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712Version() internal virtual view returns (string memory) { return _version; } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead. */ function _EIP712NameHash() internal view returns (bytes32) { string memory name = _EIP712Name(); if (bytes(name).length > 0) { return keccak256(bytes(name)); } else { // If the name is empty, the contract may have been upgraded without initializing the new storage. // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design. bytes32 hashedName = _hashedName; if (hashedName != 0) { return hashedName; } else { return keccak256(""); } } } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead. */ function _EIP712VersionHash() internal view returns (bytes32) { string memory version = _EIP712Version(); if (bytes(version).length > 0) { return keccak256(bytes(version)); } else { // If the version is empty, the contract may have been upgraded without initializing the new storage. // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design. bytes32 hashedVersion = _hashedVersion; if (hashedVersion != 0) { return hashedVersion; } else { return keccak256(""); } } } /** * @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[48] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import {Initializable} from "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @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 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 IERC165Upgradeable { /** * @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 MathUpgradeable { 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 SignedMathUpgradeable { /** * @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/MathUpgradeable.sol"; import "./math/SignedMathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { 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 = MathUpgradeable.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(SignedMathUpgradeable.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, MathUpgradeable.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 // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// 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 (last updated v4.9.4) (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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
//SPDX-License-Identifier: MIT pragma solidity 0.8.20; import "./IBattlemonItems.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; interface IBattlemon is IERC721Upgradeable { event EquipmentChanged( address indexed owner, uint256 indexed lemonId, Metadata lemonData, int[] itemsIds, IBattlemonItems.Metadata[10] itemsMetadata ); event Lvlup( uint256 indexed tokenId, uint256 lemonType, uint256 indexed level, uint256 agility, uint256 speed, uint256 luck, bytes dna ); event Create( address indexed to, uint256 indexed tokenId, uint8 indexed lemonType, uint256 agility, uint256 speed, uint256 luck, bytes dna, uint256 level ); event CrosschainTransfer( address indexed to, uint256 indexed tokenId, uint8 indexed lemonType, uint256 agility, uint256 speed, uint256 luck, bytes dna, uint256 level ); struct Metadata { uint8 level; // 0-OMEGA, 1-ALPHA uint8 lemonType; bytes dna; uint256 agility; uint256 speed; uint256 luck; } struct EquippedItem { uint256 itemId; // Required because itemId can be 0 when item actually has id == 0 bool equipped; } function sendLemonToRaid(uint256 lemonId, address caller) external; function boxMint(address to) external; function levelOf(uint id) external view returns (uint8); function lemonData(uint id) external view returns (Metadata memory); }
//SPDX-License-Identifier: MIT pragma solidity 0.8.20; interface IBattlemonGem { function mint(address to, uint8 level) external; function levelOf(uint256 tokenId) external view returns (uint8); function burn(uint gemId) external; function checkOwnerOf( uint gemId, address sender ) external view returns (bool); }
//SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.20; interface IBattlemonItems { event MintRandom( address indexed account, uint256 indexed itemId, string itemName ); struct Metadata { bool isEquipped; uint8 itemType; uint8 level; // Stats uint agility; uint speed; uint luck; // Used only for equipment // All the rest of the time = address(0) address actualOwner; bytes dna; } function mintRandom(address account) external; function rewardMint(address account, uint amount) external; // function mintSpecificItem(address account, uint256 itemType, uint256 id, uint256 amount) external; function equipItem(uint id, address sender) external; function unequipItem(uint id, address sender) external; function getItemData(uint tokenId) external view returns (Metadata memory); function transferEquippedItem(address to, uint id) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {ILayerZeroEndpointV2} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol"; /** * @title IOAppCore */ interface IOAppCore { // Custom error messages error OnlyPeer(uint32 eid, bytes32 sender); error NoPeer(uint32 eid); error InvalidEndpointCall(); error InvalidDelegate(); // Event emitted when a peer (OApp) is set for a corresponding endpoint event PeerSet(uint32 eid, bytes32 peer); /** * @notice Retrieves the OApp version information. * @return senderVersion The version of the OAppSender.sol contract. * @return receiverVersion The version of the OAppReceiver.sol contract. */ function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion); /** * @notice Retrieves the LayerZero endpoint associated with the OApp. * @return iEndpoint The LayerZero endpoint as an interface. */ function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint); /** * @notice Retrieves the peer (OApp) associated with a corresponding endpoint. * @param _eid The endpoint ID. * @return peer The peer address (OApp instance) associated with the corresponding endpoint. */ function peers(uint32 _eid) external view returns (bytes32 peer); /** * @notice Sets the peer address (OApp instance) for a corresponding endpoint. * @param _eid The endpoint ID. * @param _peer The address of the peer to be associated with the corresponding endpoint. */ function setPeer(uint32 _eid, bytes32 _peer) external; /** * @notice Sets the delegate address for the OApp Core. * @param _delegate The address of the delegate to be set. */ function setDelegate(address _delegate) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {ILayerZeroReceiver, Origin} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol"; interface IOAppReceiver is ILayerZeroReceiver { /** * @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint. * @return sender The address responsible for 'sending' composeMsg's to the Endpoint. * * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer. * @dev The default sender IS the OApp implementer. */ function composeMsgSender() external view returns (address sender); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; // @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers // solhint-disable-next-line no-unused-import import {OAppSender, MessagingFee, MessagingReceipt} from "./OAppSender.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; // @dev Import the 'Origin' so it's exposed to OApp implementers // solhint-disable-next-line no-unused-import import {OAppReceiver, Origin} from "./OAppReceiver.sol"; import {OAppCore} from "./OAppCore.sol"; /** * @title OApp * @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality. */ abstract contract OApp is Initializable, OAppSender, OAppReceiver { /** * @dev Constructor to initialize the OApp with the provided endpoint and owner. * @param _endpoint The address of the LOCAL LayerZero endpoint. * @param _delegate The delegate capable of making OApp configurations inside of the endpoint. */ // constructor(address _endpoint, address _delegate) OAppCore(_endpoint, _delegate) {} function __OApp_init( address _endpoint, address _delegate ) internal onlyInitializing { __OAppCore_init(_endpoint, _delegate); } /** * @notice Retrieves the OApp version information. * @return senderVersion The version of the OAppSender.sol implementation. * @return receiverVersion The version of the OAppReceiver.sol implementation. */ function oAppVersion() public pure virtual override(OAppSender, OAppReceiver) returns (uint64 senderVersion, uint64 receiverVersion) { return (SENDER_VERSION, RECEIVER_VERSION); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {IOAppCore, ILayerZeroEndpointV2} from "./interfaces/IOAppCore.sol"; /** * @title OAppCore * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations. */ abstract contract OAppCore is IOAppCore, OwnableUpgradeable { // The LayerZero endpoint associated with the given OApp ILayerZeroEndpointV2 public endpoint; // Mapping to store peers associated with corresponding endpoints mapping(uint32 eid => bytes32 peer) public peers; /** * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate. * @param _endpoint The address of the LOCAL Layer Zero endpoint. * @param _delegate The delegate capable of making OApp configurations inside of the endpoint. * * @dev The delegate typically should be set as the owner of the contract. */ function __OAppCore_init(address _endpoint, address _delegate) internal { endpoint = ILayerZeroEndpointV2(_endpoint); if (_delegate == address(0)) revert InvalidDelegate(); endpoint.setDelegate(_delegate); } /** * @notice Sets the peer address (OApp instance) for a corresponding endpoint. * @param _eid The endpoint ID. * @param _peer The address of the peer to be associated with the corresponding endpoint. * * @dev Only the owner/admin of the OApp can call this function. * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp. * @dev Set this to bytes32(0) to remove the peer address. * @dev Peer is a bytes32 to accommodate non-evm chains. */ function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner { peers[_eid] = _peer; emit PeerSet(_eid, _peer); } /** * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set. * ie. the peer is set to bytes32(0). * @param _eid The endpoint ID. * @return peer The address of the peer associated with the specified endpoint. */ function _getPeerOrRevert( uint32 _eid ) internal view virtual returns (bytes32) { bytes32 peer = peers[_eid]; if (peer == bytes32(0)) revert NoPeer(_eid); return peer; } /** * @notice Sets the delegate address for the OApp. * @param _delegate The address of the delegate to be set. * * @dev Only the owner/admin of the OApp can call this function. * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract. */ function setDelegate(address _delegate) public onlyOwner { endpoint.setDelegate(_delegate); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {IOAppReceiver, Origin} from "./interfaces/IOAppReceiver.sol"; import {OAppCore} from "./OAppCore.sol"; /** * @title OAppReceiver * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers. */ abstract contract OAppReceiver is IOAppReceiver, OAppCore { // Custom error message for when the caller is not the registered endpoint/ error OnlyEndpoint(address addr); // @dev The version of the OAppReceiver implementation. // @dev Version is bumped when changes are made to this contract. uint64 internal constant RECEIVER_VERSION = 1; /** * @notice Retrieves the OApp version information. * @return senderVersion The version of the OAppSender.sol contract. * @return receiverVersion The version of the OAppReceiver.sol contract. * * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented. * ie. this is a RECEIVE only OApp. * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions. */ function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) { return (0, RECEIVER_VERSION); } /** * @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint. * @return sender The address responsible for 'sending' composeMsg's to the Endpoint. * * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer. * @dev The default sender IS the OApp implementer. */ function composeMsgSender() public view virtual returns (address sender) { return address(this); } /** * @notice Checks if the path initialization is allowed based on the provided origin. * @param origin The origin information containing the source endpoint and sender address. * @return Whether the path has been initialized. * * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received. * @dev This defaults to assuming if a peer has been set, its initialized. * Can be overridden by the OApp if there is other logic to determine this. */ function allowInitializePath( Origin calldata origin ) public view virtual returns (bool) { return peers[origin.srcEid] == origin.sender; } /** * @notice Retrieves the next nonce for a given source endpoint and sender address. * @dev _srcEid The source endpoint ID. * @dev _sender The sender address. * @return nonce The next nonce. * * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement. * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered. * @dev This is also enforced by the OApp. * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0. */ function nextNonce( uint32 /*_srcEid*/, bytes32 /*_sender*/ ) public view virtual returns (uint64 nonce) { return 0; } /** * @dev Entry point for receiving messages or packets from the endpoint. * @param _origin The origin information containing the source endpoint and sender address. * - srcEid: The source chain endpoint ID. * - sender: The sender address on the src chain. * - nonce: The nonce of the message. * @param _guid The unique identifier for the received LayerZero message. * @param _message The payload of the received message. * @param _executor The address of the executor for the received message. * @param _extraData Additional arbitrary data provided by the corresponding executor. * * @dev Entry point for receiving msg/packet from the LayerZero endpoint. */ function lzReceive( Origin calldata _origin, bytes32 _guid, bytes calldata _message, address _executor, bytes calldata _extraData ) public payable virtual { // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp. if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender); // Ensure that the sender matches the expected peer for the source endpoint. if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender); // Call the internal OApp implementation of lzReceive. _lzReceive(_origin, _guid, _message, _executor, _extraData); } /** * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation. */ function _lzReceive( Origin calldata _origin, bytes32 _guid, bytes calldata _message, address _executor, bytes calldata _extraData ) internal virtual; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {MessagingParams, MessagingFee, MessagingReceipt} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol"; import {OAppCore} from "./OAppCore.sol"; /** * @title OAppSender * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint. */ abstract contract OAppSender is OAppCore { using SafeERC20 for IERC20; // Custom error messages error NotEnoughNative(uint256 msgValue); error LzTokenUnavailable(); // @dev The version of the OAppSender implementation. // @dev Version is bumped when changes are made to this contract. uint64 internal constant SENDER_VERSION = 1; /** * @notice Retrieves the OApp version information. * @return senderVersion The version of the OAppSender.sol contract. * @return receiverVersion The version of the OAppReceiver.sol contract. * * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented. * ie. this is a SEND only OApp. * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions */ function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) { return (SENDER_VERSION, 0); } /** * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation. * @param _dstEid The destination endpoint ID. * @param _message The message payload. * @param _options Additional options for the message. * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens. * @return fee The calculated MessagingFee for the message. * - nativeFee: The native fee for the message. * - lzTokenFee: The LZ token fee for the message. */ function _quote( uint32 _dstEid, bytes memory _message, bytes memory _options, bool _payInLzToken ) internal view virtual returns (MessagingFee memory fee) { return endpoint.quote( MessagingParams( _dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken ), address(this) ); } /** * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message. * @param _dstEid The destination endpoint ID. * @param _message The message payload. * @param _options Additional options for the message. * @param _fee The calculated LayerZero fee for the message. * - nativeFee: The native fee. * - lzTokenFee: The lzToken fee. * @param _refundAddress The address to receive any excess fee values sent to the endpoint. * @return receipt The receipt for the sent message. * - guid: The unique identifier for the sent message. * - nonce: The nonce of the sent message. * - fee: The LayerZero fee incurred for the message. */ function _lzSend( uint32 _dstEid, bytes memory _message, bytes memory _options, MessagingFee memory _fee, address _refundAddress ) internal virtual returns (MessagingReceipt memory receipt) { // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint. uint256 messageValue = _payNative(_fee.nativeFee); if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee); return // solhint-disable-next-line check-send-result endpoint.send{value: messageValue}( MessagingParams( _dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0 ), _refundAddress ); } /** * @dev Internal function to pay the native fee associated with the message. * @param _nativeFee The native fee to be paid. * @return nativeFee The amount of native currency paid. * * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction, * this will need to be overridden because msg.value would contain multiple lzFees. * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency. * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees. * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time. */ function _payNative( uint256 _nativeFee ) internal virtual returns (uint256 nativeFee) { if (msg.value != _nativeFee) revert NotEnoughNative(msg.value); return _nativeFee; } /** * @dev Internal function to pay the LZ token fee associated with the message. * @param _lzTokenFee The LZ token fee to be paid. * * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint. * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend(). */ function _payLzToken(uint256 _lzTokenFee) internal virtual { // @dev Cannot cache the token because it is not immutable in the endpoint. address lzToken = endpoint.lzToken(); if (lzToken == address(0)) revert LzTokenUnavailable(); // Pay LZ token fee by sending tokens to the endpoint. IERC20(lzToken).safeTransferFrom( msg.sender, address(endpoint), _lzTokenFee ); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"NoPeer","type":"error"},{"inputs":[{"internalType":"uint256","name":"msgValue","type":"uint256"}],"name":"NotEnoughNative","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"OnlyEndpoint","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"}],"name":"OnlyPeer","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint8","name":"lemonType","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"agility","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"speed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luck","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"dna","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"level","type":"uint256"}],"name":"Create","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint8","name":"lemonType","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"agility","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"speed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luck","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"dna","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"level","type":"uint256"}],"name":"CrosschainTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"lemonId","type":"uint256"},{"components":[{"internalType":"uint8","name":"level","type":"uint8"},{"internalType":"uint8","name":"lemonType","type":"uint8"},{"internalType":"bytes","name":"dna","type":"bytes"},{"internalType":"uint256","name":"agility","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"},{"internalType":"uint256","name":"luck","type":"uint256"}],"indexed":false,"internalType":"struct IBattlemon.Metadata","name":"lemonData","type":"tuple"},{"indexed":false,"internalType":"int256[]","name":"itemsIds","type":"int256[]"},{"components":[{"internalType":"bool","name":"isEquipped","type":"bool"},{"internalType":"uint8","name":"itemType","type":"uint8"},{"internalType":"uint8","name":"level","type":"uint8"},{"internalType":"uint256","name":"agility","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"},{"internalType":"uint256","name":"luck","type":"uint256"},{"internalType":"address","name":"actualOwner","type":"address"},{"internalType":"bytes","name":"dna","type":"bytes"}],"indexed":false,"internalType":"struct IBattlemonItems.Metadata[10]","name":"itemsMetadata","type":"tuple[10]"}],"name":"EquipmentChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lemonType","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"level","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"agility","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"speed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"luck","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"dna","type":"bytes"}],"name":"Lvlup","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"_nextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"bytes[]","name":"dna","type":"bytes[]"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"alphaPrefix","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boxAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"boxMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"newPrefix","type":"uint8"}],"name":"changeAlphaPrefix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lemonId","type":"uint256"},{"internalType":"int256[]","name":"items","type":"int256[]"}],"name":"changeEquipmentBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"newPrefix","type":"uint8"}],"name":"changeOmegaPrefix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"composeMsgSender","outputs":[{"internalType":"address","name":"sender","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"equipment","outputs":[{"internalType":"uint256","name":"itemId","type":"uint256"},{"internalType":"bool","name":"equipped","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gemsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getAllEquipment","outputs":[{"internalType":"int256[10]","name":"","type":"int256[10]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"itemType","type":"uint256"}],"name":"getEquipment","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tresuary_","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"uint256","name":"startTokenId","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"itemsContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"lemonData","outputs":[{"components":[{"internalType":"uint8","name":"level","type":"uint8"},{"internalType":"uint8","name":"lemonType","type":"uint8"},{"internalType":"bytes","name":"dna","type":"bytes"},{"internalType":"uint256","name":"agility","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"},{"internalType":"uint256","name":"luck","type":"uint256"}],"internalType":"struct IBattlemon.Metadata","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"levelOf","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"lemonId","type":"uint256"},{"internalType":"uint256","name":"gemId","type":"uint256"}],"name":"levelUp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_options","type":"bytes"}],"name":"lzSend","outputs":[{"components":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"internalType":"struct MessagingReceipt","name":"","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nextNonce","outputs":[{"internalType":"uint64","name":"nonce","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"omegaPrefix","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"peer","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_dstEid","type":"uint32"},{"internalType":"string","name":"_message","type":"string"},{"internalType":"bytes","name":"_options","type":"bytes"},{"internalType":"bool","name":"_payInLzToken","type":"bool"}],"name":"quote","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"raids","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"lemonId","type":"uint256"},{"internalType":"address","name":"caller","type":"address"}],"name":"sendLemonToRaid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_items","type":"address"},{"internalType":"address","name":"_gems","type":"address"},{"internalType":"address","name":"_box","type":"address"},{"internalType":"address","name":"_raids","type":"address"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"setPeer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"itemType","type":"uint256"}],"name":"slotEquipped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"x","type":"uint8"}],"name":"toBytes","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAlphaSupply","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalOmegaSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tresuary","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6154f580620000f36000396000f3fe60806040526004361061036b5760003560e01c806363c0c1b0116101c6578063a971e842116100f7578063e78bcda611610095578063ecd6bfd01161006f578063ecd6bfd014610a96578063f2fde38b14610ab6578063f77e5dd314610ad6578063ff7bd03d14610b0357600080fd5b8063e78bcda614610a13578063e985e9c514610a2d578063ebc4f45a14610a7657600080fd5b8063b92d0eff116100d1578063b92d0eff14610993578063bb0b6a53146109a6578063c87b56dd146109d3578063ca5eb5e1146109f357600080fd5b8063a971e84214610933578063b18b379614610953578063b88d4fde1461097357600080fd5b80637d25a05e116101645780638da5cb5b1161013e5780638da5cb5b146108ca57806395d89b41146108e85780639965c5f2146108fd578063a22cb4651461091357600080fd5b80637d25a05e1461084f5780638ab338fc1461088a5780638cfc2ef3146108aa57600080fd5b80636d5e3032116101a05780636d5e3032146107b857806370a08231146107fa578063715018a61461081a578063791e52461461082f57600080fd5b806363c0c1b01461072b57806365b2b13c146107605780636d342a3a1461078057600080fd5b80633084d118116102a05780634a945f8d1161023e57806355f804b31161021857806355f804b31461069e5780635e280f11146106be578063605414c5146106de5780636352211e1461070b57600080fd5b80634a945f8d1461063157806351c8158c146106515780635226dc931461067e57600080fd5b8063400f3f381161027a578063400f3f38146105bb57806342842e0e146105db57806346e38355146105fb5780634a60f6201461061b57600080fd5b80633084d118146105665780633400288b146105865780633ccfd60b146105a657600080fd5b806313137d651161030d5780631f4595eb116102e75780631f4595eb146104e6578063200362051461050657806323b872dd146105265780632478440c1461054657600080fd5b806313137d651461048f57806317442b70146104a257806318160ddd146104c357600080fd5b8063081812fc11610349578063081812fc146103e9578063095ea7b3146104215780630ee792d2146104415780631202a09b1461046f57600080fd5b806301ffc9a714610370578063021a4405146103a557806306fdde03146103c7575b600080fd5b34801561037c57600080fd5b5061039061038b36600461405b565b610b23565b60405190151581526020015b60405180910390f35b3480156103b157600080fd5b506103c56103c03660046140dc565b610b75565b005b3480156103d357600080fd5b506103dc610d51565b60405161039c919061419b565b3480156103f557600080fd5b506104096104043660046141ae565b610de3565b6040516001600160a01b03909116815260200161039c565b34801561042d57600080fd5b506103c561043c3660046141c7565b610e0a565b34801561044d57600080fd5b5060d35461045c9061ffff1681565b60405161ffff909116815260200161039c565b34801561047b57600080fd5b506103c561048a366004614202565b610f1f565b6103c561049d366004614237565b610f47565b3480156104ae57600080fd5b5060408051600180825260208201520161039c565b3480156104cf57600080fd5b506104d8610fe4565b60405190815260200161039c565b3480156104f257600080fd5b506103c56105013660046142d6565b610fff565b34801561051257600080fd5b50610390610521366004614306565b6110c5565b34801561053257600080fd5b506103c5610541366004614328565b6110f7565b34801561055257600080fd5b5060ce54610409906001600160a01b031681565b34801561057257600080fd5b506103c56105813660046143ad565b611128565b34801561059257600080fd5b506103c56105a1366004614431565b61136d565b3480156105b257600080fd5b506103c56113ca565b3480156105c757600080fd5b5060cf54610409906001600160a01b031681565b3480156105e757600080fd5b506103c56105f6366004614328565b611478565b61060e61060936600461444d565b611493565b60405161039c919061449a565b34801561062757600080fd5b506104d860cc5481565b34801561063d57600080fd5b506103c561064c3660046144d5565b6116d0565b34801561065d57600080fd5b5061067161066c3660046141ae565b6117b3565b60405161039c9190614531565b34801561068a57600080fd5b506103c5610699366004614306565b6118e1565b3480156106aa57600080fd5b506103c56106b936600461467d565b611c5b565b3480156106ca57600080fd5b5060c954610409906001600160a01b031681565b3480156106ea57600080fd5b506106fe6106f93660046141ae565b611c6f565b60405161039c91906146b1565b34801561071757600080fd5b506104096107263660046141ae565b611d31565b34801561073757600080fd5b5061074b610746366004614306565b611d91565b6040805192835290151560208301520161039c565b34801561076c57600080fd5b506103c561077b3660046146e3565b611dc4565b34801561078c57600080fd5b5060d55461079f90610100900460f81b81565b6040516001600160f81b0319909116815260200161039c565b3480156107c457600080fd5b506107e86107d33660046141ae565b600090815260d7602052604090205460ff1690565b60405160ff909116815260200161039c565b34801561080657600080fd5b506104d86108153660046146e3565b611e39565b34801561082657600080fd5b506103c5611ebf565b34801561083b57600080fd5b506103c561084a366004614700565b611ed3565b34801561085b57600080fd5b5061087261086a366004614431565b600092915050565b6040516001600160401b03909116815260200161039c565b34801561089657600080fd5b5060d054610409906001600160a01b031681565b3480156108b657600080fd5b5060d154610409906001600160a01b031681565b3480156108d657600080fd5b506097546001600160a01b0316610409565b3480156108f457600080fd5b506103dc61268a565b34801561090957600080fd5b506104d860d45481565b34801561091f57600080fd5b506103c561092e366004614759565b612699565b34801561093f57600080fd5b5060cd54610409906001600160a01b031681565b34801561095f57600080fd5b506104d861096e366004614306565b6126a4565b34801561097f57600080fd5b506103c561098e366004614787565b612706565b34801561099f57600080fd5b5030610409565b3480156109b257600080fd5b506104d86109c13660046147f2565b60ca6020526000908152604090205481565b3480156109df57600080fd5b506103dc6109ee3660046141ae565b61273e565b3480156109ff57600080fd5b506103c5610a0e3660046146e3565b612781565b348015610a1f57600080fd5b5060d55461079f9060f81b81565b348015610a3957600080fd5b50610390610a4836600461480d565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b348015610a8257600080fd5b506103c5610a91366004614202565b6127eb565b348015610aa257600080fd5b5061079f610ab1366004614202565b612819565b348015610ac257600080fd5b506103c5610ad13660046146e3565b61284e565b348015610ae257600080fd5b50610af6610af136600461483b565b6128c4565b60405161039c91906148b6565b348015610b0f57600080fd5b50610390610b1e3660046148cd565b612912565b60006001600160e01b031982166380ac58cd60e01b1480610b5457506001600160e01b03198216635b5e139f60e01b145b80610b6f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600054610100900460ff1615808015610b955750600054600160ff909116105b80610baf5750303b158015610baf575060005460ff166001145b610c175760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610c3a576000805461ff0019166101001790555b610c7f604051806040016040528060098152602001682130ba3a3632b6b7b760b91b81525060405180604001604052806002815260200161109360f21b815250612948565b610c898333612979565b610c916129aa565b610c9b60a1612819565b60d5805460ff191660f89290921c919091179055610cb960b1612819565b60d5805461ff00191661010060f89390931c9290920291909117905560d180546001600160a01b0319166001600160a01b03881617905560d2610cfd858783614963565b5060cc8290558015610d49576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b606060658054610d60906148e9565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8c906148e9565b8015610dd95780601f10610dae57610100808354040283529160200191610dd9565b820191906000526020600020905b815481529060010190602001808311610dbc57829003601f168201915b5050505050905090565b6000610dee826129d9565b506000908152606960205260409020546001600160a01b031690565b6000610e1582611d31565b9050806001600160a01b0316836001600160a01b031603610e825760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c0e565b336001600160a01b0382161480610e9e5750610e9e8133610a48565b610f105760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610c0e565b610f1a8383612a38565b505050565b610f27612aa6565b610f3081612819565b60d5805460ff191660f89290921c91909117905550565b60c9546001600160a01b03163314610f74576040516391ac5e4f60e01b8152336004820152602401610c0e565b60208701803590610f8e90610f89908a6147f2565b612b00565b14610fcc57610fa060208801886147f2565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610c0e565b610fdb87878787878787612b3c565b50505050505050565b60d45460d354600091610ffa9161ffff16614a38565b905090565b60d0546001600160a01b031633146110595760405162461bcd60e51b815260206004820152601960248201527f4c656d6f6e733a204e6f742072616964732061646472657373000000000000006044820152606401610c0e565b806001600160a01b031661106c83611d31565b6001600160a01b0316146110b65760405162461bcd60e51b81526020600482015260116024820152702632b6b7b7399d102737ba1037bbb732b960791b6044820152606401610c0e565b6110c1813384612c5e565b5050565b600082815260d66020526040812082600a81106110e4576110e4614a4b565b600202016001015460ff16905092915050565b6111013382612dca565b61111d5760405162461bcd60e51b8152600401610c0e90614a61565b610f1a838383612c5e565b611130612aa6565b82811461117f5760405162461bcd60e51b815260206004820152601960248201527f41697264726f703a20446966666572656e74206c656e677468000000000000006044820152606401610c0e565b600160005b84811015610d495760cc80546000918261119d83614aae565b9190505590506111d38787848181106111b8576111b8614a4b565b90506020020160208101906111cd91906146e3565b82612e48565b6040805160c08101825260ff85168152600160208201529081018686858181106111ff576111ff614a4b565b90506020028101906112119190614ac7565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505060036020808501829052604080860183905260609095019190915285835260d7815291839020845181549386015160ff9081166101000261ffff19909516911617929092178255509082015160018201906112a19082614b0d565b50606082015160028201556080820151600382015560a0909101516004909101556001818888858181106112d7576112d7614a4b565b90506020020160208101906112ec91906146e3565b6001600160a01b03167fb3ba62f8a19bd87521cc6f6072d6bf482458ff6c0717f3fad74c118758b9637360038060038b8b8a81811061132d5761132d614a4b565b905060200281019061133f9190614ac7565b8b60405161135296959493929190614bcc565b60405180910390a4508061136581614aae565b915050611184565b611375612aa6565b63ffffffff8216600081815260ca6020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b6113d2612aa6565b60d1546040516000916001600160a01b03169047908381818185875af1925050503d806000811461141f576040519150601f19603f3d011682016040523d82523d6000602084013e611424565b606091505b50509050806114755760405162461bcd60e51b815260206004820152601b60248201527f4c656d6f6e733a2057697468647261772077656e742077726f6e6700000000006044820152606401610c0e565b50565b610f1a83838360405180602001604052806000815250612706565b61149b613f60565b60005b600a81101561152d576114b185826110c5565b1561151b5760405162461bcd60e51b815260206004820152603460248201527f4c656d6f6e733a2043616e277420657865637574652063726f7373636861696e6044820152732077697468206571756970706564206974656d7360601b6064820152608401610c0e565b8061152581614aae565b91505061149e565b5061153784612e62565b61153f613f60565b600085815260d760209081526040808320815160c081018352815460ff808216835261010090910416938101939093526001810180549192840191611583906148e9565b80601f01602080910402602001604051908101604052809291908181526020018280546115af906148e9565b80156115fc5780601f106115d1576101008083540402835291602001916115fc565b820191906000526020600020905b8154815290600101906020018083116115df57829003601f168201915b505050505081526020016002820154815260200160038201548152602001600482015481525050905060003387836000015184602001518560400151866060015187608001518860a0015160405160200161165e989796959493929190614c1d565b60408051601f198184030181526020601f890181900481028401810190925287835292506116c2918a918491908a908a908190840183828082843760009201829052506040805180820190915234815260208101919091529250339150612f019050565b93505050505b949350505050565b6116d8612aa6565b6001600160a01b038416158015906116f857506001600160a01b03831615155b801561170c57506001600160a01b03821615155b801561172057506001600160a01b03811615155b6117635760405162461bcd60e51b81526020600482015260146024820152734c656d6f6e733a205a65726f206164647265737360601b6044820152606401610c0e565b60cd80546001600160a01b039586166001600160a01b03199182161790915560cf80549486169482169490941790935560ce80549285169284169290921790915560d08054919093169116179055565b6117f26040518060c00160405280600060ff168152602001600060ff168152602001606081526020016000815260200160008152602001600081525090565b600082815260d76020908152604091829020825160c081018452815460ff80821683526101009091041692810192909252600181018054929391929184019161183a906148e9565b80601f0160208091040260200160405190810160405280929190818152602001828054611866906148e9565b80156118b35780601f10611888576101008083540402835291602001916118b3565b820191906000526020600020905b81548152906001019060200180831161189657829003601f168201915b5050505050815260200160028201548152602001600382015481526020016004820154815250509050919050565b600082815260d7602052604090205460ff610100909104166001146119535760405162461bcd60e51b815260206004820152602260248201527f4c656d6f6e733a6c6576656c55703a204d757374206265206f6e6c7920416c70604482015261686160f01b6064820152608401610c0e565b3361195d83611d31565b6001600160a01b0316146119b35760405162461bcd60e51b815260206004820152601f60248201527f4c656d6f6e733a6c6576656c55703a204e6f74206c656d6f6e206f776e6572006044820152606401610c0e565b60cf54604051639f05503160e01b8152600481018390523360248201526001600160a01b03909116908190639f05503190604401602060405180830381865afa158015611a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a289190614c86565b611a745760405162461bcd60e51b815260206004820152601d60248201527f4c656d6f6e733a6c6576656c55703a204e6f742067656d206f776e65720000006044820152606401610c0e565b600083815260d7602052604090205460ff16611a91816001614a38565b6040516336af181960e11b8152600481018590526001600160a01b03841690636d5e303290602401602060405180830381865afa158015611ad6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afa9190614cae565b60ff1614611b4a5760405162461bcd60e51b815260206004820152601f60248201527f4c656d6f6e733a6c6576656c55703a2057726f6e672067656d206c6576656c006044820152606401610c0e565b604051630852cd8d60e31b8152600481018490526001600160a01b038316906342966c6890602401600060405180830381600087803b158015611b8c57600080fd5b505af1158015611ba0573d6000803e3d6000fd5b505050600085815260d760205260408120805460019350909190611bc890849060ff16614ccb565b92506101000a81548160ff021916908360ff160217905550611bea3385612ff4565b600084815260d76020526040908190208054600282015460038301546004840154945160ff9093169489947f939776249d5256ef06c7746cb934aaf71e5bc90f60a5d77f94b62f703ec6bbfe94611c4d9460019490939092909190850190614d61565b60405180910390a350505050565b611c63612aa6565b60d26110c18282614b0d565b611c77613fa7565b611c7f613fa7565b60005b600a811015611d2a57600084815260d66020526040902081600a8110611caa57611caa614a4b565b6002020160019081015460ff1615159003611cff57600084815260d66020526040902081600a8110611cde57611cde614a4b565b60020201548282600a8110611cf557611cf5614a4b565b6020020152611d1a565b6000198282600a8110611d1457611d14614a4b565b60200201525b611d2381614aae565b9050611c82565b5092915050565b6000818152606760205260408120546001600160a01b031680610b6f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c0e565b60d660205281600052604060002081600a8110611dad57600080fd5b60020201805460019091015490925060ff16905082565b60ce546001600160a01b03163314611e285760405162461bcd60e51b815260206004820152602160248201527f4c656d6f6e733a2043616c6c6572206e6f742074686520626f784164647265736044820152607360f81b6064820152608401610c0e565b60d55461147590829060f81b6131f1565b60006001600160a01b038216611ea35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610c0e565b506001600160a01b031660009081526068602052604090205490565b611ec7612aa6565b611ed160006133ad565b565b600a8114611f235760405162461bcd60e51b815260206004820152601e60248201527f4c656d6f6e733a2057726f6e672065717569706d656e7420616d6f756e7400006044820152606401610c0e565b33611f2d84611d31565b6001600160a01b031614611f835760405162461bcd60e51b815260206004820152601760248201527f4c656d6f6e733a204e6f7420746f6b656e206f776e65720000000000000000006044820152606401610c0e565b611f8b613fc6565b60005b600a811015612642576000848483818110611fab57611fab614a4b565b905060200201359050600019811215611ff95760405162461bcd60e51b815260206004820152601060248201526f13195b5bdb9cce881ddc9bdb99c81a5960821b6044820152606401610c0e565b6000198113156123e95760cd546040516345e34bb760e11b8152600481018390526000916001600160a01b031690638bc6976e90602401600060405180830381865afa15801561204d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120759190810190614ddc565b905082816020015160ff16146120cd5760405162461bcd60e51b815260206004820181905260248201527f4c656d6f6e733a2057726f6e67206974656d207479706520666f7220736c6f746044820152606401610c0e565b600087815260d66020526040902083600a81106120ec576120ec614a4b565b6002020160019081015460ff161515900361221557600087815260d66020526040812084600a811061212057612120614a4b565b60020201600001549050816060015160d760008a815260200190815260200160002060020160008282546121549190614eab565b90915550506080820151600089815260d760205260408120600301805490919061217f908490614eab565b909155505060a0820151600089815260d76020526040812060040180549091906121aa908490614eab565b909155505060cd54604051632476f77f60e21b8152600481018390523360248201526001600160a01b03909116906391dbddfc90604401600060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b50505050505b6060810151600088815260d760205260408120600201805490919061223b908490614a38565b90915550506080810151600088815260d7602052604081206003018054909190612266908490614a38565b909155505060a0810151600088815260d7602052604081206004018054909190612291908490614a38565b909155505060cd5460405163e31e47d360e01b8152600481018490523360248201526001600160a01b039091169063e31e47d390604401600060405180830381600087803b1580156122e257600080fd5b505af11580156122f6573d6000803e3d6000fd5b505060cd546040516345e34bb760e11b8152600481018690526001600160a01b039091169250638bc6976e9150602401600060405180830381865afa158015612343573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261236b9190810190614ddc565b8484600a811061237d5761237d614a4b565b6020020181905250600160d6600089815260200190815260200160002084600a81106123ab576123ab614a4b565b60020201600101805460ff1916911515919091179055600087815260d660205260409020829084600a81106123e2576123e2614a4b565b6002020155505b801961262f57600086815260d66020526040902082600a811061240e5761240e614a4b565b600202016001015460ff161561262f5760cd54600087815260d66020526040812090916001600160a01b031690638bc6976e9085600a811061245257612452614a4b565b600202015460405160e083901b6001600160e01b03191681526004810191909152602401600060405180830381865afa158015612493573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124bb9190810190614ddc565b600088815260d6602052604081209192509084600a81106124de576124de614a4b565b60020201600001549050816060015160d760008a815260200190815260200160002060020160008282546125129190614eab565b90915550506080820151600089815260d760205260408120600301805490919061253d908490614eab565b909155505060a0820151600089815260d7602052604081206004018054909190612568908490614eab565b909155505060cd54604051632476f77f60e21b8152600481018390523360248201526001600160a01b03909116906391dbddfc90604401600060405180830381600087803b1580156125b957600080fd5b505af11580156125cd573d6000803e3d6000fd5b505050600089815260d66020526040812090915085600a81106125f2576125f2614a4b565b60020201600101805460ff1916911515919091179055600088815260d66020526040812085600a811061262757612627614a4b565b600202015550505b508061263a81614aae565b915050611f8e565b50600084815260d76020526040908190209051859133917f9fbf8dbd9aa03d5086775215db2c613ddebb5adcf5454577f054047e2287501791611c4d91889088908890614fa6565b606060668054610d60906148e9565b6110c13383836133ff565b600082815260d66020526040812082600a81106126c3576126c3614a4b565b600202016001015460ff166126db5750600019610b6f565b600083815260d66020526040902082600a81106126fa576126fa614a4b565b60020201549392505050565b6127103383612dca565b61272c5760405162461bcd60e51b8152600401610c0e90614a61565b612738848484846134cd565b50505050565b6060612749826129d9565b612751613500565b61275a8361350f565b60405160200161276b929190615022565b6040516020818303038152906040529050919050565b612789612aa6565b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b1580156127d057600080fd5b505af11580156127e4573d6000803e3d6000fd5b5050505050565b6127f3612aa6565b6127fc81612819565b60d560016101000a81548160ff021916908360f81c021790555050565b6040516001600160f81b031960f883901b166020820152600090602101604051602081830303815290604052610b6f90615051565b612856612aa6565b6001600160a01b0381166128bb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c0e565b611475816133ad565b60408051808201909152600080825260208201526000846040516020016128eb919061419b565b6040516020818303038152906040529050612908868286866135a1565b9695505050505050565b60006020820180359060ca90839061292a90866147f2565b63ffffffff1681526020810191909152604001600020541492915050565b600054610100900460ff1661296f5760405162461bcd60e51b8152600401610c0e90615088565b6110c18282613669565b600054610100900460ff166129a05760405162461bcd60e51b8152600401610c0e90615088565b6110c182826136a9565b600054610100900460ff166129d15760405162461bcd60e51b8152600401610c0e90615088565b611ed1613743565b6000818152606760205260409020546001600160a01b03166114755760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c0e565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612a6d82611d31565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6097546001600160a01b03163314611ed15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c0e565b63ffffffff8116600090815260ca602052604081205480610b6f5760405163f6ff4fb760e01b815263ffffffff84166004820152602401610c0e565b600080808080808080612b518c8e018e6150d3565b97509750975097509750975097509750612b6b8888613773565b6040805160c08101825260ff80891682528781166020808401918252838501898152606085018990526080850188905260a0850187905260008d815260d790925294902083518154925184166101000261ffff1990931693169290921717815591519091906001820190612bdf9082614b0d565b50606082015181600201556080820151816003015560a08201518160040155905050600187896001600160a01b03167f99e69e7240bbfda84bc642d0ff8ce988fe795cf5923847038d8730da52b02f3c8686868a8d604051612c4595949392919061516c565b60405180910390a4505050505050505050505050505050565b826001600160a01b0316612c7182611d31565b6001600160a01b031614612c975760405162461bcd60e51b8152600401610c0e906151a6565b6001600160a01b038216612cf95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c0e565b826001600160a01b0316612d0c82611d31565b6001600160a01b031614612d325760405162461bcd60e51b8152600401610c0e906151a6565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260688552838620805460001901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f1a8383836001613904565b600080612dd683611d31565b9050806001600160a01b0316846001600160a01b03161480612e1d57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806116c85750836001600160a01b0316612e3684610de3565b6001600160a01b031614949350505050565b6110c18282604051806020016040528060008152506139e4565b6000612e6d82611d31565b9050612e7882611d31565b600083815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080546000190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a46110c1816000846001613904565b612f09613f60565b6000612f188460000151613a17565b602085015190915015612f3257612f328460200151613a3f565b60c9546040805160a0810190915263ffffffff891681526001600160a01b0390911690632637a45090839060208101612f6a8c612b00565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401612fa69291906151eb565b60806040518083038185885af1158015612fc4573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612fe991906152b2565b979650505050505050565b60cc80546000918261300583614aae565b9190505590506130158382612e48565b600082815260d760205260408120600190810180549192839283929061303a906148e9565b80601f0160208091040260200160405190810160405280929190818152602001828054613066906148e9565b80156130b35780601f10613088576101008083540402835291602001916130b3565b820191906000526020600020905b81548152906001019060200180831161309657829003601f168201915b5050505050905060d560019054906101000a900460f81b816000815181106130dd576130dd614a4b565b60200101906001600160f81b031916908160001a9053506040805160c081018252600180825260006020808401828152848601878152606086018b9052608086018a905260a086018990528b845260d79092529490912083518154955160ff9081166101000261ffff1990971691161794909417845551919291908201906131659082614b0d565b50606082015160028201556080820151600382015560a09091015160049091015560d4805490600061319683614aae565b9190505550600085886001600160a01b03167fb3ba62f8a19bd87521cc6f6072d6bf482458ff6c0717f3fad74c118758b963738787878760016040516131e0959493929190615323565b60405180910390a450505050505050565b60cc8054600191600091908261320683614aae565b9190505590506132168482612e48565b600380806000613227612710613af2565b60405160200161323991815260200190565b60408051808303601f1901815282825280516020918201206001600160a01b031916908301528051600c818403018152602c830190915291506000906132859089908490604c0161535a565b60408051601f1981840301815260c08301825260ff808b16845260016020858101828152868601858152606088018d9052608088018c905260a088018b905260008e815260d79093529590912086518154925185166101000261ffff199093169416939093171782559251919450918201906133019082614b0d565b50606082015160028201556080820151600382015560a09091015160049091015560d380546001919060009061333c90849061ffff1661538b565b92506101000a81548161ffff021916908361ffff1602179055506001868a6001600160a01b03167fb3ba62f8a19bd87521cc6f6072d6bf482458ff6c0717f3fad74c118758b96373888888878e60405161339a95949392919061516c565b60405180910390a4505050505050505050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036134605760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c0e565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6134d8848484612c5e565b6134e484848484613b5f565b6127385760405162461bcd60e51b8152600401610c0e906153a6565b606060d28054610d60906148e9565b6060600061351c83613c5d565b60010190506000816001600160401b0381111561353b5761353b614591565b6040519080825280601f01601f191660200182016040528015613565576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461356f57509392505050565b604080518082019091526000808252602082015260c9546040805160a0810190915263ffffffff871681526001600160a01b039091169063ddc28c5890602081016135eb89612b00565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016136209291906151eb565b6040805180830381865afa15801561363c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061366091906153f8565b95945050505050565b600054610100900460ff166136905760405162461bcd60e51b8152600401610c0e90615088565b606561369c8382614b0d565b506066610f1a8282614b0d565b60c980546001600160a01b0319166001600160a01b038481169190911790915581166136e857604051632d618d8160e21b815260040160405180910390fd5b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b15801561372f57600080fd5b505af1158015610d49573d6000803e3d6000fd5b600054610100900460ff1661376a5760405162461bcd60e51b8152600401610c0e90615088565b611ed1336133ad565b6001600160a01b0382166137c95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c0e565b6000818152606760205260409020546001600160a01b03161561382e5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c0e565b6000818152606760205260409020546001600160a01b0316156138935760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c0e565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46110c16000838360015b6001600160a01b0384161561273857600061391e83611c6f565b905060005b600a811015610d495760008282600a811061394057613940614a4b565b6020020151126139d25760cd546001600160a01b03166328cdaa93868484600a811061396e5761396e614a4b565b60200201516040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156139b957600080fd5b505af11580156139cd573d6000803e3d6000fd5b505050505b806139dc81614aae565b915050613923565b6139ee8383613773565b6139fb6000848484613b5f565b610f1a5760405162461bcd60e51b8152600401610c0e906153a6565b6000813414613a3b576040516304fb820960e51b8152346004820152602401610c0e565b5090565b60c9546040805163393f876560e21b815290516000926001600160a01b03169163e4fe1d949160048083019260209291908290030181865afa158015613a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aad9190615414565b90506001600160a01b038116613ad6576040516329b99a9560e11b815260040160405180910390fd5b60c9546110c1906001600160a01b038381169133911685613d35565b60cb805460009182613b0383614aae565b909155505060cb54604080514260208201526bffffffffffffffffffffffff193360601b1691810191909152605481019190915282906074016040516020818303038152906040528051906020012060001c610b6f9190615431565b60006001600160a01b0384163b15613c5557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613ba3903390899088908890600401615453565b6020604051808303816000875af1925050508015613bde575060408051601f3d908101601f19168201909252613bdb91810190615486565b60015b613c3b573d808015613c0c576040519150601f19603f3d011682016040523d82523d6000602084013e613c11565b606091505b508051600003613c335760405162461bcd60e51b8152600401610c0e906153a6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506116c8565b5060016116c8565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310613c9c5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613cc8576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310613ce657662386f26fc10000830492506010015b6305f5e1008310613cfe576305f5e100830492506008015b6127108310613d1257612710830492506004015b60648310613d24576064830492506002015b600a8310610b6f5760010192915050565b604080516001600160a01b038581166024830152848116604483015260648083018590528351808403909101815260849092018352602080830180516001600160e01b03166323b872dd60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65649084015261273892879291600091613dcd918516908490613e4d565b9050805160001480613dee575080806020019051810190613dee9190614c86565b610f1a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c0e565b60606116c8848460008585600080866001600160a01b03168587604051613e7491906154a3565b60006040518083038185875af1925050503d8060008114613eb1576040519150601f19603f3d011682016040523d82523d6000602084013e613eb6565b606091505b5091509150612fe98783838760608315613f31578251600003613f2a576001600160a01b0385163b613f2a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c0e565b50816116c8565b6116c88383815115613f465781518083602001fd5b8060405162461bcd60e51b8152600401610c0e919061419b565b60405180606001604052806000801916815260200160006001600160401b03168152602001613fa2604051806040016040528060008152602001600081525090565b905290565b604051806101400160405280600a906020820280368337509192915050565b604051806101400160405280600a905b61402f604051806101000160405280600015158152602001600060ff168152602001600060ff16815260200160008152602001600081526020016000815260200160006001600160a01b03168152602001606081525090565b815260200190600190039081613fd65790505090565b6001600160e01b03198116811461147557600080fd5b60006020828403121561406d57600080fd5b813561407881614045565b9392505050565b6001600160a01b038116811461147557600080fd5b60008083601f8401126140a657600080fd5b5081356001600160401b038111156140bd57600080fd5b6020830191508360208285010111156140d557600080fd5b9250929050565b6000806000806000608086880312156140f457600080fd5b85356140ff8161407f565b945060208601356001600160401b0381111561411a57600080fd5b61412688828901614094565b909550935050604086013561413a8161407f565b949793965091946060013592915050565b60005b8381101561416657818101518382015260200161414e565b50506000910152565b6000815180845261418781602086016020860161414b565b601f01601f19169290920160200192915050565b602081526000614078602083018461416f565b6000602082840312156141c057600080fd5b5035919050565b600080604083850312156141da57600080fd5b82356141e58161407f565b946020939093013593505050565b60ff8116811461147557600080fd5b60006020828403121561421457600080fd5b8135614078816141f3565b60006060828403121561423157600080fd5b50919050565b600080600080600080600060e0888a03121561425257600080fd5b61425c898961421f565b96506060880135955060808801356001600160401b038082111561427f57600080fd5b61428b8b838c01614094565b909750955060a08a013591506142a08261407f565b90935060c089013590808211156142b657600080fd5b506142c38a828b01614094565b989b979a50959850939692959293505050565b600080604083850312156142e957600080fd5b8235915060208301356142fb8161407f565b809150509250929050565b6000806040838503121561431957600080fd5b50508035926020909101359150565b60008060006060848603121561433d57600080fd5b83356143488161407f565b925060208401356143588161407f565b929592945050506040919091013590565b60008083601f84011261437b57600080fd5b5081356001600160401b0381111561439257600080fd5b6020830191508360208260051b85010111156140d557600080fd5b600080600080604085870312156143c357600080fd5b84356001600160401b03808211156143da57600080fd5b6143e688838901614369565b909650945060208701359150808211156143ff57600080fd5b5061440c87828801614369565b95989497509550505050565b803563ffffffff8116811461442c57600080fd5b919050565b6000806040838503121561444457600080fd5b6141e583614418565b6000806000806060858703121561446357600080fd5b61446c85614418565b93506020850135925060408501356001600160401b0381111561448e57600080fd5b61440c87828801614094565b6000608082019050825182526001600160401b0360208401511660208301526040830151611d2a604084018280518252602090810151910152565b600080600080608085870312156144eb57600080fd5b84356144f68161407f565b935060208501356145068161407f565b925060408501356145168161407f565b915060608501356145268161407f565b939692955090935050565b6020815260ff825116602082015260ff60208301511660408201526000604083015160c0606084015261456760e084018261416f565b905060608401516080840152608084015160a084015260a084015160c08401528091505092915050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156145ca576145ca614591565b60405290565b604051601f8201601f191681016001600160401b03811182821017156145f8576145f8614591565b604052919050565b60006001600160401b0382111561461957614619614591565b50601f01601f191660200190565b600082601f83011261463857600080fd5b813561464b61464682614600565b6145d0565b81815284602083860101111561466057600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561468f57600080fd5b81356001600160401b038111156146a557600080fd5b6116c884828501614627565b6101408101818360005b600a8110156146da5781518352602092830192909101906001016146bb565b50505092915050565b6000602082840312156146f557600080fd5b81356140788161407f565b60008060006040848603121561471557600080fd5b8335925060208401356001600160401b0381111561473257600080fd5b61473e86828701614369565b9497909650939450505050565b801515811461147557600080fd5b6000806040838503121561476c57600080fd5b82356147778161407f565b915060208301356142fb8161474b565b6000806000806080858703121561479d57600080fd5b84356147a88161407f565b935060208501356147b88161407f565b92506040850135915060608501356001600160401b038111156147da57600080fd5b6147e687828801614627565b91505092959194509250565b60006020828403121561480457600080fd5b61407882614418565b6000806040838503121561482057600080fd5b823561482b8161407f565b915060208301356142fb8161407f565b6000806000806080858703121561485157600080fd5b61485a85614418565b935060208501356001600160401b038082111561487657600080fd5b61488288838901614627565b9450604087013591508082111561489857600080fd5b506148a587828801614627565b92505060608501356145268161474b565b815181526020808301519082015260408101610b6f565b6000606082840312156148df57600080fd5b614078838361421f565b600181811c908216806148fd57607f821691505b60208210810361423157634e487b7160e01b600052602260045260246000fd5b601f821115610f1a57600081815260208120601f850160051c810160208610156149445750805b601f850160051c820191505b81811015610d4957828155600101614950565b6001600160401b0383111561497a5761497a614591565b61498e8361498883546148e9565b8361491d565b6000601f8411600181146149c257600085156149aa5750838201355b600019600387901b1c1916600186901b1783556127e4565b600083815260209020601f19861690835b828110156149f357868501358255602094850194600190920191016149d3565b5086821015614a105760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b6f57610b6f614a22565b634e487b7160e01b600052603260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b600060018201614ac057614ac0614a22565b5060010190565b6000808335601e19843603018112614ade57600080fd5b8301803591506001600160401b03821115614af857600080fd5b6020019150368190038213156140d557600080fd5b81516001600160401b03811115614b2657614b26614591565b614b3a81614b3484546148e9565b8461491d565b602080601f831160018114614b6f5760008415614b575750858301515b600019600386901b1c1916600185901b178555610d49565b600085815260208120601f198616915b82811015614b9e57888601518255948401946001909101908401614b7f565b5085821015614bbc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b86815285602082015284604082015260a060608201528260a0820152828460c0830137600060c08483010152600060c0601f19601f860116830101905060ff83166080830152979650505050505050565b6001600160a01b03891681526020810188905260ff87811660408301528616606082015261010060808201819052600090614c5a8382018861416f565b60a0840196909652505060c081019290925260e09091015295945050505050565b805161442c8161474b565b600060208284031215614c9857600080fd5b81516140788161474b565b805161442c816141f3565b600060208284031215614cc057600080fd5b8151614078816141f3565b60ff8181168382160190811115610b6f57610b6f614a22565b60008154614cf1816148e9565b808552602060018381168015614d0e5760018114614d2857614d56565b60ff1985168884015283151560051b880183019550614d56565b866000528260002060005b85811015614d4e5781548a8201860152908301908401614d33565b890184019650505b505050505092915050565b85815284602082015283604082015282606082015260a060808201526000612fe960a0830184614ce4565b805161442c8161407f565b600082601f830112614da857600080fd5b8151614db661464682614600565b818152846020838601011115614dcb57600080fd5b6116c882602083016020870161414b565b600060208284031215614dee57600080fd5b81516001600160401b0380821115614e0557600080fd5b908301906101008286031215614e1a57600080fd5b614e226145a7565b614e2b83614c7b565b8152614e3960208401614ca3565b6020820152614e4a60408401614ca3565b6040820152606083015160608201526080830151608082015260a083015160a0820152614e7960c08401614d8c565b60c082015260e083015182811115614e9057600080fd5b614e9c87828601614d97565b60e08301525095945050505050565b81810381811115610b6f57610b6f614a22565b8183526000602080850194508260005b85811015614eea57813587529582019590820190600101614ece565b509495945050505050565b60008261014081018360005b600a811015614f9b5783830387528151610100815115158552602060ff818401511681870152604080840151614f3b8289018260ff169052565b5050606083810151908701526080808401519087015260a0808401519087015260c0808401516001600160a01b03169087015260e092830151928601829052614f868287018461416f565b99810199955093909301925050600101614f01565b509095945050505050565b606081526000855460ff8116606084015260ff8160081c1660808401525060c060a0830152614fdc610120830160018801614ce4565b600287015460c0840152600387015460e08401526004870154610100840152828103602084015261500e818688614ebe565b90508281036040840152612fe98185614ef5565b6000835161503481846020880161414b565b83519083019061504881836020880161414b565b01949350505050565b805160208201516001600160f81b031980821692919060018310156150805780818460010360031b1b83161693505b505050919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600080600080600080600080610100898b0312156150f057600080fd5b88356150fb8161407f565b9750602089013596506040890135615112816141f3565b95506060890135615122816141f3565b945060808901356001600160401b0381111561513d57600080fd5b6151498b828c01614627565b989b979a50959894979660a0860135965060c08601359560e00135945092505050565b85815284602082015283604082015260a06060820152600061519160a083018561416f565b905060ff831660808301529695505050505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a0608084015261522160e084018261416f565b90506060850151603f198483030160a085015261523e828261416f565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b60006040828403121561527657600080fd5b604051604081018181106001600160401b038211171561529857615298614591565b604052825181526020928301519281019290925250919050565b6000608082840312156152c457600080fd5b604051606081016001600160401b0382821081831117156152e7576152e7614591565b816040528451835260208501519150808216821461530457600080fd5b5060208201526153178460408501615264565b60408201529392505050565b85815284602082015283604082015260a06060820152600061534860a083018561416f565b90508260808301529695505050505050565b6001600160f81b031983168152815160009061537d81600185016020870161414b565b919091016001019392505050565b61ffff818116838216019080821115611d2a57611d2a614a22565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60006040828403121561540a57600080fd5b6140788383615264565b60006020828403121561542657600080fd5b81516140788161407f565b60008261544e57634e487b7160e01b600052601260045260246000fd5b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906129089083018461416f565b60006020828403121561549857600080fd5b815161407881614045565b600082516154b581846020870161414b565b919091019291505056fea2646970667358221220e3056f2d69968c7432a778a74a27baae225a2a5a92b8f6a99c4ba34725bed78f64736f6c63430008140033
Deployed Bytecode
0x60806040526004361061036b5760003560e01c806363c0c1b0116101c6578063a971e842116100f7578063e78bcda611610095578063ecd6bfd01161006f578063ecd6bfd014610a96578063f2fde38b14610ab6578063f77e5dd314610ad6578063ff7bd03d14610b0357600080fd5b8063e78bcda614610a13578063e985e9c514610a2d578063ebc4f45a14610a7657600080fd5b8063b92d0eff116100d1578063b92d0eff14610993578063bb0b6a53146109a6578063c87b56dd146109d3578063ca5eb5e1146109f357600080fd5b8063a971e84214610933578063b18b379614610953578063b88d4fde1461097357600080fd5b80637d25a05e116101645780638da5cb5b1161013e5780638da5cb5b146108ca57806395d89b41146108e85780639965c5f2146108fd578063a22cb4651461091357600080fd5b80637d25a05e1461084f5780638ab338fc1461088a5780638cfc2ef3146108aa57600080fd5b80636d5e3032116101a05780636d5e3032146107b857806370a08231146107fa578063715018a61461081a578063791e52461461082f57600080fd5b806363c0c1b01461072b57806365b2b13c146107605780636d342a3a1461078057600080fd5b80633084d118116102a05780634a945f8d1161023e57806355f804b31161021857806355f804b31461069e5780635e280f11146106be578063605414c5146106de5780636352211e1461070b57600080fd5b80634a945f8d1461063157806351c8158c146106515780635226dc931461067e57600080fd5b8063400f3f381161027a578063400f3f38146105bb57806342842e0e146105db57806346e38355146105fb5780634a60f6201461061b57600080fd5b80633084d118146105665780633400288b146105865780633ccfd60b146105a657600080fd5b806313137d651161030d5780631f4595eb116102e75780631f4595eb146104e6578063200362051461050657806323b872dd146105265780632478440c1461054657600080fd5b806313137d651461048f57806317442b70146104a257806318160ddd146104c357600080fd5b8063081812fc11610349578063081812fc146103e9578063095ea7b3146104215780630ee792d2146104415780631202a09b1461046f57600080fd5b806301ffc9a714610370578063021a4405146103a557806306fdde03146103c7575b600080fd5b34801561037c57600080fd5b5061039061038b36600461405b565b610b23565b60405190151581526020015b60405180910390f35b3480156103b157600080fd5b506103c56103c03660046140dc565b610b75565b005b3480156103d357600080fd5b506103dc610d51565b60405161039c919061419b565b3480156103f557600080fd5b506104096104043660046141ae565b610de3565b6040516001600160a01b03909116815260200161039c565b34801561042d57600080fd5b506103c561043c3660046141c7565b610e0a565b34801561044d57600080fd5b5060d35461045c9061ffff1681565b60405161ffff909116815260200161039c565b34801561047b57600080fd5b506103c561048a366004614202565b610f1f565b6103c561049d366004614237565b610f47565b3480156104ae57600080fd5b5060408051600180825260208201520161039c565b3480156104cf57600080fd5b506104d8610fe4565b60405190815260200161039c565b3480156104f257600080fd5b506103c56105013660046142d6565b610fff565b34801561051257600080fd5b50610390610521366004614306565b6110c5565b34801561053257600080fd5b506103c5610541366004614328565b6110f7565b34801561055257600080fd5b5060ce54610409906001600160a01b031681565b34801561057257600080fd5b506103c56105813660046143ad565b611128565b34801561059257600080fd5b506103c56105a1366004614431565b61136d565b3480156105b257600080fd5b506103c56113ca565b3480156105c757600080fd5b5060cf54610409906001600160a01b031681565b3480156105e757600080fd5b506103c56105f6366004614328565b611478565b61060e61060936600461444d565b611493565b60405161039c919061449a565b34801561062757600080fd5b506104d860cc5481565b34801561063d57600080fd5b506103c561064c3660046144d5565b6116d0565b34801561065d57600080fd5b5061067161066c3660046141ae565b6117b3565b60405161039c9190614531565b34801561068a57600080fd5b506103c5610699366004614306565b6118e1565b3480156106aa57600080fd5b506103c56106b936600461467d565b611c5b565b3480156106ca57600080fd5b5060c954610409906001600160a01b031681565b3480156106ea57600080fd5b506106fe6106f93660046141ae565b611c6f565b60405161039c91906146b1565b34801561071757600080fd5b506104096107263660046141ae565b611d31565b34801561073757600080fd5b5061074b610746366004614306565b611d91565b6040805192835290151560208301520161039c565b34801561076c57600080fd5b506103c561077b3660046146e3565b611dc4565b34801561078c57600080fd5b5060d55461079f90610100900460f81b81565b6040516001600160f81b0319909116815260200161039c565b3480156107c457600080fd5b506107e86107d33660046141ae565b600090815260d7602052604090205460ff1690565b60405160ff909116815260200161039c565b34801561080657600080fd5b506104d86108153660046146e3565b611e39565b34801561082657600080fd5b506103c5611ebf565b34801561083b57600080fd5b506103c561084a366004614700565b611ed3565b34801561085b57600080fd5b5061087261086a366004614431565b600092915050565b6040516001600160401b03909116815260200161039c565b34801561089657600080fd5b5060d054610409906001600160a01b031681565b3480156108b657600080fd5b5060d154610409906001600160a01b031681565b3480156108d657600080fd5b506097546001600160a01b0316610409565b3480156108f457600080fd5b506103dc61268a565b34801561090957600080fd5b506104d860d45481565b34801561091f57600080fd5b506103c561092e366004614759565b612699565b34801561093f57600080fd5b5060cd54610409906001600160a01b031681565b34801561095f57600080fd5b506104d861096e366004614306565b6126a4565b34801561097f57600080fd5b506103c561098e366004614787565b612706565b34801561099f57600080fd5b5030610409565b3480156109b257600080fd5b506104d86109c13660046147f2565b60ca6020526000908152604090205481565b3480156109df57600080fd5b506103dc6109ee3660046141ae565b61273e565b3480156109ff57600080fd5b506103c5610a0e3660046146e3565b612781565b348015610a1f57600080fd5b5060d55461079f9060f81b81565b348015610a3957600080fd5b50610390610a4836600461480d565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b348015610a8257600080fd5b506103c5610a91366004614202565b6127eb565b348015610aa257600080fd5b5061079f610ab1366004614202565b612819565b348015610ac257600080fd5b506103c5610ad13660046146e3565b61284e565b348015610ae257600080fd5b50610af6610af136600461483b565b6128c4565b60405161039c91906148b6565b348015610b0f57600080fd5b50610390610b1e3660046148cd565b612912565b60006001600160e01b031982166380ac58cd60e01b1480610b5457506001600160e01b03198216635b5e139f60e01b145b80610b6f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600054610100900460ff1615808015610b955750600054600160ff909116105b80610baf5750303b158015610baf575060005460ff166001145b610c175760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610c3a576000805461ff0019166101001790555b610c7f604051806040016040528060098152602001682130ba3a3632b6b7b760b91b81525060405180604001604052806002815260200161109360f21b815250612948565b610c898333612979565b610c916129aa565b610c9b60a1612819565b60d5805460ff191660f89290921c919091179055610cb960b1612819565b60d5805461ff00191661010060f89390931c9290920291909117905560d180546001600160a01b0319166001600160a01b03881617905560d2610cfd858783614963565b5060cc8290558015610d49576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b606060658054610d60906148e9565b80601f0160208091040260200160405190810160405280929190818152602001828054610d8c906148e9565b8015610dd95780601f10610dae57610100808354040283529160200191610dd9565b820191906000526020600020905b815481529060010190602001808311610dbc57829003601f168201915b5050505050905090565b6000610dee826129d9565b506000908152606960205260409020546001600160a01b031690565b6000610e1582611d31565b9050806001600160a01b0316836001600160a01b031603610e825760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c0e565b336001600160a01b0382161480610e9e5750610e9e8133610a48565b610f105760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610c0e565b610f1a8383612a38565b505050565b610f27612aa6565b610f3081612819565b60d5805460ff191660f89290921c91909117905550565b60c9546001600160a01b03163314610f74576040516391ac5e4f60e01b8152336004820152602401610c0e565b60208701803590610f8e90610f89908a6147f2565b612b00565b14610fcc57610fa060208801886147f2565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610c0e565b610fdb87878787878787612b3c565b50505050505050565b60d45460d354600091610ffa9161ffff16614a38565b905090565b60d0546001600160a01b031633146110595760405162461bcd60e51b815260206004820152601960248201527f4c656d6f6e733a204e6f742072616964732061646472657373000000000000006044820152606401610c0e565b806001600160a01b031661106c83611d31565b6001600160a01b0316146110b65760405162461bcd60e51b81526020600482015260116024820152702632b6b7b7399d102737ba1037bbb732b960791b6044820152606401610c0e565b6110c1813384612c5e565b5050565b600082815260d66020526040812082600a81106110e4576110e4614a4b565b600202016001015460ff16905092915050565b6111013382612dca565b61111d5760405162461bcd60e51b8152600401610c0e90614a61565b610f1a838383612c5e565b611130612aa6565b82811461117f5760405162461bcd60e51b815260206004820152601960248201527f41697264726f703a20446966666572656e74206c656e677468000000000000006044820152606401610c0e565b600160005b84811015610d495760cc80546000918261119d83614aae565b9190505590506111d38787848181106111b8576111b8614a4b565b90506020020160208101906111cd91906146e3565b82612e48565b6040805160c08101825260ff85168152600160208201529081018686858181106111ff576111ff614a4b565b90506020028101906112119190614ac7565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505060036020808501829052604080860183905260609095019190915285835260d7815291839020845181549386015160ff9081166101000261ffff19909516911617929092178255509082015160018201906112a19082614b0d565b50606082015160028201556080820151600382015560a0909101516004909101556001818888858181106112d7576112d7614a4b565b90506020020160208101906112ec91906146e3565b6001600160a01b03167fb3ba62f8a19bd87521cc6f6072d6bf482458ff6c0717f3fad74c118758b9637360038060038b8b8a81811061132d5761132d614a4b565b905060200281019061133f9190614ac7565b8b60405161135296959493929190614bcc565b60405180910390a4508061136581614aae565b915050611184565b611375612aa6565b63ffffffff8216600081815260ca6020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b6113d2612aa6565b60d1546040516000916001600160a01b03169047908381818185875af1925050503d806000811461141f576040519150601f19603f3d011682016040523d82523d6000602084013e611424565b606091505b50509050806114755760405162461bcd60e51b815260206004820152601b60248201527f4c656d6f6e733a2057697468647261772077656e742077726f6e6700000000006044820152606401610c0e565b50565b610f1a83838360405180602001604052806000815250612706565b61149b613f60565b60005b600a81101561152d576114b185826110c5565b1561151b5760405162461bcd60e51b815260206004820152603460248201527f4c656d6f6e733a2043616e277420657865637574652063726f7373636861696e6044820152732077697468206571756970706564206974656d7360601b6064820152608401610c0e565b8061152581614aae565b91505061149e565b5061153784612e62565b61153f613f60565b600085815260d760209081526040808320815160c081018352815460ff808216835261010090910416938101939093526001810180549192840191611583906148e9565b80601f01602080910402602001604051908101604052809291908181526020018280546115af906148e9565b80156115fc5780601f106115d1576101008083540402835291602001916115fc565b820191906000526020600020905b8154815290600101906020018083116115df57829003601f168201915b505050505081526020016002820154815260200160038201548152602001600482015481525050905060003387836000015184602001518560400151866060015187608001518860a0015160405160200161165e989796959493929190614c1d565b60408051601f198184030181526020601f890181900481028401810190925287835292506116c2918a918491908a908a908190840183828082843760009201829052506040805180820190915234815260208101919091529250339150612f019050565b93505050505b949350505050565b6116d8612aa6565b6001600160a01b038416158015906116f857506001600160a01b03831615155b801561170c57506001600160a01b03821615155b801561172057506001600160a01b03811615155b6117635760405162461bcd60e51b81526020600482015260146024820152734c656d6f6e733a205a65726f206164647265737360601b6044820152606401610c0e565b60cd80546001600160a01b039586166001600160a01b03199182161790915560cf80549486169482169490941790935560ce80549285169284169290921790915560d08054919093169116179055565b6117f26040518060c00160405280600060ff168152602001600060ff168152602001606081526020016000815260200160008152602001600081525090565b600082815260d76020908152604091829020825160c081018452815460ff80821683526101009091041692810192909252600181018054929391929184019161183a906148e9565b80601f0160208091040260200160405190810160405280929190818152602001828054611866906148e9565b80156118b35780601f10611888576101008083540402835291602001916118b3565b820191906000526020600020905b81548152906001019060200180831161189657829003601f168201915b5050505050815260200160028201548152602001600382015481526020016004820154815250509050919050565b600082815260d7602052604090205460ff610100909104166001146119535760405162461bcd60e51b815260206004820152602260248201527f4c656d6f6e733a6c6576656c55703a204d757374206265206f6e6c7920416c70604482015261686160f01b6064820152608401610c0e565b3361195d83611d31565b6001600160a01b0316146119b35760405162461bcd60e51b815260206004820152601f60248201527f4c656d6f6e733a6c6576656c55703a204e6f74206c656d6f6e206f776e6572006044820152606401610c0e565b60cf54604051639f05503160e01b8152600481018390523360248201526001600160a01b03909116908190639f05503190604401602060405180830381865afa158015611a04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a289190614c86565b611a745760405162461bcd60e51b815260206004820152601d60248201527f4c656d6f6e733a6c6576656c55703a204e6f742067656d206f776e65720000006044820152606401610c0e565b600083815260d7602052604090205460ff16611a91816001614a38565b6040516336af181960e11b8152600481018590526001600160a01b03841690636d5e303290602401602060405180830381865afa158015611ad6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afa9190614cae565b60ff1614611b4a5760405162461bcd60e51b815260206004820152601f60248201527f4c656d6f6e733a6c6576656c55703a2057726f6e672067656d206c6576656c006044820152606401610c0e565b604051630852cd8d60e31b8152600481018490526001600160a01b038316906342966c6890602401600060405180830381600087803b158015611b8c57600080fd5b505af1158015611ba0573d6000803e3d6000fd5b505050600085815260d760205260408120805460019350909190611bc890849060ff16614ccb565b92506101000a81548160ff021916908360ff160217905550611bea3385612ff4565b600084815260d76020526040908190208054600282015460038301546004840154945160ff9093169489947f939776249d5256ef06c7746cb934aaf71e5bc90f60a5d77f94b62f703ec6bbfe94611c4d9460019490939092909190850190614d61565b60405180910390a350505050565b611c63612aa6565b60d26110c18282614b0d565b611c77613fa7565b611c7f613fa7565b60005b600a811015611d2a57600084815260d66020526040902081600a8110611caa57611caa614a4b565b6002020160019081015460ff1615159003611cff57600084815260d66020526040902081600a8110611cde57611cde614a4b565b60020201548282600a8110611cf557611cf5614a4b565b6020020152611d1a565b6000198282600a8110611d1457611d14614a4b565b60200201525b611d2381614aae565b9050611c82565b5092915050565b6000818152606760205260408120546001600160a01b031680610b6f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c0e565b60d660205281600052604060002081600a8110611dad57600080fd5b60020201805460019091015490925060ff16905082565b60ce546001600160a01b03163314611e285760405162461bcd60e51b815260206004820152602160248201527f4c656d6f6e733a2043616c6c6572206e6f742074686520626f784164647265736044820152607360f81b6064820152608401610c0e565b60d55461147590829060f81b6131f1565b60006001600160a01b038216611ea35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610c0e565b506001600160a01b031660009081526068602052604090205490565b611ec7612aa6565b611ed160006133ad565b565b600a8114611f235760405162461bcd60e51b815260206004820152601e60248201527f4c656d6f6e733a2057726f6e672065717569706d656e7420616d6f756e7400006044820152606401610c0e565b33611f2d84611d31565b6001600160a01b031614611f835760405162461bcd60e51b815260206004820152601760248201527f4c656d6f6e733a204e6f7420746f6b656e206f776e65720000000000000000006044820152606401610c0e565b611f8b613fc6565b60005b600a811015612642576000848483818110611fab57611fab614a4b565b905060200201359050600019811215611ff95760405162461bcd60e51b815260206004820152601060248201526f13195b5bdb9cce881ddc9bdb99c81a5960821b6044820152606401610c0e565b6000198113156123e95760cd546040516345e34bb760e11b8152600481018390526000916001600160a01b031690638bc6976e90602401600060405180830381865afa15801561204d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120759190810190614ddc565b905082816020015160ff16146120cd5760405162461bcd60e51b815260206004820181905260248201527f4c656d6f6e733a2057726f6e67206974656d207479706520666f7220736c6f746044820152606401610c0e565b600087815260d66020526040902083600a81106120ec576120ec614a4b565b6002020160019081015460ff161515900361221557600087815260d66020526040812084600a811061212057612120614a4b565b60020201600001549050816060015160d760008a815260200190815260200160002060020160008282546121549190614eab565b90915550506080820151600089815260d760205260408120600301805490919061217f908490614eab565b909155505060a0820151600089815260d76020526040812060040180549091906121aa908490614eab565b909155505060cd54604051632476f77f60e21b8152600481018390523360248201526001600160a01b03909116906391dbddfc90604401600060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b50505050505b6060810151600088815260d760205260408120600201805490919061223b908490614a38565b90915550506080810151600088815260d7602052604081206003018054909190612266908490614a38565b909155505060a0810151600088815260d7602052604081206004018054909190612291908490614a38565b909155505060cd5460405163e31e47d360e01b8152600481018490523360248201526001600160a01b039091169063e31e47d390604401600060405180830381600087803b1580156122e257600080fd5b505af11580156122f6573d6000803e3d6000fd5b505060cd546040516345e34bb760e11b8152600481018690526001600160a01b039091169250638bc6976e9150602401600060405180830381865afa158015612343573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261236b9190810190614ddc565b8484600a811061237d5761237d614a4b565b6020020181905250600160d6600089815260200190815260200160002084600a81106123ab576123ab614a4b565b60020201600101805460ff1916911515919091179055600087815260d660205260409020829084600a81106123e2576123e2614a4b565b6002020155505b801961262f57600086815260d66020526040902082600a811061240e5761240e614a4b565b600202016001015460ff161561262f5760cd54600087815260d66020526040812090916001600160a01b031690638bc6976e9085600a811061245257612452614a4b565b600202015460405160e083901b6001600160e01b03191681526004810191909152602401600060405180830381865afa158015612493573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526124bb9190810190614ddc565b600088815260d6602052604081209192509084600a81106124de576124de614a4b565b60020201600001549050816060015160d760008a815260200190815260200160002060020160008282546125129190614eab565b90915550506080820151600089815260d760205260408120600301805490919061253d908490614eab565b909155505060a0820151600089815260d7602052604081206004018054909190612568908490614eab565b909155505060cd54604051632476f77f60e21b8152600481018390523360248201526001600160a01b03909116906391dbddfc90604401600060405180830381600087803b1580156125b957600080fd5b505af11580156125cd573d6000803e3d6000fd5b505050600089815260d66020526040812090915085600a81106125f2576125f2614a4b565b60020201600101805460ff1916911515919091179055600088815260d66020526040812085600a811061262757612627614a4b565b600202015550505b508061263a81614aae565b915050611f8e565b50600084815260d76020526040908190209051859133917f9fbf8dbd9aa03d5086775215db2c613ddebb5adcf5454577f054047e2287501791611c4d91889088908890614fa6565b606060668054610d60906148e9565b6110c13383836133ff565b600082815260d66020526040812082600a81106126c3576126c3614a4b565b600202016001015460ff166126db5750600019610b6f565b600083815260d66020526040902082600a81106126fa576126fa614a4b565b60020201549392505050565b6127103383612dca565b61272c5760405162461bcd60e51b8152600401610c0e90614a61565b612738848484846134cd565b50505050565b6060612749826129d9565b612751613500565b61275a8361350f565b60405160200161276b929190615022565b6040516020818303038152906040529050919050565b612789612aa6565b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b1580156127d057600080fd5b505af11580156127e4573d6000803e3d6000fd5b5050505050565b6127f3612aa6565b6127fc81612819565b60d560016101000a81548160ff021916908360f81c021790555050565b6040516001600160f81b031960f883901b166020820152600090602101604051602081830303815290604052610b6f90615051565b612856612aa6565b6001600160a01b0381166128bb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c0e565b611475816133ad565b60408051808201909152600080825260208201526000846040516020016128eb919061419b565b6040516020818303038152906040529050612908868286866135a1565b9695505050505050565b60006020820180359060ca90839061292a90866147f2565b63ffffffff1681526020810191909152604001600020541492915050565b600054610100900460ff1661296f5760405162461bcd60e51b8152600401610c0e90615088565b6110c18282613669565b600054610100900460ff166129a05760405162461bcd60e51b8152600401610c0e90615088565b6110c182826136a9565b600054610100900460ff166129d15760405162461bcd60e51b8152600401610c0e90615088565b611ed1613743565b6000818152606760205260409020546001600160a01b03166114755760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610c0e565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612a6d82611d31565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6097546001600160a01b03163314611ed15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c0e565b63ffffffff8116600090815260ca602052604081205480610b6f5760405163f6ff4fb760e01b815263ffffffff84166004820152602401610c0e565b600080808080808080612b518c8e018e6150d3565b97509750975097509750975097509750612b6b8888613773565b6040805160c08101825260ff80891682528781166020808401918252838501898152606085018990526080850188905260a0850187905260008d815260d790925294902083518154925184166101000261ffff1990931693169290921717815591519091906001820190612bdf9082614b0d565b50606082015181600201556080820151816003015560a08201518160040155905050600187896001600160a01b03167f99e69e7240bbfda84bc642d0ff8ce988fe795cf5923847038d8730da52b02f3c8686868a8d604051612c4595949392919061516c565b60405180910390a4505050505050505050505050505050565b826001600160a01b0316612c7182611d31565b6001600160a01b031614612c975760405162461bcd60e51b8152600401610c0e906151a6565b6001600160a01b038216612cf95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c0e565b826001600160a01b0316612d0c82611d31565b6001600160a01b031614612d325760405162461bcd60e51b8152600401610c0e906151a6565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260688552838620805460001901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610f1a8383836001613904565b600080612dd683611d31565b9050806001600160a01b0316846001600160a01b03161480612e1d57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806116c85750836001600160a01b0316612e3684610de3565b6001600160a01b031614949350505050565b6110c18282604051806020016040528060008152506139e4565b6000612e6d82611d31565b9050612e7882611d31565b600083815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080546000190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a46110c1816000846001613904565b612f09613f60565b6000612f188460000151613a17565b602085015190915015612f3257612f328460200151613a3f565b60c9546040805160a0810190915263ffffffff891681526001600160a01b0390911690632637a45090839060208101612f6a8c612b00565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401612fa69291906151eb565b60806040518083038185885af1158015612fc4573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612fe991906152b2565b979650505050505050565b60cc80546000918261300583614aae565b9190505590506130158382612e48565b600082815260d760205260408120600190810180549192839283929061303a906148e9565b80601f0160208091040260200160405190810160405280929190818152602001828054613066906148e9565b80156130b35780601f10613088576101008083540402835291602001916130b3565b820191906000526020600020905b81548152906001019060200180831161309657829003601f168201915b5050505050905060d560019054906101000a900460f81b816000815181106130dd576130dd614a4b565b60200101906001600160f81b031916908160001a9053506040805160c081018252600180825260006020808401828152848601878152606086018b9052608086018a905260a086018990528b845260d79092529490912083518154955160ff9081166101000261ffff1990971691161794909417845551919291908201906131659082614b0d565b50606082015160028201556080820151600382015560a09091015160049091015560d4805490600061319683614aae565b9190505550600085886001600160a01b03167fb3ba62f8a19bd87521cc6f6072d6bf482458ff6c0717f3fad74c118758b963738787878760016040516131e0959493929190615323565b60405180910390a450505050505050565b60cc8054600191600091908261320683614aae565b9190505590506132168482612e48565b600380806000613227612710613af2565b60405160200161323991815260200190565b60408051808303601f1901815282825280516020918201206001600160a01b031916908301528051600c818403018152602c830190915291506000906132859089908490604c0161535a565b60408051601f1981840301815260c08301825260ff808b16845260016020858101828152868601858152606088018d9052608088018c905260a088018b905260008e815260d79093529590912086518154925185166101000261ffff199093169416939093171782559251919450918201906133019082614b0d565b50606082015160028201556080820151600382015560a09091015160049091015560d380546001919060009061333c90849061ffff1661538b565b92506101000a81548161ffff021916908361ffff1602179055506001868a6001600160a01b03167fb3ba62f8a19bd87521cc6f6072d6bf482458ff6c0717f3fad74c118758b96373888888878e60405161339a95949392919061516c565b60405180910390a4505050505050505050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036134605760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c0e565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6134d8848484612c5e565b6134e484848484613b5f565b6127385760405162461bcd60e51b8152600401610c0e906153a6565b606060d28054610d60906148e9565b6060600061351c83613c5d565b60010190506000816001600160401b0381111561353b5761353b614591565b6040519080825280601f01601f191660200182016040528015613565576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461356f57509392505050565b604080518082019091526000808252602082015260c9546040805160a0810190915263ffffffff871681526001600160a01b039091169063ddc28c5890602081016135eb89612b00565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016136209291906151eb565b6040805180830381865afa15801561363c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061366091906153f8565b95945050505050565b600054610100900460ff166136905760405162461bcd60e51b8152600401610c0e90615088565b606561369c8382614b0d565b506066610f1a8282614b0d565b60c980546001600160a01b0319166001600160a01b038481169190911790915581166136e857604051632d618d8160e21b815260040160405180910390fd5b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b15801561372f57600080fd5b505af1158015610d49573d6000803e3d6000fd5b600054610100900460ff1661376a5760405162461bcd60e51b8152600401610c0e90615088565b611ed1336133ad565b6001600160a01b0382166137c95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c0e565b6000818152606760205260409020546001600160a01b03161561382e5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c0e565b6000818152606760205260409020546001600160a01b0316156138935760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c0e565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46110c16000838360015b6001600160a01b0384161561273857600061391e83611c6f565b905060005b600a811015610d495760008282600a811061394057613940614a4b565b6020020151126139d25760cd546001600160a01b03166328cdaa93868484600a811061396e5761396e614a4b565b60200201516040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156139b957600080fd5b505af11580156139cd573d6000803e3d6000fd5b505050505b806139dc81614aae565b915050613923565b6139ee8383613773565b6139fb6000848484613b5f565b610f1a5760405162461bcd60e51b8152600401610c0e906153a6565b6000813414613a3b576040516304fb820960e51b8152346004820152602401610c0e565b5090565b60c9546040805163393f876560e21b815290516000926001600160a01b03169163e4fe1d949160048083019260209291908290030181865afa158015613a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aad9190615414565b90506001600160a01b038116613ad6576040516329b99a9560e11b815260040160405180910390fd5b60c9546110c1906001600160a01b038381169133911685613d35565b60cb805460009182613b0383614aae565b909155505060cb54604080514260208201526bffffffffffffffffffffffff193360601b1691810191909152605481019190915282906074016040516020818303038152906040528051906020012060001c610b6f9190615431565b60006001600160a01b0384163b15613c5557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613ba3903390899088908890600401615453565b6020604051808303816000875af1925050508015613bde575060408051601f3d908101601f19168201909252613bdb91810190615486565b60015b613c3b573d808015613c0c576040519150601f19603f3d011682016040523d82523d6000602084013e613c11565b606091505b508051600003613c335760405162461bcd60e51b8152600401610c0e906153a6565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506116c8565b5060016116c8565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310613c9c5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613cc8576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310613ce657662386f26fc10000830492506010015b6305f5e1008310613cfe576305f5e100830492506008015b6127108310613d1257612710830492506004015b60648310613d24576064830492506002015b600a8310610b6f5760010192915050565b604080516001600160a01b038581166024830152848116604483015260648083018590528351808403909101815260849092018352602080830180516001600160e01b03166323b872dd60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65649084015261273892879291600091613dcd918516908490613e4d565b9050805160001480613dee575080806020019051810190613dee9190614c86565b610f1a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c0e565b60606116c8848460008585600080866001600160a01b03168587604051613e7491906154a3565b60006040518083038185875af1925050503d8060008114613eb1576040519150601f19603f3d011682016040523d82523d6000602084013e613eb6565b606091505b5091509150612fe98783838760608315613f31578251600003613f2a576001600160a01b0385163b613f2a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c0e565b50816116c8565b6116c88383815115613f465781518083602001fd5b8060405162461bcd60e51b8152600401610c0e919061419b565b60405180606001604052806000801916815260200160006001600160401b03168152602001613fa2604051806040016040528060008152602001600081525090565b905290565b604051806101400160405280600a906020820280368337509192915050565b604051806101400160405280600a905b61402f604051806101000160405280600015158152602001600060ff168152602001600060ff16815260200160008152602001600081526020016000815260200160006001600160a01b03168152602001606081525090565b815260200190600190039081613fd65790505090565b6001600160e01b03198116811461147557600080fd5b60006020828403121561406d57600080fd5b813561407881614045565b9392505050565b6001600160a01b038116811461147557600080fd5b60008083601f8401126140a657600080fd5b5081356001600160401b038111156140bd57600080fd5b6020830191508360208285010111156140d557600080fd5b9250929050565b6000806000806000608086880312156140f457600080fd5b85356140ff8161407f565b945060208601356001600160401b0381111561411a57600080fd5b61412688828901614094565b909550935050604086013561413a8161407f565b949793965091946060013592915050565b60005b8381101561416657818101518382015260200161414e565b50506000910152565b6000815180845261418781602086016020860161414b565b601f01601f19169290920160200192915050565b602081526000614078602083018461416f565b6000602082840312156141c057600080fd5b5035919050565b600080604083850312156141da57600080fd5b82356141e58161407f565b946020939093013593505050565b60ff8116811461147557600080fd5b60006020828403121561421457600080fd5b8135614078816141f3565b60006060828403121561423157600080fd5b50919050565b600080600080600080600060e0888a03121561425257600080fd5b61425c898961421f565b96506060880135955060808801356001600160401b038082111561427f57600080fd5b61428b8b838c01614094565b909750955060a08a013591506142a08261407f565b90935060c089013590808211156142b657600080fd5b506142c38a828b01614094565b989b979a50959850939692959293505050565b600080604083850312156142e957600080fd5b8235915060208301356142fb8161407f565b809150509250929050565b6000806040838503121561431957600080fd5b50508035926020909101359150565b60008060006060848603121561433d57600080fd5b83356143488161407f565b925060208401356143588161407f565b929592945050506040919091013590565b60008083601f84011261437b57600080fd5b5081356001600160401b0381111561439257600080fd5b6020830191508360208260051b85010111156140d557600080fd5b600080600080604085870312156143c357600080fd5b84356001600160401b03808211156143da57600080fd5b6143e688838901614369565b909650945060208701359150808211156143ff57600080fd5b5061440c87828801614369565b95989497509550505050565b803563ffffffff8116811461442c57600080fd5b919050565b6000806040838503121561444457600080fd5b6141e583614418565b6000806000806060858703121561446357600080fd5b61446c85614418565b93506020850135925060408501356001600160401b0381111561448e57600080fd5b61440c87828801614094565b6000608082019050825182526001600160401b0360208401511660208301526040830151611d2a604084018280518252602090810151910152565b600080600080608085870312156144eb57600080fd5b84356144f68161407f565b935060208501356145068161407f565b925060408501356145168161407f565b915060608501356145268161407f565b939692955090935050565b6020815260ff825116602082015260ff60208301511660408201526000604083015160c0606084015261456760e084018261416f565b905060608401516080840152608084015160a084015260a084015160c08401528091505092915050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156145ca576145ca614591565b60405290565b604051601f8201601f191681016001600160401b03811182821017156145f8576145f8614591565b604052919050565b60006001600160401b0382111561461957614619614591565b50601f01601f191660200190565b600082601f83011261463857600080fd5b813561464b61464682614600565b6145d0565b81815284602083860101111561466057600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561468f57600080fd5b81356001600160401b038111156146a557600080fd5b6116c884828501614627565b6101408101818360005b600a8110156146da5781518352602092830192909101906001016146bb565b50505092915050565b6000602082840312156146f557600080fd5b81356140788161407f565b60008060006040848603121561471557600080fd5b8335925060208401356001600160401b0381111561473257600080fd5b61473e86828701614369565b9497909650939450505050565b801515811461147557600080fd5b6000806040838503121561476c57600080fd5b82356147778161407f565b915060208301356142fb8161474b565b6000806000806080858703121561479d57600080fd5b84356147a88161407f565b935060208501356147b88161407f565b92506040850135915060608501356001600160401b038111156147da57600080fd5b6147e687828801614627565b91505092959194509250565b60006020828403121561480457600080fd5b61407882614418565b6000806040838503121561482057600080fd5b823561482b8161407f565b915060208301356142fb8161407f565b6000806000806080858703121561485157600080fd5b61485a85614418565b935060208501356001600160401b038082111561487657600080fd5b61488288838901614627565b9450604087013591508082111561489857600080fd5b506148a587828801614627565b92505060608501356145268161474b565b815181526020808301519082015260408101610b6f565b6000606082840312156148df57600080fd5b614078838361421f565b600181811c908216806148fd57607f821691505b60208210810361423157634e487b7160e01b600052602260045260246000fd5b601f821115610f1a57600081815260208120601f850160051c810160208610156149445750805b601f850160051c820191505b81811015610d4957828155600101614950565b6001600160401b0383111561497a5761497a614591565b61498e8361498883546148e9565b8361491d565b6000601f8411600181146149c257600085156149aa5750838201355b600019600387901b1c1916600186901b1783556127e4565b600083815260209020601f19861690835b828110156149f357868501358255602094850194600190920191016149d3565b5086821015614a105760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b6f57610b6f614a22565b634e487b7160e01b600052603260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b600060018201614ac057614ac0614a22565b5060010190565b6000808335601e19843603018112614ade57600080fd5b8301803591506001600160401b03821115614af857600080fd5b6020019150368190038213156140d557600080fd5b81516001600160401b03811115614b2657614b26614591565b614b3a81614b3484546148e9565b8461491d565b602080601f831160018114614b6f5760008415614b575750858301515b600019600386901b1c1916600185901b178555610d49565b600085815260208120601f198616915b82811015614b9e57888601518255948401946001909101908401614b7f565b5085821015614bbc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b86815285602082015284604082015260a060608201528260a0820152828460c0830137600060c08483010152600060c0601f19601f860116830101905060ff83166080830152979650505050505050565b6001600160a01b03891681526020810188905260ff87811660408301528616606082015261010060808201819052600090614c5a8382018861416f565b60a0840196909652505060c081019290925260e09091015295945050505050565b805161442c8161474b565b600060208284031215614c9857600080fd5b81516140788161474b565b805161442c816141f3565b600060208284031215614cc057600080fd5b8151614078816141f3565b60ff8181168382160190811115610b6f57610b6f614a22565b60008154614cf1816148e9565b808552602060018381168015614d0e5760018114614d2857614d56565b60ff1985168884015283151560051b880183019550614d56565b866000528260002060005b85811015614d4e5781548a8201860152908301908401614d33565b890184019650505b505050505092915050565b85815284602082015283604082015282606082015260a060808201526000612fe960a0830184614ce4565b805161442c8161407f565b600082601f830112614da857600080fd5b8151614db661464682614600565b818152846020838601011115614dcb57600080fd5b6116c882602083016020870161414b565b600060208284031215614dee57600080fd5b81516001600160401b0380821115614e0557600080fd5b908301906101008286031215614e1a57600080fd5b614e226145a7565b614e2b83614c7b565b8152614e3960208401614ca3565b6020820152614e4a60408401614ca3565b6040820152606083015160608201526080830151608082015260a083015160a0820152614e7960c08401614d8c565b60c082015260e083015182811115614e9057600080fd5b614e9c87828601614d97565b60e08301525095945050505050565b81810381811115610b6f57610b6f614a22565b8183526000602080850194508260005b85811015614eea57813587529582019590820190600101614ece565b509495945050505050565b60008261014081018360005b600a811015614f9b5783830387528151610100815115158552602060ff818401511681870152604080840151614f3b8289018260ff169052565b5050606083810151908701526080808401519087015260a0808401519087015260c0808401516001600160a01b03169087015260e092830151928601829052614f868287018461416f565b99810199955093909301925050600101614f01565b509095945050505050565b606081526000855460ff8116606084015260ff8160081c1660808401525060c060a0830152614fdc610120830160018801614ce4565b600287015460c0840152600387015460e08401526004870154610100840152828103602084015261500e818688614ebe565b90508281036040840152612fe98185614ef5565b6000835161503481846020880161414b565b83519083019061504881836020880161414b565b01949350505050565b805160208201516001600160f81b031980821692919060018310156150805780818460010360031b1b83161693505b505050919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600080600080600080600080610100898b0312156150f057600080fd5b88356150fb8161407f565b9750602089013596506040890135615112816141f3565b95506060890135615122816141f3565b945060808901356001600160401b0381111561513d57600080fd5b6151498b828c01614627565b989b979a50959894979660a0860135965060c08601359560e00135945092505050565b85815284602082015283604082015260a06060820152600061519160a083018561416f565b905060ff831660808301529695505050505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a0608084015261522160e084018261416f565b90506060850151603f198483030160a085015261523e828261416f565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b60006040828403121561527657600080fd5b604051604081018181106001600160401b038211171561529857615298614591565b604052825181526020928301519281019290925250919050565b6000608082840312156152c457600080fd5b604051606081016001600160401b0382821081831117156152e7576152e7614591565b816040528451835260208501519150808216821461530457600080fd5b5060208201526153178460408501615264565b60408201529392505050565b85815284602082015283604082015260a06060820152600061534860a083018561416f565b90508260808301529695505050505050565b6001600160f81b031983168152815160009061537d81600185016020870161414b565b919091016001019392505050565b61ffff818116838216019080821115611d2a57611d2a614a22565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60006040828403121561540a57600080fd5b6140788383615264565b60006020828403121561542657600080fd5b81516140788161407f565b60008261544e57634e487b7160e01b600052601260045260246000fd5b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906129089083018461416f565b60006020828403121561549857600080fd5b815161407881614045565b600082516154b581846020870161414b565b919091019291505056fea2646970667358221220e3056f2d69968c7432a778a74a27baae225a2a5a92b8f6a99c4ba34725bed78f64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.