Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 13639785 | 974 days ago | IN | Create: DefiPassport | 0 ETH | 0.43450062 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
DefiPassport
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {ERC721Full} from "../../.openzeppelin/0.8/token/ERC721/ERC721Full.sol"; import {Counters} from "../../.openzeppelin/0.8/drafts/Counters.sol"; import {IERC721} from "../../.openzeppelin/0.8/token/ERC721/IERC721.sol"; import {Address} from "../../.openzeppelin/0.8/utils/Address.sol"; import {Bytes32} from "../../lib/Bytes32.sol"; import {Adminable} from "../../lib/Adminable.sol"; import {Initializable} from "../../lib/Initializable.sol"; import {DefiPassportStorage} from "./DefiPassportStorage.sol"; import {ISapphirePassportScores} from "../../sapphire/ISapphirePassportScores.sol"; import {SapphireTypes} from "../../sapphire/SapphireTypes.sol"; contract DefiPassport is ERC721Full, Adminable, DefiPassportStorage, Initializable { /* ========== Libraries ========== */ using Counters for Counters.Counter; using Address for address; using Bytes32 for bytes32; /* ========== Events ========== */ event BaseURISet(string _baseURI); event ApprovedSkinStatusChanged( address _skin, uint256 _skinTokenId, bool _status ); event ApprovedSkinsStatusesChanged( SkinAndTokenIdStatusRecord[] _skinsRecords ); event DefaultSkinStatusChanged( address _skin, bool _status ); event DefaultActiveSkinChanged( address _skin, uint256 _skinTokenId ); event ActiveSkinSet( uint256 _tokenId, SkinRecord _skinRecord ); event SkinManagerSet(address _skinManager); event WhitelistSkinSet(address _skin, bool _status); /* ========== Public variables ========== */ string public override baseURI; /** * @dev Deprecated. Including this because this is a proxy implementation. */ bytes32 private _proofProtocol; /* ========== Modifier ========== */ modifier onlySkinManager () { require( msg.sender == skinManager, "DefiPassport: caller is not skin manager" ); _; } /* ========== Restricted Functions ========== */ function init( string calldata name_, string calldata symbol_, address _skinManager ) external onlyAdmin initializer { _name = name_; _symbol = symbol_; skinManager = _skinManager; } /** * @dev Sets the base URI that is appended as a prefix to the * token URI. */ function setBaseURI( string calldata _baseURI ) external onlyAdmin { baseURI = _baseURI; emit BaseURISet(_baseURI); } /** * @dev Sets the address of the skin manager role * * @param _skinManager The new skin manager */ function setSkinManager( address _skinManager ) external onlyAdmin { require ( _skinManager != skinManager, "DefiPassport: the same skin manager is already set" ); skinManager = _skinManager; emit SkinManagerSet(skinManager); } /** * @notice Registers/unregisters a default skin * * @param _skin Address of the skin NFT * @param _status Wether or not it should be considered as a default * skin or not */ function setDefaultSkin( address _skin, bool _status ) external onlySkinManager { if (!_status) { require( defaultActiveSkin.skin != _skin, "Defi Passport: cannot unregister the default active skin" ); } require( defaultSkins[_skin] != _status, "DefiPassport: skin already has the same status" ); require( _skin.isContract(), "DefiPassport: the given skin is not a contract" ); require ( IERC721(_skin).ownerOf(1) != address(0), "DefiPassport: default skin must at least have tokenId eq 1" ); if (defaultActiveSkin.skin == address(0)) { defaultActiveSkin = SkinRecord(address(0), _skin, 1); } defaultSkins[_skin] = _status; emit DefaultSkinStatusChanged(_skin, _status); } /** * @dev Set the default active skin, which will be used instead of * unavailable user's active one * @notice Skin should be used as default one (with setDefaultSkin function) * * @param _skin Address of the skin NFT * @param _skinTokenId The NFT token ID */ function setDefaultActiveSkin( address _skin, uint256 _skinTokenId ) external onlySkinManager { require( defaultSkins[_skin], "DefiPassport: the given skin is not registered as a default" ); require( defaultActiveSkin.skin != _skin || defaultActiveSkin.skinTokenId != _skinTokenId, "DefiPassport: the skin is already set as default active" ); defaultActiveSkin = SkinRecord(address(0), _skin, _skinTokenId); emit DefaultActiveSkinChanged(_skin, _skinTokenId); } /** * @notice Approves a passport skin. * Only callable by the skin manager */ function setApprovedSkin( address _skin, uint256 _skinTokenId, bool _status ) external onlySkinManager { approvedSkins[_skin][_skinTokenId] = _status; emit ApprovedSkinStatusChanged(_skin, _skinTokenId, _status); } /** * @notice Sets the approved status for all skin contracts and their * token IDs passed into this function. */ function setApprovedSkins( SkinAndTokenIdStatusRecord[] memory _skinsToApprove ) public onlySkinManager { for (uint256 i = 0; i < _skinsToApprove.length; i++) { TokenIdStatus[] memory tokensAndStatuses = _skinsToApprove[i].skinTokenIdStatuses; for (uint256 j = 0; j < tokensAndStatuses.length; j ++) { TokenIdStatus memory tokenStatusPair = tokensAndStatuses[j]; approvedSkins[_skinsToApprove[i].skin][tokenStatusPair.tokenId] = tokenStatusPair.status; } } emit ApprovedSkinsStatusesChanged(_skinsToApprove); } /** * @notice Adds or removes a skin contract to the whitelist. * The Defi Passport considers all skins minted by whitelisted contracts * to be valid skins for applying them on to the passport. * The user applying the skins must still be their owner though. */ function setWhitelistedSkin( address _skinContract, bool _status ) external onlySkinManager { require ( _skinContract.isContract(), "DefiPassport: address is not a contract" ); require ( whitelistedSkins[_skinContract] != _status, "DefiPassport: the skin already has the same whitelist status" ); whitelistedSkins[_skinContract] = _status; emit WhitelistSkinSet(_skinContract, _status); } /* ========== Public Functions ========== */ /** * @notice Mints a DeFi passport to the address specified by `_to`. Note: * - The `_passportSkin` must be an approved or default skin. * - The token URI will be composed by <baseURI> + `_to`, * without the "0x" in front * * @param _to The receiver of the defi passport * @param _passportSkin The address of the skin NFT to be applied to the passport * @param _skinTokenId The ID of the passport skin NFT, owned by the receiver */ function mint( address _to, address _passportSkin, uint256 _skinTokenId ) external returns (uint256) { require ( isSkinAvailable(_to, _passportSkin, _skinTokenId), "DefiPassport: invalid skin" ); // A user cannot have two passports require( balanceOf(_to) == 0, "DefiPassport: user already has a defi passport" ); _tokenIds.increment(); uint256 newTokenId = _tokenIds.current(); _mint(_to, newTokenId); _setActiveSkin(newTokenId, SkinRecord(_to, _passportSkin, _skinTokenId)); return newTokenId; } /** * @notice Changes the passport skin of the caller's passport * * @param _skin The contract address to the skin NFT * @param _skinTokenId The ID of the skin NFT */ function setActiveSkin( address _skin, uint256 _skinTokenId ) external { require( balanceOf(msg.sender) > 0, "DefiPassport: caller has no passport" ); require( isSkinAvailable(msg.sender, _skin, _skinTokenId), "DefiPassport: invalid skin" ); uint256 tokenId = tokenOfOwnerByIndex(msg.sender, 0); _setActiveSkin(tokenId, SkinRecord(msg.sender, _skin, _skinTokenId)); } function approve( address, uint256 ) public pure override { revert("DefiPassport: defi passports are not transferrable"); } function setApprovalForAll( address, bool ) public pure override { revert("DefiPassport: defi passports are not transferrable"); } function safeTransferFrom( address, address, uint256 ) public pure override { revert("DefiPassport: defi passports are not transferrable"); } function safeTransferFrom( address, address, uint256, bytes memory ) public pure override { revert("DefiPassport: defi passports are not transferrable"); } function transferFrom( address, address, uint256 ) public pure override { revert("DefiPassport: defi passports are not transferrable"); } /* ========== Public View Functions ========== */ function name() external override view returns (string memory) { return _name; } function symbol() external override view returns (string memory) { return _symbol; } /** * @notice Returns whether a certain skin can be applied to the specified * user's passport. * * @param _user The user for whom to check * @param _skinContract The address of the skin NFT * @param _skinTokenId The NFT token ID */ function isSkinAvailable( address _user, address _skinContract, uint256 _skinTokenId ) public view returns (bool) { if (defaultSkins[_skinContract]) { return IERC721(_skinContract).ownerOf(_skinTokenId) != address(0); } else if ( whitelistedSkins[_skinContract] || approvedSkins[_skinContract][_skinTokenId] ) { return _isSkinOwner(_user, _skinContract, _skinTokenId); } return false; } /** * @notice Returns the active skin of the given passport ID * * @param _tokenId Passport ID */ function getActiveSkin( uint256 _tokenId ) public view returns (SkinRecord memory) { SkinRecord memory _activeSkin = _activeSkins[_tokenId]; if (isSkinAvailable(_activeSkin.owner, _activeSkin.skin, _activeSkin.skinTokenId)) { return _activeSkin; } else { return defaultActiveSkin; } } /** * @dev Returns the URI for a given token ID. May return an empty string. * * Reverts if the token ID does not exist. */ function tokenURI( uint256 tokenId ) public view override returns (string memory) { require( _exists(tokenId), "ERC721Metadata: URI query for nonexistent token" ); address owner = ownerOf(tokenId); return string(abi.encodePacked(baseURI, "0x", _toAsciiString(owner))); } /* ========== Private Functions ========== */ /** * @dev Converts the given address to string. Used when minting new * passports. */ function _toAsciiString( address _address ) private pure returns (string memory) { bytes memory s = new bytes(40); for (uint i = 0; i < 20; i++) { bytes1 b = bytes1(uint8(uint(uint160(_address)) / (2**(8*(19 - i))))); bytes1 hi = bytes1(uint8(b) / 16); bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi)); s[2*i] = _char(hi); s[2*i+1] = _char(lo); } return string(s); } function _char( bytes1 b ) private pure returns (bytes1 c) { if (uint8(b) < 10) return bytes1(uint8(b) + 0x30); else return bytes1(uint8(b) + 0x57); } /** * @dev Ensures that the user is the owner of the skin NFT */ function _isSkinOwner( address _user, address _skin, uint256 _tokenId ) internal view returns (bool) { /** * It is not sure if the skin contract implements the ERC721 or ERC1155 standard, * so we must do the check. */ bytes memory payload = abi.encodeWithSignature("ownerOf(uint256)", _tokenId); (bool success, bytes memory returnData) = _skin.staticcall(payload); if (success) { (address owner) = abi.decode(returnData, (address)); return owner == _user; } else { // The skin contract might be an ERC1155 (like OpenSea) payload = abi.encodeWithSignature("balanceOf(address,uint256)", _user, _tokenId); (success, returnData) = _skin.staticcall(payload); if (success) { (uint256 balance) = abi.decode(returnData, (uint256)); return balance > 0; } } return false; } function _setActiveSkin( uint256 _tokenId, SkinRecord memory _skinRecord ) private { SkinRecord memory currentSkin = _activeSkins[_tokenId]; require( currentSkin.skin != _skinRecord.skin || currentSkin.skinTokenId != _skinRecord.skinTokenId, "DefiPassport: the same skin is already active" ); _activeSkins[_tokenId] = _skinRecord; emit ActiveSkinSet(_tokenId, _skinRecord); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC721.sol"; import "./ERC721Enumerable.sol"; import "./ERC721Metadata.sol"; /** * @title Full ERC721 Token * @dev This implementation includes all the required and some optional functionality of the ERC721 standard * Moreover, it includes approve all functionality using operator terminology. * * See https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata { function _transferFrom( address from, address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable) { ERC721Enumerable._transferFrom(from, to, tokenId); } function _mint( address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable) { ERC721Enumerable._mint(to, tokenId); } function _burn( address owner, uint256 tokenId ) internal override(ERC721, ERC721Enumerable, ERC721Metadata) { // Burn implementation of Metadata ERC721._burn(owner, tokenId); ERC721Metadata._burn(owner, tokenId); ERC721Enumerable._burn(owner, tokenId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../math/SafeMath.sol"; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath} * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never * directly accessed. */ library Counters { using SafeMath for uint256; struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { // The {SafeMath} overflow check can be skipped here, see the comment at the top counter._value += 1; } function decrement(Counter storage counter) internal { counter._value = counter._value.sub(1); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of NFTs in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the NFT specified by `tokenId`. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * * * Requirements: * - `from`, `to` cannot be zero. * - `tokenId` must be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this * NFT by either {approve} or {setApprovalForAll}. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to * another (`to`). * * Requirements: * - If the caller is not `from`, it must be approved to move this NFT by * either {approve} or {setApprovalForAll}. */ function transferFrom(address from, address to, uint256 tokenId) external; function approve(address to, uint256 tokenId) external; function getApproved(uint256 tokenId) external view returns (address operator); function setApprovalForAll(address operator, bool _approved) external; function isApprovedForAll(address owner, address operator) external view returns (bool); function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; library Bytes32 { function toString( bytes32 _bytes ) internal pure returns (string memory) { uint8 i = 0; while (i < 32 && _bytes[i] != 0) { i++; } bytes memory bytesArray = new bytes(i); for (i = 0; i < 32 && _bytes[i] != 0; i++) { bytesArray[i] = _bytes[i]; } return string(bytesArray); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import { Storage } from "./Storage.sol"; /** * @title Adminable * @author dYdX * * @dev EIP-1967 Proxy Admin contract. */ contract Adminable { /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1. */ bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier to check whether the `msg.sender` is the admin. * If it is, it will run the function. Otherwise, it will revert. */ modifier onlyAdmin() { require( msg.sender == getAdmin(), "Adminable: caller is not admin" ); _; } /** * @return The EIP-1967 proxy admin */ function getAdmin() public view returns (address) { return address(uint160(uint256(Storage.load(ADMIN_SLOT)))); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @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 a proxied contract can't have 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. * * 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. * * Taken from OpenZeppelin */ contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {Counters} from "../../.openzeppelin/0.8/drafts/Counters.sol"; import {ISapphirePassportScores} from "../../sapphire/ISapphirePassportScores.sol"; contract DefiPassportStorage { /* ========== Structs ========== */ struct SkinRecord { address owner; address skin; uint256 skinTokenId; } struct TokenIdStatus { uint256 tokenId; bool status; } struct SkinAndTokenIdStatusRecord { address skin; TokenIdStatus[] skinTokenIdStatuses; } // Made these internal because the getters override these variables (because this is an upgrade) string internal _name; string internal _symbol; /** * @notice The credit score contract used by the passport */ ISapphirePassportScores private passportScoresContract; /* ========== Public Variables ========== */ /** * @notice Records the whitelisted skins. All tokens minted by these contracts * will be considered valid to apply on the passport, given they are * owned by the caller. */ mapping (address => bool) public whitelistedSkins; /** * @notice Records the approved skins of the passport */ mapping (address => mapping (uint256 => bool)) public approvedSkins; /** * @notice Records the default skins */ mapping (address => bool) public defaultSkins; /** * @notice Records the default skins */ SkinRecord public defaultActiveSkin; /** * @notice The skin manager appointed by the admin, who can * approve and revoke passport skins */ address public skinManager; /* ========== Internal Variables ========== */ /** * @notice Maps a passport (tokenId) to its active skin NFT */ mapping (uint256 => SkinRecord) internal _activeSkins; Counters.Counter internal _tokenIds; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; import {SapphireTypes} from "./SapphireTypes.sol"; interface ISapphirePassportScores { function updateMerkleRoot(bytes32 newRoot) external; function setMerkleRootUpdater(address merkleRootUpdater) external; /** * Reverts if proof is invalid */ function verify(SapphireTypes.ScoreProof calldata proof) external view returns(bool); function setMerkleRootDelay(uint256 delay) external; function setPause(bool status) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; library SapphireTypes { struct ScoreProof { address account; bytes32 protocol; uint256 score; bytes32[] merkleProof; } struct Vault { uint256 collateralAmount; uint256 borrowedAmount; } struct RootInfo { bytes32 merkleRoot; uint256 timestamp; } enum Operation { Deposit, Withdraw, Borrow, Repay, Liquidate } struct Action { uint256 amount; Operation operation; address userToLiquidate; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../GSN/Context.sol"; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; import "../../drafts/Counters.sol"; import "../../introspection/ERC165.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721 { using SafeMath for uint256; using Address for address; using Counters for Counters.Counter; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from token ID to owner mapping (uint256 => address) private _tokenOwner; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to number of owned token mapping (address => Counters.Counter) private _ownedTokensCount; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /** * @dev Gets the balance of the specified address. * @param owner address to query the balance of * @return uint256 representing the amount owned by the passed address */ function balanceOf(address owner) public override view returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _ownedTokensCount[owner].current(); } /** * @dev Gets the owner of the specified token ID. * @param tokenId uint256 ID of the token to query the owner of * @return address currently marked as the owner of the given token ID */ function ownerOf(uint256 tokenId) public override view returns (address) { address owner = _tokenOwner[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev Approves another address to transfer the given token ID * The zero address indicates there is no approved address. * There can only be one approved address per token at a given time. * Can only be called by the token owner or an approved operator. * @param to address to be approved for the given token ID * @param tokenId uint256 ID of the token to be approved */ function approve(address to, uint256 tokenId) public override virtual { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Gets the approved address for a token ID, or zero if no address set * Reverts if the token ID does not exist. * @param tokenId uint256 ID of the token to query the approval of * @return address currently approved for the given token ID */ function getApproved(uint256 tokenId) public override view returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev Sets or unsets the approval of a given operator * An operator is allowed to transfer all tokens of the sender on their behalf. * @param to operator address to set the approval * @param approved representing the status of the approval to be set */ function setApprovalForAll(address to, bool approved) public override virtual { require(to != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][to] = approved; emit ApprovalForAll(_msgSender(), to, approved); } /** * @dev Tells whether an operator is approved by a given owner. * @param owner owner address which you want to query the approval of * @param operator operator address which you want to query the approval of * @return bool whether the given operator is approved by the given owner */ function isApprovedForAll(address owner, address operator) public override view returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Transfers the ownership of a given token ID to another address. * Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * Requires the msg.sender to be the owner, approved, or operator. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function transferFrom(address from, address to, uint256 tokenId) public override virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transferFrom(from, to, tokenId); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function safeTransferFrom(address from, address to, uint256 tokenId) public override virtual { safeTransferFrom(from, to, tokenId, ""); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement {IERC721Receiver-onERC721Received}, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the _msgSender() to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public override virtual { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransferFrom(from, to, tokenId, _data); } /** * @dev Safely transfers the ownership of a given token ID to another address * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * Requires the msg.sender to be the owner, approved, or operator * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred * @param _data bytes data to send along with a safe transfer check */ function _safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) internal { _transferFrom(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether the specified token exists. * @param tokenId uint256 ID of the token to query the existence of * @return bool whether the token exists */ function _exists(uint256 tokenId) internal view returns (bool) { address owner = _tokenOwner[tokenId]; return owner != address(0); } /** * @dev Returns whether the given spender can transfer a given token ID. * @param spender address of the spender to query * @param tokenId uint256 ID of the token to be transferred * @return bool whether the msg.sender is approved for the given token ID, * is an operator of the owner, or is the owner of the token */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Internal function to safely mint a new token. * Reverts if the given token ID already exists. * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); } /** * @dev Internal function to safely mint a new token. * Reverts if the given token ID already exists. * If the target address is a contract, it must implement `onERC721Received`, * which is called upon a safe transfer, and return the magic value * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise, * the transfer is reverted. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted * @param _data bytes data to send along with a safe transfer check */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Internal function to mint a new token. * Reverts if the given token ID already exists. * @param to The address that will own the minted token * @param tokenId uint256 ID of the token to be minted */ 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"); _tokenOwner[tokenId] = to; _ownedTokensCount[to].increment(); emit Transfer(address(0), to, tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use {_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal virtual { require(ownerOf(tokenId) == owner, "ERC721: burn of token that is not own"); _clearApproval(tokenId); _ownedTokensCount[owner].decrement(); _tokenOwner[tokenId] = address(0); emit Transfer(owner, address(0), tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * @param tokenId uint256 ID of the token being burned */ function _burn(uint256 tokenId) internal { _burn(ownerOf(tokenId), tokenId); } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom(address from, address to, uint256 tokenId) internal virtual { require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _clearApproval(tokenId); _ownedTokensCount[from].decrement(); _ownedTokensCount[to].increment(); _tokenOwner[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * This is an internal detail of the `ERC721` contract and its use is deprecated. * @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) internal returns (bool) { if (!to.isContract()) { return true; } // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = to.call(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data )); if (!success) { if (returndata.length > 0) { // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert("ERC721: transfer to non ERC721Receiver implementer"); } } else { bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } } /** * @dev Private function to clear current approval of a given token ID. * @param tokenId uint256 ID of the token to be transferred */ function _clearApproval(uint256 tokenId) private { if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../GSN/Context.sol"; import "./IERC721Enumerable.sol"; import "./ERC721.sol"; import "../../introspection/ERC165.sol"; /** * @title ERC-721 Non-Fungible Token with optional enumeration extension logic * @dev See https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721Enumerable is Context, ERC165, ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => uint256[]) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Gets the token ID at a given index of the tokens list of the requested owner. * @param owner address owning the tokens list to be accessed * @param index uint256 representing the index to be accessed of the requested tokens list * @return uint256 token ID at the given index of the tokens list owned by the requested address */ function tokenOfOwnerByIndex(address owner, uint256 index) public override view returns (uint256) { require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev Gets the total amount of tokens stored by the contract. * @return uint256 representing the total amount of tokens */ function totalSupply() public override view returns (uint256) { return _allTokens.length; } /** * @dev Gets the token ID at a given index of all the tokens in this contract * Reverts if the index is greater or equal to the total number of tokens. * @param index uint256 representing the index to be accessed of the tokens list * @return uint256 token ID at the given index of the tokens list */ function tokenByIndex(uint256 index) public override view returns (uint256) { require(index < totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Internal function to transfer ownership of a given token ID to another address. * As opposed to transferFrom, this imposes no restrictions on msg.sender. * @param from current owner of the token * @param to address to receive the ownership of the given token ID * @param tokenId uint256 ID of the token to be transferred */ function _transferFrom(address from, address to, uint256 tokenId) internal override virtual { super._transferFrom(from, to, tokenId); _removeTokenFromOwnerEnumeration(from, tokenId); _addTokenToOwnerEnumeration(to, tokenId); } /** * @dev Internal function to mint a new token. * Reverts if the given token ID already exists. * @param to address the beneficiary that will own the minted token * @param tokenId uint256 ID of the token to be minted */ function _mint(address to, uint256 tokenId) internal override virtual { super._mint(to, tokenId); _addTokenToOwnerEnumeration(to, tokenId); _addTokenToAllTokensEnumeration(tokenId); } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use {ERC721-_burn} instead. * @param owner owner of the token to burn * @param tokenId uint256 ID of the token being burned */ function _burn(address owner, uint256 tokenId) internal override virtual { _removeTokenFromOwnerEnumeration(owner, tokenId); // Since tokenId will be deleted, we can clear its slot in _ownedTokensIndex to trigger a gas refund _ownedTokensIndex[tokenId] = 0; _removeTokenFromAllTokensEnumeration(tokenId); } /** * @dev Gets the list of token IDs of the requested owner. * @param owner address owning the tokens * @return uint256[] List of token IDs owned by the requested address */ function _tokensOfOwner(address owner) internal view returns (uint256[] storage) { return _ownedTokens[owner]; } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { _ownedTokensIndex[tokenId] = _ownedTokens[to].length; _ownedTokens[to].push(tokenId); } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _ownedTokens[from].length - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array _ownedTokens[from].pop(); // Note that _ownedTokensIndex[tokenId] hasn't been cleared: it still points to the old slot (now occupied by // lastTokenId, or just over the end of the array if the token was the last one). } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array _allTokens.pop(); _allTokensIndex[tokenId] = 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../GSN/Context.sol"; import "./ERC721.sol"; import "./IERC721Metadata.sol"; import "../../introspection/ERC165.sol"; contract ERC721Metadata is Context, ERC165, ERC721, IERC721Metadata { // Token name string private _name; // Token symbol string private _symbol; // Base URI string private _baseURI; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /** * @dev Gets the token name. * @return string representing the token name */ function name() external override virtual view returns (string memory) { return _name; } /** * @dev Gets the token symbol. * @return string representing the token symbol */ function symbol() external override virtual view returns (string memory) { return _symbol; } /** * @dev Returns the URI for a given token ID. May return an empty string. * * If the token's URI is non-empty and a base URI was set (via * {_setBaseURI}), it will be added to the token ID's URI as a prefix. * * Reverts if the token ID does not exist. */ function tokenURI(uint256 tokenId) external override virtual view returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // Even if there is a base URI, it is only appended to non-empty token-specific URIs if (bytes(_tokenURI).length == 0) { return ""; } else { // abi.encodePacked is being used to concatenate strings return string(abi.encodePacked(_baseURI, _tokenURI)); } } /** * @dev Internal function to set the token URI for a given token. * * Reverts if the token ID does not exist. * * TIP: if all token IDs share a prefix (e.g. if your URIs look like * `http://api.myproject.com/token/<id>`), use {_setBaseURI} to store * it and save gas. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}. * * _Available since v2.5.0._ */ function _setBaseURI(string memory baseURI_) internal { _baseURI = baseURI_; } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a preffix in {tokenURI} to each token's URI, when * they are non-empty. * * _Available since v2.5.0._ */ function baseURI() external virtual view returns (string memory) { return _baseURI; } /** * @dev Internal function to burn a specific token. * Reverts if the token does not exist. * Deprecated, use _burn(uint256) instead. * @param tokenId uint256 ID of the token being burned by the msg.sender */ function _burn(address, uint256 tokenId) internal override virtual { // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN 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 returns (address) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a {IERC721-safeTransferFrom}. This function MUST return the function selector, * otherwise the caller will revert the transaction. The selector to be * returned can be obtained as `this.onERC721Received.selector`. This * function MAY throw to revert and reject the transfer. * Note: the ERC721 contract address is always the message sender. * @param operator The address which called `safeTransferFrom` function * @param from The address which previously owned the token * @param tokenId The NFT identifier which is being transferred * @param data Additional data with no specified format * @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` */ function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external override view returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { function totalSupply() external view returns (uint256); function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { function name() external view returns (string memory); function symbol() external view returns (string memory); function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; library Storage { /** * @dev Performs an SLOAD and returns the data in the slot. */ function load( bytes32 slot ) internal view returns (bytes32) { bytes32 result; /* solhint-disable-next-line no-inline-assembly */ assembly { result := sload(slot) } return result; } /** * @dev Performs an SSTORE to save the value to the slot. */ function store( bytes32 slot, bytes32 value ) internal { /* solhint-disable-next-line no-inline-assembly */ assembly { sstore(slot, value) } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"skin","type":"address"},{"internalType":"uint256","name":"skinTokenId","type":"uint256"}],"indexed":false,"internalType":"struct DefiPassportStorage.SkinRecord","name":"_skinRecord","type":"tuple"}],"name":"ActiveSkinSet","type":"event"},{"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":false,"internalType":"address","name":"_skin","type":"address"},{"indexed":false,"internalType":"uint256","name":"_skinTokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"_status","type":"bool"}],"name":"ApprovedSkinStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"skin","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"status","type":"bool"}],"internalType":"struct DefiPassportStorage.TokenIdStatus[]","name":"skinTokenIdStatuses","type":"tuple[]"}],"indexed":false,"internalType":"struct DefiPassportStorage.SkinAndTokenIdStatusRecord[]","name":"_skinsRecords","type":"tuple[]"}],"name":"ApprovedSkinsStatusesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_baseURI","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_skin","type":"address"},{"indexed":false,"internalType":"uint256","name":"_skinTokenId","type":"uint256"}],"name":"DefaultActiveSkinChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_skin","type":"address"},{"indexed":false,"internalType":"bool","name":"_status","type":"bool"}],"name":"DefaultSkinStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_skinManager","type":"address"}],"name":"SkinManagerSet","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_skin","type":"address"},{"indexed":false,"internalType":"bool","name":"_status","type":"bool"}],"name":"WhitelistSkinSet","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"approvedSkins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultActiveSkin","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"skin","type":"address"},{"internalType":"uint256","name":"skinTokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"defaultSkins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getActiveSkin","outputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"skin","type":"address"},{"internalType":"uint256","name":"skinTokenId","type":"uint256"}],"internalType":"struct DefiPassportStorage.SkinRecord","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"_skinManager","type":"address"}],"name":"init","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":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_skinContract","type":"address"},{"internalType":"uint256","name":"_skinTokenId","type":"uint256"}],"name":"isSkinAvailable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"address","name":"_passportSkin","type":"address"},{"internalType":"uint256","name":"_skinTokenId","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_skin","type":"address"},{"internalType":"uint256","name":"_skinTokenId","type":"uint256"}],"name":"setActiveSkin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_skin","type":"address"},{"internalType":"uint256","name":"_skinTokenId","type":"uint256"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setApprovedSkin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"skin","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"status","type":"bool"}],"internalType":"struct DefiPassportStorage.TokenIdStatus[]","name":"skinTokenIdStatuses","type":"tuple[]"}],"internalType":"struct DefiPassportStorage.SkinAndTokenIdStatusRecord[]","name":"_skinsToApprove","type":"tuple[]"}],"name":"setApprovedSkins","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_skin","type":"address"},{"internalType":"uint256","name":"_skinTokenId","type":"uint256"}],"name":"setDefaultActiveSkin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_skin","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setDefaultSkin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_skinManager","type":"address"}],"name":"setSkinManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_skinContract","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setWhitelistedSkin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"skinManager","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedSkins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50620000246301ffc9a760e01b6200002a565b620000ae565b6001600160e01b03198082161415620000895760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015260640160405180910390fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b612cd180620000be6000396000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c80636c0360eb11610125578063a22cb465116100ad578063c87b56dd1161007c578063c87b56dd14610484578063d712715014610497578063e838c334146104c5578063e985e9c5146104d8578063ee007d2b1461051457600080fd5b8063a22cb46514610442578063b0a3388b14610450578063b88d4fde14610463578063c6c3bbe61461047157600080fd5b80638363f279116100f45780638363f279146103ce57806385bb1a0d146103e15780638e3d5615146103f457806395d89b411461041757806397c0c9dd1461041f57600080fd5b80636c0360eb146103985780636e9960c3146103a05780636ee5741a146103a857806370a08231146103bb57600080fd5b80631fe6a12a116101a857806342842e0e1161017757806342842e0e1461032b5780634f6ccce71461034c57806355f804b31461035f5780636352211e146103725780636ba93e6d1461038557600080fd5b80631fe6a12a14610305578063205bb4fe1461031857806323b872dd1461032b5780632f745c591461033957600080fd5b8063081812fc116101e4578063081812fc146102a0578063095ea7b3146102cb5780630e714f53146102e057806318160ddd146102f357600080fd5b8063010744321461021657806301ffc9a71461023e5780630671d74e1461026b57806306fdde031461028b575b600080fd5b61022961022436600461222d565b610558565b60405190151581526020015b60405180910390f35b61022961024c36600461256c565b6001600160e01b03191660009081526020819052604090205460ff1690565b61027e610279366004612655565b610672565b6040516102359190612906565b610293610723565b6040516102359190612854565b6102b36102ae366004612655565b6107b5565b6040516001600160a01b039091168152602001610235565b6102de6102d936600461235d565b61084f565b005b6102de6102ee36600461235d565b6108b2565b6007545b604051908152602001610235565b6102de61031336600461235d565b6109b7565b6102de6103263660046121bd565b610b84565b6102de6102d936600461222d565b6102f761034736600461235d565b610c8a565b6102f761035a366004612655565b610d43565b6102de61036d366004612594565b610de4565b6102b3610380366004612655565b610e5a565b6102de610393366004612388565b610ed1565b610293610f70565b6102b3610ffe565b6102de6103b63660046125d4565b61102d565b6102f76103c93660046121bd565b611152565b6102de6103dc366004612329565b6111db565b6102de6103ef3660046123c5565b611539565b6102296104023660046121bd565b60106020526000908152604090205460ff1681565b61029361169a565b61022961042d3660046121bd565b60126020526000908152604090205460ff1681565b6102de6102d9366004612329565b6102de61045e366004612329565b6116a9565b6102de6102d936600461226d565b6102f761047f36600461222d565b611832565b610293610492366004612655565b611957565b6102296104a536600461235d565b601160209081526000928352604080842090915290825290205460ff1681565b6016546102b3906001600160a01b031681565b6102296104e63660046121f5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b601354601454601554610532926001600160a01b0390811692169083565b604080516001600160a01b03948516815293909216602084015290820152606001610235565b6001600160a01b03821660009081526012602052604081205460ff1615610606576040516331a9108f60e11b8152600481018390526000906001600160a01b03851690636352211e9060240160206040518083038186803b1580156105bc57600080fd5b505afa1580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f491906121d9565b6001600160a01b03161415905061066b565b6001600160a01b03831660009081526010602052604090205460ff168061065057506001600160a01b038316600090815260116020908152604080832085845290915290205460ff165b1561066757610660848484611a16565b905061066b565b5060005b9392505050565b6040805160608101825260008082526020820181905291810191909152600082815260176020908152604091829020825160608101845281546001600160a01b039081168083526001840154909116938201849052600290920154938101849052926106de9290610558565b156106e95792915050565b5050604080516060810182526013546001600160a01b03908116825260145416602082015260155491810191909152919050565b50919050565b6060600d805461073290612bf1565b80601f016020809104026020016040519081016040528092919081815260200182805461075e90612bf1565b80156107ab5780601f10610780576101008083540402835291602001916107ab565b820191906000526020600020905b81548152906001019060200180831161078e57829003601f168201915b5050505050905090565b6000818152600160205260408120546001600160a01b03166108335760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600260205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152603260248201527f4465666950617373706f72743a20646566692070617373706f72747320617265604482015271206e6f74207472616e736665727261626c6560701b606482015260840161082a565b60006108bd33611152565b116109165760405162461bcd60e51b8152602060048201526024808201527f4465666950617373706f72743a2063616c6c657220686173206e6f20706173736044820152631c1bdc9d60e21b606482015260840161082a565b610921338383610558565b61096d5760405162461bcd60e51b815260206004820152601a60248201527f4465666950617373706f72743a20696e76616c696420736b696e000000000000604482015260640161082a565b600061097a336000610c8a565b90506109b2816040518060600160405280336001600160a01b03168152602001866001600160a01b0316815260200185815250611bd4565b505050565b6016546001600160a01b031633146109e15760405162461bcd60e51b815260040161082a90612887565b6001600160a01b03821660009081526012602052604090205460ff16610a6f5760405162461bcd60e51b815260206004820152603b60248201527f4465666950617373706f72743a2074686520676976656e20736b696e2069732060448201527f6e6f74207265676973746572656420617320612064656661756c740000000000606482015260840161082a565b6014546001600160a01b038381169116141580610a8e57506015548114155b610b005760405162461bcd60e51b815260206004820152603760248201527f4465666950617373706f72743a2074686520736b696e20697320616c7265616460448201527f79207365742061732064656661756c7420616374697665000000000000000000606482015260840161082a565b60408051606081018252600081526001600160a01b0384166020808301829052918301849052601380546001600160a01b03199081169091556014805490911682179055601584905582519081529081018390527fa63f42154dc5ace6ccba481b34896d5fbe1019e9a4c70292623f6beccf2d262991015b60405180910390a15050565b610b8c610ffe565b6001600160a01b0316336001600160a01b031614610bbc5760405162461bcd60e51b815260040161082a906128cf565b6016546001600160a01b0382811691161415610c355760405162461bcd60e51b815260206004820152603260248201527f4465666950617373706f72743a207468652073616d6520736b696e206d616e6160448201527119d95c881a5cc8185b1c9958591e481cd95d60721b606482015260840161082a565b601680546001600160a01b0319166001600160a01b0383169081179091556040519081527f425e1cdcac8926c92836942ab60da4237c8dd68f2d59eeb32cb4a825f34a3230906020015b60405180910390a150565b6000610c9583611152565b8210610cf75760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161082a565b6001600160a01b0383166000908152600560205260409020805483908110610d2f57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490505b92915050565b6000610d4e60075490565b8210610db15760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161082a565b60078281548110610dd257634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b610dec610ffe565b6001600160a01b0316336001600160a01b031614610e1c5760405162461bcd60e51b815260040161082a906128cf565b610e28601a83836120cd565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f68282604051610b78929190612825565b6000818152600160205260408120546001600160a01b031680610d3d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161082a565b6016546001600160a01b03163314610efb5760405162461bcd60e51b815260040161082a90612887565b6001600160a01b0383166000818152601160209081526040808320868452825291829020805460ff19168515159081179091558251938452908301859052908201527fa730960cb692d4af6fd9cf5133a79b083d5a340e5536f161183e23a9b83849ef906060015b60405180910390a1505050565b601a8054610f7d90612bf1565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa990612bf1565b8015610ff65780601f10610fcb57610100808354040283529160200191610ff6565b820191906000526020600020905b815481529060010190602001808311610fd957829003601f168201915b505050505081565b60006110287fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b919050565b611035610ffe565b6001600160a01b0316336001600160a01b0316146110655760405162461bcd60e51b815260040161082a906128cf565b601954610100900460ff168061107e575060195460ff16155b6110e15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161082a565b601954610100900460ff16158015611103576019805461ffff19166101011790555b61110f600d87876120cd565b5061111c600e85856120cd565b50601680546001600160a01b0319166001600160a01b038416179055801561114a576019805461ff00191690555b505050505050565b60006001600160a01b0382166111bd5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161082a565b6001600160a01b038216600090815260036020526040902054610d3d565b6016546001600160a01b031633146112055760405162461bcd60e51b815260040161082a90612887565b8061128e576014546001600160a01b038381169116141561128e5760405162461bcd60e51b815260206004820152603860248201527f446566692050617373706f72743a2063616e6e6f7420756e726567697374657260448201527f207468652064656661756c742061637469766520736b696e0000000000000000606482015260840161082a565b6001600160a01b03821660009081526012602052604090205460ff16151581151514156113145760405162461bcd60e51b815260206004820152602e60248201527f4465666950617373706f72743a20736b696e20616c726561647920686173207460448201526d68652073616d652073746174757360901b606482015260840161082a565b611326826001600160a01b0316611d15565b6113895760405162461bcd60e51b815260206004820152602e60248201527f4465666950617373706f72743a2074686520676976656e20736b696e2069732060448201526d1b9bdd08184818dbdb9d1c9858dd60921b606482015260840161082a565b6040516331a9108f60e11b8152600160048201526000906001600160a01b03841690636352211e9060240160206040518083038186803b1580156113cc57600080fd5b505afa1580156113e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140491906121d9565b6001600160a01b031614156114815760405162461bcd60e51b815260206004820152603a60248201527f4465666950617373706f72743a2064656661756c7420736b696e206d7573742060448201527f6174206c65617374206861766520746f6b656e49642065712031000000000000606482015260840161082a565b6014546001600160a01b03166114dd5760408051606081018252600081526001600160a01b03841660208201819052600191909201819052601380546001600160a01b0319908116909155601480549091169092179091556015555b6001600160a01b038216600081815260126020908152604091829020805460ff19168515159081179091558251938452908301527f37d8505e706f2eca106610aefcf57279b05b69fc927602f57537751cf034822c9101610b78565b6016546001600160a01b031633146115635760405162461bcd60e51b815260040161082a90612887565b60005b815181101561166a57600082828151811061159157634e487b7160e01b600052603260045260246000fd5b602002602001015160200151905060005b81518110156116555760008282815181106115cd57634e487b7160e01b600052603260045260246000fd5b6020026020010151905080602001516011600087878151811061160057634e487b7160e01b600052603260045260246000fd5b602090810291909101810151516001600160a01b0316825281810192909252604090810160009081209451815293909152909120805460ff19169115159190911790558061164d81612c26565b9150506115a2565b5050808061166290612c26565b915050611566565b507fe63791a001c483f8951307e05573b5deff42a8687b392ace9a7e6a1be3e9f29681604051610c7f9190612774565b6060600e805461073290612bf1565b6016546001600160a01b031633146116d35760405162461bcd60e51b815260040161082a90612887565b6116e5826001600160a01b0316611d15565b6117415760405162461bcd60e51b815260206004820152602760248201527f4465666950617373706f72743a2061646472657373206973206e6f74206120636044820152661bdb9d1c9858dd60ca1b606482015260840161082a565b6001600160a01b03821660009081526010602052604090205460ff16151581151514156117d65760405162461bcd60e51b815260206004820152603c60248201527f4465666950617373706f72743a2074686520736b696e20616c7265616479206860448201527f6173207468652073616d652077686974656c6973742073746174757300000000606482015260840161082a565b6001600160a01b038216600081815260106020908152604091829020805460ff19168515159081179091558251938452908301527fd2b1d5d82623f05f96ed997cb34108f63c27ccb75bd2f19ebea94b179d55644f9101610b78565b600061183f848484610558565b61188b5760405162461bcd60e51b815260206004820152601a60248201527f4465666950617373706f72743a20696e76616c696420736b696e000000000000604482015260640161082a565b61189484611152565b156118f85760405162461bcd60e51b815260206004820152602e60248201527f4465666950617373706f72743a207573657220616c726561647920686173206160448201526d081919599a481c185cdcdc1bdc9d60921b606482015260840161082a565b6119026018611d4e565b600061190d60185490565b90506119198582611d6b565b61194f816040518060600160405280886001600160a01b03168152602001876001600160a01b0316815260200186815250611bd4565b949350505050565b6000818152600160205260409020546060906001600160a01b03166119d65760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082a565b60006119e183610e5a565b9050601a6119ee82611d79565b6040516020016119ff9291906126bd565b604051602081830303815290604052915050919050565b60008082604051602401611a2c91815260200190565b60408051601f198184030181529181526020820180516001600160e01b03166331a9108f60e11b1790525190915060009081906001600160a01b03871690611a759085906126a1565b600060405180830381855afa9150503d8060008114611ab0576040519150601f19603f3d011682016040523d82523d6000602084013e611ab5565b606091505b50915091508115611af857600081806020019051810190611ad691906121d9565b9050876001600160a01b0316816001600160a01b03161494505050505061066b565b6040516001600160a01b03881660248201526044810186905260640160408051601f198184030181529181526020820180516001600160e01b0316627eeac760e11b179052519093506001600160a01b03871690611b579085906126a1565b600060405180830381855afa9150503d8060008114611b92576040519150601f19603f3d011682016040523d82523d6000602084013e611b97565b606091505b5090925090508115611bc757600081806020019051810190611bb9919061266d565b1515945061066b9350505050565b5060009695505050505050565b600082815260176020908152604091829020825160608101845281546001600160a01b039081168252600183015481168285018190526002909301549482019490945291840151919291909116141580611c3657508160400151816040015114155b611c985760405162461bcd60e51b815260206004820152602d60248201527f4465666950617373706f72743a207468652073616d6520736b696e206973206160448201526c6c72656164792061637469766560981b606482015260840161082a565b600083815260176020908152604091829020845181546001600160a01b03199081166001600160a01b039283161783559286015160018301805490941691161790915583820151600290910155517f538b4a14b85698026b973237beaf8e9c5ef9667dc8356bbddde6f4ef2d9be77690610f639085908590612935565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061194f575050151592915050565b6001816000016000828254611d6391906129e9565b909155505050565b611d758282611edc565b5050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015611ed5576000611db6826013612b87565b611dc1906008612b47565b611dcc906002612a9f565b611ddf906001600160a01b038716612a26565b60f81b9050600060108260f81c611df69190612a3a565b60f81b905060008160f81c6010611e0d9190612b66565b8360f81c611e1b9190612b9e565b60f81b9050611e2982611f61565b85611e35866002612b47565b81518110611e5357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611e7381611f61565b85611e7f866002612b47565b611e8a9060016129e9565b81518110611ea857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053505050508080611ecd90612c26565b915050611da0565b5092915050565b611ee68282611f97565b6001600160a01b039190911660009081526005602090815260408083208054858552600684528285208190556001808201835591855283852001859055600780548686526008909452918420839055820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880155565b6000600a60f883901c1015611f8857611f7f60f883901c6030612a01565b60f81b92915050565b611f7f60f883901c6057612a01565b6001600160a01b038216611fed5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161082a565b6000818152600160205260409020546001600160a01b0316156120525760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161082a565b600081815260016020908152604080832080546001600160a01b0319166001600160a01b03871690811790915583526003909152902061209190611d4e565b60405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546120d990612bf1565b90600052602060002090601f0160209004810192826120fb5760008555612141565b82601f106121145782800160ff19823516178555612141565b82800160010185558215612141579182015b82811115612141578235825591602001919060010190612126565b5061214d929150612151565b5090565b5b8082111561214d5760008155600101612152565b8035801515811461102857600080fd5b60008083601f840112612187578182fd5b50813567ffffffffffffffff81111561219e578182fd5b6020830191508360208285010111156121b657600080fd5b9250929050565b6000602082840312156121ce578081fd5b813561066b81612c83565b6000602082840312156121ea578081fd5b815161066b81612c83565b60008060408385031215612207578081fd5b823561221281612c83565b9150602083013561222281612c83565b809150509250929050565b600080600060608486031215612241578081fd5b833561224c81612c83565b9250602084013561225c81612c83565b929592945050506040919091013590565b60008060008060808587031215612282578081fd5b843561228d81612c83565b935060208581013561229e81612c83565b935060408601359250606086013567ffffffffffffffff808211156122c1578384fd5b818801915088601f8301126122d4578384fd5b8135818111156122e6576122e6612c6d565b6122f8601f8201601f19168501612994565b9150808252898482850101111561230d578485fd5b8084840185840137810190920192909252939692955090935050565b6000806040838503121561233b578182fd5b823561234681612c83565b915061235460208401612166565b90509250929050565b6000806040838503121561236f578182fd5b823561237a81612c83565b946020939093013593505050565b60008060006060848603121561239c578081fd5b83356123a781612c83565b9250602084013591506123bc60408501612166565b90509250925092565b6000602082840312156123d6578081fd5b67ffffffffffffffff823511156123eb578081fd5b8135820183601f8201126123fd578182fd5b61240f61240a82356129c5565b612994565b808235825260208201915060208301866020853560051b8601011115612433578485fd5b845b84358110156125605767ffffffffffffffff82351115612453578586fd5b813585016040818a03601f1901121561246a578687fd5b61247261296b565b61247f6020830135612c83565b6020820135815267ffffffffffffffff6040830135111561249e578788fd5b60408201358201915089603f8301126124b5578788fd5b6124c561240a60208401356129c5565b602083810135808352908201919060408086019160061b8601018d10156124ea578a8bfd5b8a5b602086013581101561253f576040828f031215612507578b8cfd5b61250f61296b565b8235815261251f60208401612166565b6020820152808552506020840193506040820191506001810190506124ec565b50506020838101919091529187525094850194929092019150600101612435565b50909695505050505050565b60006020828403121561257d578081fd5b81356001600160e01b03198116811461066b578182fd5b600080602083850312156125a6578182fd5b823567ffffffffffffffff8111156125bc578283fd5b6125c885828601612176565b90969095509350505050565b6000806000806000606086880312156125eb578283fd5b853567ffffffffffffffff80821115612602578485fd5b61260e89838a01612176565b90975095506020880135915080821115612626578485fd5b5061263388828901612176565b909450925050604086013561264781612c83565b809150509295509295909350565b600060208284031215612666578081fd5b5035919050565b60006020828403121561267e578081fd5b5051919050565b60008151612697818560208601612bc1565b9290920192915050565b600082516126b3818460208701612bc1565b9190910192915050565b600080845482600182811c9150808316806126d957607f831692505b60208084108214156126f957634e487b7160e01b87526022600452602487fd5b81801561270d576001811461271e5761274a565b60ff1986168952848901965061274a565b60008b815260209020885b868110156127425781548b820152908501908301612729565b505084890196505b50505050505061276b6127658261060f60f31b815260020190565b85612685565b95945050505050565b60006020808301818452808551808352604092508286019150828160051b870101848801865b8381101561281757888303603f19018552815180516001600160a01b03168452870151878401879052805187850181905290880190899060608601905b80831015612802578351805183528b015115158b830152928a019260019290920191908901906127d7565b5096890196945050509086019060010161279a565b509098975050505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020815260008251806020840152612873816040850160208701612bc1565b601f01601f19169190910160400192915050565b60208082526028908201527f4465666950617373706f72743a2063616c6c6572206973206e6f7420736b696e6040820152671036b0b730b3b2b960c11b606082015260800190565b6020808252601e908201527f41646d696e61626c653a2063616c6c6572206973206e6f742061646d696e0000604082015260600190565b81516001600160a01b039081168252602080840151909116908201526040808301519082015260608101610d3d565b8281526080810161066b602083018480516001600160a01b03908116835260208083015190911690830152604090810151910152565b6040805190810167ffffffffffffffff8111828210171561298e5761298e612c6d565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156129bd576129bd612c6d565b604052919050565b600067ffffffffffffffff8211156129df576129df612c6d565b5060051b60200190565b600082198211156129fc576129fc612c41565b500190565b600060ff821660ff84168060ff03821115612a1e57612a1e612c41565b019392505050565b600082612a3557612a35612c57565b500490565b600060ff831680612a4d57612a4d612c57565b8060ff84160491505092915050565b600181815b80851115612a97578160001904821115612a7d57612a7d612c41565b80851615612a8a57918102915b93841c9390800290612a61565b509250929050565b600061066b8383600082612ab557506001610d3d565b81612ac257506000610d3d565b8160018114612ad85760028114612ae257612afe565b6001915050610d3d565b60ff841115612af357612af3612c41565b50506001821b610d3d565b5060208310610133831016604e8410600b8410161715612b21575081810a610d3d565b612b2b8383612a5c565b8060001904821115612b3f57612b3f612c41565b029392505050565b6000816000190483118215151615612b6157612b61612c41565b500290565b600060ff821660ff84168160ff0481118215151615612b3f57612b3f612c41565b600082821015612b9957612b99612c41565b500390565b600060ff821660ff841680821015612bb857612bb8612c41565b90039392505050565b60005b83811015612bdc578181015183820152602001612bc4565b83811115612beb576000848401525b50505050565b600181811c90821680612c0557607f821691505b6020821081141561071d57634e487b7160e01b600052602260045260246000fd5b6000600019821415612c3a57612c3a612c41565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612c9857600080fd5b5056fea2646970667358221220b35e23c4b4206f3d88bcf1e9f6de96331b678d46f6de34746d3ecab40a0f7ec464736f6c63430008040033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102115760003560e01c80636c0360eb11610125578063a22cb465116100ad578063c87b56dd1161007c578063c87b56dd14610484578063d712715014610497578063e838c334146104c5578063e985e9c5146104d8578063ee007d2b1461051457600080fd5b8063a22cb46514610442578063b0a3388b14610450578063b88d4fde14610463578063c6c3bbe61461047157600080fd5b80638363f279116100f45780638363f279146103ce57806385bb1a0d146103e15780638e3d5615146103f457806395d89b411461041757806397c0c9dd1461041f57600080fd5b80636c0360eb146103985780636e9960c3146103a05780636ee5741a146103a857806370a08231146103bb57600080fd5b80631fe6a12a116101a857806342842e0e1161017757806342842e0e1461032b5780634f6ccce71461034c57806355f804b31461035f5780636352211e146103725780636ba93e6d1461038557600080fd5b80631fe6a12a14610305578063205bb4fe1461031857806323b872dd1461032b5780632f745c591461033957600080fd5b8063081812fc116101e4578063081812fc146102a0578063095ea7b3146102cb5780630e714f53146102e057806318160ddd146102f357600080fd5b8063010744321461021657806301ffc9a71461023e5780630671d74e1461026b57806306fdde031461028b575b600080fd5b61022961022436600461222d565b610558565b60405190151581526020015b60405180910390f35b61022961024c36600461256c565b6001600160e01b03191660009081526020819052604090205460ff1690565b61027e610279366004612655565b610672565b6040516102359190612906565b610293610723565b6040516102359190612854565b6102b36102ae366004612655565b6107b5565b6040516001600160a01b039091168152602001610235565b6102de6102d936600461235d565b61084f565b005b6102de6102ee36600461235d565b6108b2565b6007545b604051908152602001610235565b6102de61031336600461235d565b6109b7565b6102de6103263660046121bd565b610b84565b6102de6102d936600461222d565b6102f761034736600461235d565b610c8a565b6102f761035a366004612655565b610d43565b6102de61036d366004612594565b610de4565b6102b3610380366004612655565b610e5a565b6102de610393366004612388565b610ed1565b610293610f70565b6102b3610ffe565b6102de6103b63660046125d4565b61102d565b6102f76103c93660046121bd565b611152565b6102de6103dc366004612329565b6111db565b6102de6103ef3660046123c5565b611539565b6102296104023660046121bd565b60106020526000908152604090205460ff1681565b61029361169a565b61022961042d3660046121bd565b60126020526000908152604090205460ff1681565b6102de6102d9366004612329565b6102de61045e366004612329565b6116a9565b6102de6102d936600461226d565b6102f761047f36600461222d565b611832565b610293610492366004612655565b611957565b6102296104a536600461235d565b601160209081526000928352604080842090915290825290205460ff1681565b6016546102b3906001600160a01b031681565b6102296104e63660046121f5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b601354601454601554610532926001600160a01b0390811692169083565b604080516001600160a01b03948516815293909216602084015290820152606001610235565b6001600160a01b03821660009081526012602052604081205460ff1615610606576040516331a9108f60e11b8152600481018390526000906001600160a01b03851690636352211e9060240160206040518083038186803b1580156105bc57600080fd5b505afa1580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f491906121d9565b6001600160a01b03161415905061066b565b6001600160a01b03831660009081526010602052604090205460ff168061065057506001600160a01b038316600090815260116020908152604080832085845290915290205460ff165b1561066757610660848484611a16565b905061066b565b5060005b9392505050565b6040805160608101825260008082526020820181905291810191909152600082815260176020908152604091829020825160608101845281546001600160a01b039081168083526001840154909116938201849052600290920154938101849052926106de9290610558565b156106e95792915050565b5050604080516060810182526013546001600160a01b03908116825260145416602082015260155491810191909152919050565b50919050565b6060600d805461073290612bf1565b80601f016020809104026020016040519081016040528092919081815260200182805461075e90612bf1565b80156107ab5780601f10610780576101008083540402835291602001916107ab565b820191906000526020600020905b81548152906001019060200180831161078e57829003601f168201915b5050505050905090565b6000818152600160205260408120546001600160a01b03166108335760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600260205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152603260248201527f4465666950617373706f72743a20646566692070617373706f72747320617265604482015271206e6f74207472616e736665727261626c6560701b606482015260840161082a565b60006108bd33611152565b116109165760405162461bcd60e51b8152602060048201526024808201527f4465666950617373706f72743a2063616c6c657220686173206e6f20706173736044820152631c1bdc9d60e21b606482015260840161082a565b610921338383610558565b61096d5760405162461bcd60e51b815260206004820152601a60248201527f4465666950617373706f72743a20696e76616c696420736b696e000000000000604482015260640161082a565b600061097a336000610c8a565b90506109b2816040518060600160405280336001600160a01b03168152602001866001600160a01b0316815260200185815250611bd4565b505050565b6016546001600160a01b031633146109e15760405162461bcd60e51b815260040161082a90612887565b6001600160a01b03821660009081526012602052604090205460ff16610a6f5760405162461bcd60e51b815260206004820152603b60248201527f4465666950617373706f72743a2074686520676976656e20736b696e2069732060448201527f6e6f74207265676973746572656420617320612064656661756c740000000000606482015260840161082a565b6014546001600160a01b038381169116141580610a8e57506015548114155b610b005760405162461bcd60e51b815260206004820152603760248201527f4465666950617373706f72743a2074686520736b696e20697320616c7265616460448201527f79207365742061732064656661756c7420616374697665000000000000000000606482015260840161082a565b60408051606081018252600081526001600160a01b0384166020808301829052918301849052601380546001600160a01b03199081169091556014805490911682179055601584905582519081529081018390527fa63f42154dc5ace6ccba481b34896d5fbe1019e9a4c70292623f6beccf2d262991015b60405180910390a15050565b610b8c610ffe565b6001600160a01b0316336001600160a01b031614610bbc5760405162461bcd60e51b815260040161082a906128cf565b6016546001600160a01b0382811691161415610c355760405162461bcd60e51b815260206004820152603260248201527f4465666950617373706f72743a207468652073616d6520736b696e206d616e6160448201527119d95c881a5cc8185b1c9958591e481cd95d60721b606482015260840161082a565b601680546001600160a01b0319166001600160a01b0383169081179091556040519081527f425e1cdcac8926c92836942ab60da4237c8dd68f2d59eeb32cb4a825f34a3230906020015b60405180910390a150565b6000610c9583611152565b8210610cf75760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161082a565b6001600160a01b0383166000908152600560205260409020805483908110610d2f57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490505b92915050565b6000610d4e60075490565b8210610db15760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161082a565b60078281548110610dd257634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b610dec610ffe565b6001600160a01b0316336001600160a01b031614610e1c5760405162461bcd60e51b815260040161082a906128cf565b610e28601a83836120cd565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f68282604051610b78929190612825565b6000818152600160205260408120546001600160a01b031680610d3d5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161082a565b6016546001600160a01b03163314610efb5760405162461bcd60e51b815260040161082a90612887565b6001600160a01b0383166000818152601160209081526040808320868452825291829020805460ff19168515159081179091558251938452908301859052908201527fa730960cb692d4af6fd9cf5133a79b083d5a340e5536f161183e23a9b83849ef906060015b60405180910390a1505050565b601a8054610f7d90612bf1565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa990612bf1565b8015610ff65780601f10610fcb57610100808354040283529160200191610ff6565b820191906000526020600020905b815481529060010190602001808311610fd957829003601f168201915b505050505081565b60006110287fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b919050565b611035610ffe565b6001600160a01b0316336001600160a01b0316146110655760405162461bcd60e51b815260040161082a906128cf565b601954610100900460ff168061107e575060195460ff16155b6110e15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161082a565b601954610100900460ff16158015611103576019805461ffff19166101011790555b61110f600d87876120cd565b5061111c600e85856120cd565b50601680546001600160a01b0319166001600160a01b038416179055801561114a576019805461ff00191690555b505050505050565b60006001600160a01b0382166111bd5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161082a565b6001600160a01b038216600090815260036020526040902054610d3d565b6016546001600160a01b031633146112055760405162461bcd60e51b815260040161082a90612887565b8061128e576014546001600160a01b038381169116141561128e5760405162461bcd60e51b815260206004820152603860248201527f446566692050617373706f72743a2063616e6e6f7420756e726567697374657260448201527f207468652064656661756c742061637469766520736b696e0000000000000000606482015260840161082a565b6001600160a01b03821660009081526012602052604090205460ff16151581151514156113145760405162461bcd60e51b815260206004820152602e60248201527f4465666950617373706f72743a20736b696e20616c726561647920686173207460448201526d68652073616d652073746174757360901b606482015260840161082a565b611326826001600160a01b0316611d15565b6113895760405162461bcd60e51b815260206004820152602e60248201527f4465666950617373706f72743a2074686520676976656e20736b696e2069732060448201526d1b9bdd08184818dbdb9d1c9858dd60921b606482015260840161082a565b6040516331a9108f60e11b8152600160048201526000906001600160a01b03841690636352211e9060240160206040518083038186803b1580156113cc57600080fd5b505afa1580156113e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140491906121d9565b6001600160a01b031614156114815760405162461bcd60e51b815260206004820152603a60248201527f4465666950617373706f72743a2064656661756c7420736b696e206d7573742060448201527f6174206c65617374206861766520746f6b656e49642065712031000000000000606482015260840161082a565b6014546001600160a01b03166114dd5760408051606081018252600081526001600160a01b03841660208201819052600191909201819052601380546001600160a01b0319908116909155601480549091169092179091556015555b6001600160a01b038216600081815260126020908152604091829020805460ff19168515159081179091558251938452908301527f37d8505e706f2eca106610aefcf57279b05b69fc927602f57537751cf034822c9101610b78565b6016546001600160a01b031633146115635760405162461bcd60e51b815260040161082a90612887565b60005b815181101561166a57600082828151811061159157634e487b7160e01b600052603260045260246000fd5b602002602001015160200151905060005b81518110156116555760008282815181106115cd57634e487b7160e01b600052603260045260246000fd5b6020026020010151905080602001516011600087878151811061160057634e487b7160e01b600052603260045260246000fd5b602090810291909101810151516001600160a01b0316825281810192909252604090810160009081209451815293909152909120805460ff19169115159190911790558061164d81612c26565b9150506115a2565b5050808061166290612c26565b915050611566565b507fe63791a001c483f8951307e05573b5deff42a8687b392ace9a7e6a1be3e9f29681604051610c7f9190612774565b6060600e805461073290612bf1565b6016546001600160a01b031633146116d35760405162461bcd60e51b815260040161082a90612887565b6116e5826001600160a01b0316611d15565b6117415760405162461bcd60e51b815260206004820152602760248201527f4465666950617373706f72743a2061646472657373206973206e6f74206120636044820152661bdb9d1c9858dd60ca1b606482015260840161082a565b6001600160a01b03821660009081526010602052604090205460ff16151581151514156117d65760405162461bcd60e51b815260206004820152603c60248201527f4465666950617373706f72743a2074686520736b696e20616c7265616479206860448201527f6173207468652073616d652077686974656c6973742073746174757300000000606482015260840161082a565b6001600160a01b038216600081815260106020908152604091829020805460ff19168515159081179091558251938452908301527fd2b1d5d82623f05f96ed997cb34108f63c27ccb75bd2f19ebea94b179d55644f9101610b78565b600061183f848484610558565b61188b5760405162461bcd60e51b815260206004820152601a60248201527f4465666950617373706f72743a20696e76616c696420736b696e000000000000604482015260640161082a565b61189484611152565b156118f85760405162461bcd60e51b815260206004820152602e60248201527f4465666950617373706f72743a207573657220616c726561647920686173206160448201526d081919599a481c185cdcdc1bdc9d60921b606482015260840161082a565b6119026018611d4e565b600061190d60185490565b90506119198582611d6b565b61194f816040518060600160405280886001600160a01b03168152602001876001600160a01b0316815260200186815250611bd4565b949350505050565b6000818152600160205260409020546060906001600160a01b03166119d65760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161082a565b60006119e183610e5a565b9050601a6119ee82611d79565b6040516020016119ff9291906126bd565b604051602081830303815290604052915050919050565b60008082604051602401611a2c91815260200190565b60408051601f198184030181529181526020820180516001600160e01b03166331a9108f60e11b1790525190915060009081906001600160a01b03871690611a759085906126a1565b600060405180830381855afa9150503d8060008114611ab0576040519150601f19603f3d011682016040523d82523d6000602084013e611ab5565b606091505b50915091508115611af857600081806020019051810190611ad691906121d9565b9050876001600160a01b0316816001600160a01b03161494505050505061066b565b6040516001600160a01b03881660248201526044810186905260640160408051601f198184030181529181526020820180516001600160e01b0316627eeac760e11b179052519093506001600160a01b03871690611b579085906126a1565b600060405180830381855afa9150503d8060008114611b92576040519150601f19603f3d011682016040523d82523d6000602084013e611b97565b606091505b5090925090508115611bc757600081806020019051810190611bb9919061266d565b1515945061066b9350505050565b5060009695505050505050565b600082815260176020908152604091829020825160608101845281546001600160a01b039081168252600183015481168285018190526002909301549482019490945291840151919291909116141580611c3657508160400151816040015114155b611c985760405162461bcd60e51b815260206004820152602d60248201527f4465666950617373706f72743a207468652073616d6520736b696e206973206160448201526c6c72656164792061637469766560981b606482015260840161082a565b600083815260176020908152604091829020845181546001600160a01b03199081166001600160a01b039283161783559286015160018301805490941691161790915583820151600290910155517f538b4a14b85698026b973237beaf8e9c5ef9667dc8356bbddde6f4ef2d9be77690610f639085908590612935565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061194f575050151592915050565b6001816000016000828254611d6391906129e9565b909155505050565b611d758282611edc565b5050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015611ed5576000611db6826013612b87565b611dc1906008612b47565b611dcc906002612a9f565b611ddf906001600160a01b038716612a26565b60f81b9050600060108260f81c611df69190612a3a565b60f81b905060008160f81c6010611e0d9190612b66565b8360f81c611e1b9190612b9e565b60f81b9050611e2982611f61565b85611e35866002612b47565b81518110611e5357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611e7381611f61565b85611e7f866002612b47565b611e8a9060016129e9565b81518110611ea857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053505050508080611ecd90612c26565b915050611da0565b5092915050565b611ee68282611f97565b6001600160a01b039190911660009081526005602090815260408083208054858552600684528285208190556001808201835591855283852001859055600780548686526008909452918420839055820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880155565b6000600a60f883901c1015611f8857611f7f60f883901c6030612a01565b60f81b92915050565b611f7f60f883901c6057612a01565b6001600160a01b038216611fed5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161082a565b6000818152600160205260409020546001600160a01b0316156120525760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161082a565b600081815260016020908152604080832080546001600160a01b0319166001600160a01b03871690811790915583526003909152902061209190611d4e565b60405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546120d990612bf1565b90600052602060002090601f0160209004810192826120fb5760008555612141565b82601f106121145782800160ff19823516178555612141565b82800160010185558215612141579182015b82811115612141578235825591602001919060010190612126565b5061214d929150612151565b5090565b5b8082111561214d5760008155600101612152565b8035801515811461102857600080fd5b60008083601f840112612187578182fd5b50813567ffffffffffffffff81111561219e578182fd5b6020830191508360208285010111156121b657600080fd5b9250929050565b6000602082840312156121ce578081fd5b813561066b81612c83565b6000602082840312156121ea578081fd5b815161066b81612c83565b60008060408385031215612207578081fd5b823561221281612c83565b9150602083013561222281612c83565b809150509250929050565b600080600060608486031215612241578081fd5b833561224c81612c83565b9250602084013561225c81612c83565b929592945050506040919091013590565b60008060008060808587031215612282578081fd5b843561228d81612c83565b935060208581013561229e81612c83565b935060408601359250606086013567ffffffffffffffff808211156122c1578384fd5b818801915088601f8301126122d4578384fd5b8135818111156122e6576122e6612c6d565b6122f8601f8201601f19168501612994565b9150808252898482850101111561230d578485fd5b8084840185840137810190920192909252939692955090935050565b6000806040838503121561233b578182fd5b823561234681612c83565b915061235460208401612166565b90509250929050565b6000806040838503121561236f578182fd5b823561237a81612c83565b946020939093013593505050565b60008060006060848603121561239c578081fd5b83356123a781612c83565b9250602084013591506123bc60408501612166565b90509250925092565b6000602082840312156123d6578081fd5b67ffffffffffffffff823511156123eb578081fd5b8135820183601f8201126123fd578182fd5b61240f61240a82356129c5565b612994565b808235825260208201915060208301866020853560051b8601011115612433578485fd5b845b84358110156125605767ffffffffffffffff82351115612453578586fd5b813585016040818a03601f1901121561246a578687fd5b61247261296b565b61247f6020830135612c83565b6020820135815267ffffffffffffffff6040830135111561249e578788fd5b60408201358201915089603f8301126124b5578788fd5b6124c561240a60208401356129c5565b602083810135808352908201919060408086019160061b8601018d10156124ea578a8bfd5b8a5b602086013581101561253f576040828f031215612507578b8cfd5b61250f61296b565b8235815261251f60208401612166565b6020820152808552506020840193506040820191506001810190506124ec565b50506020838101919091529187525094850194929092019150600101612435565b50909695505050505050565b60006020828403121561257d578081fd5b81356001600160e01b03198116811461066b578182fd5b600080602083850312156125a6578182fd5b823567ffffffffffffffff8111156125bc578283fd5b6125c885828601612176565b90969095509350505050565b6000806000806000606086880312156125eb578283fd5b853567ffffffffffffffff80821115612602578485fd5b61260e89838a01612176565b90975095506020880135915080821115612626578485fd5b5061263388828901612176565b909450925050604086013561264781612c83565b809150509295509295909350565b600060208284031215612666578081fd5b5035919050565b60006020828403121561267e578081fd5b5051919050565b60008151612697818560208601612bc1565b9290920192915050565b600082516126b3818460208701612bc1565b9190910192915050565b600080845482600182811c9150808316806126d957607f831692505b60208084108214156126f957634e487b7160e01b87526022600452602487fd5b81801561270d576001811461271e5761274a565b60ff1986168952848901965061274a565b60008b815260209020885b868110156127425781548b820152908501908301612729565b505084890196505b50505050505061276b6127658261060f60f31b815260020190565b85612685565b95945050505050565b60006020808301818452808551808352604092508286019150828160051b870101848801865b8381101561281757888303603f19018552815180516001600160a01b03168452870151878401879052805187850181905290880190899060608601905b80831015612802578351805183528b015115158b830152928a019260019290920191908901906127d7565b5096890196945050509086019060010161279a565b509098975050505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b6020815260008251806020840152612873816040850160208701612bc1565b601f01601f19169190910160400192915050565b60208082526028908201527f4465666950617373706f72743a2063616c6c6572206973206e6f7420736b696e6040820152671036b0b730b3b2b960c11b606082015260800190565b6020808252601e908201527f41646d696e61626c653a2063616c6c6572206973206e6f742061646d696e0000604082015260600190565b81516001600160a01b039081168252602080840151909116908201526040808301519082015260608101610d3d565b8281526080810161066b602083018480516001600160a01b03908116835260208083015190911690830152604090810151910152565b6040805190810167ffffffffffffffff8111828210171561298e5761298e612c6d565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156129bd576129bd612c6d565b604052919050565b600067ffffffffffffffff8211156129df576129df612c6d565b5060051b60200190565b600082198211156129fc576129fc612c41565b500190565b600060ff821660ff84168060ff03821115612a1e57612a1e612c41565b019392505050565b600082612a3557612a35612c57565b500490565b600060ff831680612a4d57612a4d612c57565b8060ff84160491505092915050565b600181815b80851115612a97578160001904821115612a7d57612a7d612c41565b80851615612a8a57918102915b93841c9390800290612a61565b509250929050565b600061066b8383600082612ab557506001610d3d565b81612ac257506000610d3d565b8160018114612ad85760028114612ae257612afe565b6001915050610d3d565b60ff841115612af357612af3612c41565b50506001821b610d3d565b5060208310610133831016604e8410600b8410161715612b21575081810a610d3d565b612b2b8383612a5c565b8060001904821115612b3f57612b3f612c41565b029392505050565b6000816000190483118215151615612b6157612b61612c41565b500290565b600060ff821660ff84168160ff0481118215151615612b3f57612b3f612c41565b600082821015612b9957612b99612c41565b500390565b600060ff821660ff841680821015612bb857612bb8612c41565b90039392505050565b60005b83811015612bdc578181015183820152602001612bc4565b83811115612beb576000848401525b50505050565b600181811c90821680612c0557607f821691505b6020821081141561071d57634e487b7160e01b600052602260045260246000fd5b6000600019821415612c3a57612c3a612c41565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612c9857600080fd5b5056fea2646970667358221220b35e23c4b4206f3d88bcf1e9f6de96331b678d46f6de34746d3ecab40a0f7ec464736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.