Contract Overview
Balance:
0 Ether
Token:
More Info
My Name Tag:
Not Available
TokenTracker:
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
Nafta
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 999999 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/INafta.sol"; import "./interfaces/IFlashNFTReceiver.sol"; import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; contract Nafta is INafta, ERC721, ERC721Holder, Ownable { // WETH9 address IERC20 immutable WETH9; /// @dev mapping from token contract to token id to token details/vault mapping(address => mapping(uint256 => PoolNFT)) internal _poolNFTs; /// @dev mapping of earnings of each user of the pool (in WETH9) mapping(address => uint256) public earnings; /// @dev fee taken by pool on each flashloan or flashlong operation uint256 public poolFee; uint256 public poolFeeChangedAtBlock; // Newly proposed owner, who will be able to claim the ownership address public proposedOwner; // We use a single ERC721 NaftaNFT for both Borrowers and Lenders NFT types. // Thus we introduce an ID shift for LenderNFTs type, to distinguish their IDs from BorrowerNFTs // So all IDs below 2**32 are BorrowerNFTs, and all above 2**32 are LenderNFTs /// @dev keeps track of the next free BorrowerNFT ID (longrent) /// @dev is in range 1 to 4 294 967 295 and the ID is used as is in NaftaNFT /// @dev 0 is reserved for N/A uint256 public borrowerNFTCount = 0; /// @dev keeps track of the next free LenderNFT ID (when adding to pool) /// @dev is in range 4 294 967 297 to 8 589 934 591 (subtract 2**32 to get actual count) /// @dev 4 294 967 296 is reserved for N/A uint256 public lenderNFTCount = 2**32; constructor(address owner_, IERC20 WETH9_) ERC721("NaftaNFT", "NAFTA") { WETH9 = WETH9_; Ownable.transferOwnership(owner_); } ///////////// // Getters // ///////////// /// @dev poolNFT storage view function /// @param nftAddress Address of the NFT contract /// @param nftId NFT ID function poolNFTs(address nftAddress, uint256 nftId) external view override returns (PoolNFT memory nft) { nft = _poolNFTs[nftAddress][nftId]; } //////////////////// // Pool functions // //////////////////// /// @notice Add your NFT to the pool /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to add /// @param flashFee - The fee user has to pay for a single rent (in WETH9) [Range: 0-4722.36648 ETH] (0 if flashrent is free) /// @param pricePerBlock - If renting longterm - this is the price per block (0 if not allowing renting longterm) [Range: 0-4722.36648 ETH] /// @param maxLongtermBlocks - Maximum amount of blocks for longterm rent [Range: 0-16777216] function addNFT( address nftAddress, uint256 nftId, uint256 flashFee, uint256 pricePerBlock, uint256 maxLongtermBlocks ) external { // Protection from weird and meaningless adding of NaftaNFTs require(nftAddress != address(this), "Can't add Nafta NFTs to Nafta"); // Verify that NFT isn't already in the pool require(_poolNFTs[nftAddress][nftId].lenderNFTId == 0, "NFT is already in the Pool"); // In Longterm rent, we have protection from cheaters who want to rent longterm for 1 block and pay less than a flash loan fee. // This check is to make sure if longrent with these parameters is even possible. // If pricePerBlock == 0 then Longterm rent is disabled. require((pricePerBlock == 0) || (maxLongtermBlocks * pricePerBlock >= flashFee), "Max Longterm rent can't be cheaper than flashloan"); // Pull the NFT from the msg.sender using transferFrom IERC721(nftAddress).safeTransferFrom(msg.sender, address(this), nftId); uint256 newNFTId = lenderNFTCount + 1; lenderNFTCount = newNFTId; // Store newly added NFT renting parameters after packing to struct _poolNFTs[nftAddress][nftId] = fromBigPoolNFT( // (flashFee, pricePerBlock, maxLongtermBlocks, inLongtermTillBlock, borrowerNFTId, lenderNFTId) BigPoolNFT(flashFee, pricePerBlock, maxLongtermBlocks, 0, 0, newNFTId) ); // Mint a new LenderNFT to msg.sender _safeMint(msg.sender, newNFTId); // Emit AddNFT event emit AddNFT(nftAddress, nftId, flashFee, pricePerBlock, maxLongtermBlocks, newNFTId, msg.sender); } /// @notice Edit your NFT prices /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you have in the pool /// @param flashFee - The fee user has to pay for a single rent (in WETH9) [Range: 0-4722.36648 ETH] (0 if flashrent is free) /// @param pricePerBlock - If renting longterm - this is the price per block (0 if not allowing renting longterm) [Range: 0-4722.36648 ETH] /// @param maxLongtermBlocks - Maximum amount of blocks for longterm rent [Range: 0-16777216] function editNFT( address nftAddress, uint256 nftId, uint256 flashFee, uint256 pricePerBlock, uint256 maxLongtermBlocks ) external { // In Longterm rent, we have protection from cheaters who want to rent longterm for 1 block and pay less than a flash loan fee. // This check is to make sure if longrent with these parameters is even possible. // If pricePerBlock == 0 then Longterm rent is disabled. require((pricePerBlock == 0) || (maxLongtermBlocks * pricePerBlock >= flashFee), "Max Longterm rent can't be cheaper than flashloan"); BigPoolNFT memory bigPoolNFT = toBigPoolNFT(_poolNFTs[nftAddress][nftId]); // Verify that msg.sender is stored as an owner of this NFT require(ownerOf(bigPoolNFT.lenderNFTId) == msg.sender, "Only owner of the corresponding LenderNFT can call this"); // Update parameters: flashFee, pricePerBlock, maxLongtermBlocks bigPoolNFT.flashFee = flashFee; bigPoolNFT.pricePerBlock = pricePerBlock; bigPoolNFT.maxLongtermBlocks = maxLongtermBlocks; // Save the updated NFT back to storage after packing _poolNFTs[nftAddress][nftId] = fromBigPoolNFT(bigPoolNFT); // Emit EditNFT event emit EditNFT(nftAddress, nftId, flashFee, pricePerBlock, maxLongtermBlocks, bigPoolNFT.lenderNFTId, msg.sender); } /// @notice Remove your NFT from the pool with earnings /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to remove function removeNFT(address nftAddress, uint256 nftId) external { BigPoolNFT memory bigPoolNFT = toBigPoolNFT(_poolNFTs[nftAddress][nftId]); // Verify that msg.sender is stored as an owner of this NFT require(ownerOf(bigPoolNFT.lenderNFTId) == msg.sender, "Only owner of the corresponding LenderNFT can call this"); // Verify that it's not rented in longterm right now require(bigPoolNFT.inLongtermTillBlock < block.number, "Can't remove NFT from the pool while in longterm rent"); // If it's not rented longterm - update longterm rent and burn if needed updateLongRent(nftAddress, nftId); // Zero the storage of this NFT in the pool and burn the NFT delete _poolNFTs[nftAddress][nftId]; _burn(bigPoolNFT.lenderNFTId); // Push the NFT to msg.sender IERC721(nftAddress).safeTransferFrom(address(this), msg.sender, nftId); // Emit RemoveNFT event emit RemoveNFT(nftAddress, nftId, bigPoolNFT.lenderNFTId, msg.sender); } /// @notice Withdraw the earnings of your NFT function withdrawEarnings() external override { uint256 transferAmount = earnings[msg.sender]; // Verify that earnings > 0 require(transferAmount > 0, "No earnings to withdraw"); // Reset earnings before transfer earnings[msg.sender] = 0; // Push the WETH9 earnings to msg.sender require(WETH9.transfer(msg.sender, transferAmount), "WETH9 transfer failed"); // Emit withdraw event emit WithdrawEarnings(transferAmount, msg.sender); } /// @notice Execute a Flashloan of NFT /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to flashloan /// @param maxLoanPrice - Price the user is willing to pay for the flashloan (protection from editing frontrunning) /// @param receiverAddress - the contract that will receive the NFT (has to implement INFTFlashLoanReceiver interface) /// @param data - calldata that will be passed to the receiver contract (optional) function flashloan( address nftAddress, uint256 nftId, uint256 maxLoanPrice, address receiverAddress, bytes calldata data ) external { // Verify that this NFT still exists in the pool require(IERC721(nftAddress).ownerOf(nftId) == address(this), "NFT should be in the pool"); // Update longterm rent parameters updateLongRent(nftAddress, nftId); BigPoolNFT memory bigPoolNFT = toBigPoolNFT(_poolNFTs[nftAddress][nftId]); // Is this NFT already in a longterm rent? bool longterm = bigPoolNFT.inLongtermTillBlock >= block.number; // If this NFT is in a longterm rent right now - check if the msg.sender has the BorrowerNFT if (longterm) { require( ownerOf(bigPoolNFT.borrowerNFTId) == msg.sender, "This NFT is in longterm rent - you can't flashloan it unless you have corresponding BorrowerNFT" ); } uint256 lenderFees = longterm ? 0 : bigPoolNFT.flashFee; require(lenderFees <= maxLoanPrice, "You can't take the flashloan for the indicated price"); // Initialize the Receiver with IFlashNFTReceiver IFlashNFTReceiver receiver = IFlashNFTReceiver(receiverAddress); // Push the NFT to Receiver IERC721(nftAddress).safeTransferFrom(address(this), receiverAddress, nftId); require(receiver.executeOperation(nftAddress, nftId, lenderFees, msg.sender, data), "Error during FlashNFT Execution"); // Pull the NFT back from Receiver (will revert if not possible) IERC721(nftAddress).safeTransferFrom(receiverAddress, address(this), nftId); // Pull the flashFee fee from msg.sender (will revert if not possible) require(longterm || WETH9.transferFrom(msg.sender, address(this), lenderFees), "Can't transfer WETH9 lender fees"); // Calculate the part of fee that goes to the pool (flashFee * poolFee) uint256 poolPart = (poolFee * lenderFees) / 1e18; // Add poolPart to the pool Owner balance if it's more than zero if (poolPart > 0) earnings[owner()] += poolPart; // Add the received (flashFee - poolPart) to NFT owner's earnings earnings[ownerOf(bigPoolNFT.lenderNFTId)] += lenderFees - poolPart; // This might be an excess check, because we had a successful "safeTransferFrom" above, // but better be safe than sorry. require(IERC721(nftAddress).ownerOf(nftId) == address(this), "NFT should be in the pool"); // Emit a Flashloan event emit Flashloan(nftAddress, nftId, lenderFees, msg.sender); } /////////////////// // Longterm rent // /////////////////// /// @dev Utility function to update the status of longterm rent /// @dev Is called in some functions as well as can be called by public /// @dev will reset the values and burn the BorrowerNFT if the longterm rent is over /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to update function updateLongRent(address nftAddress, uint256 nftId) public { BigPoolNFT memory bigPoolNFT = toBigPoolNFT(_poolNFTs[nftAddress][nftId]); if (bigPoolNFT.inLongtermTillBlock > 0 && bigPoolNFT.inLongtermTillBlock < block.number) { _burn(bigPoolNFT.borrowerNFTId); bigPoolNFT.borrowerNFTId = 0; bigPoolNFT.inLongtermTillBlock = 0; _poolNFTs[nftAddress][nftId] = fromBigPoolNFT(bigPoolNFT); } } /// @notice Take the NFT into longterm rent /// @dev You can take an NFT into longterm rent - meaning you won't have to pay fees for each flashloan use. /// @dev You also get exclusivity - nobody else will be able to use it either while your rent lasts (even the original owner!) /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to rent /// @param maxPricePerBlock - Price the user is willing to pay per block for renting the NFT (protection from editing frontrunning) /// @param receiverAddress - Who will receive the longterm rent BorrowerNFT /// @param blocks - How many blocks you want to rent (price is calculated per-block) function longRent( address nftAddress, uint256 nftId, uint256 maxPricePerBlock, address receiverAddress, uint256 blocks ) external { BigPoolNFT memory bigPoolNFT = toBigPoolNFT(_poolNFTs[nftAddress][nftId]); // If pricePerBlock is 0 - longterm renting is disabled for this NFT require(bigPoolNFT.pricePerBlock > 0, "This NFT isn't available for longterm rent"); require(blocks <= bigPoolNFT.maxLongtermBlocks, "NFT can't be rented for that amount of time"); // We don't check for (blocks > 0) because we check it with (longtermPayment >= bigPoolNFT.flashFee) below updateLongRent(nftAddress, nftId); // Check if it's not in longterm rent already require(bigPoolNFT.inLongtermTillBlock < block.number, "Can't rent longterm because it's already rented"); require(bigPoolNFT.pricePerBlock <= maxPricePerBlock, "Can't rent the NFT with the selected price"); // Set a new blocknumber for longterm rent // This shouldn't overflow because we check (blocks <= maxLongtermBlocks) which is 24bit (16 777 215), // and inLongtermTillBlock is 32 bit (4 294 967 295). // So theoretically this will be allright until block 4278190080 - which is millenias ahead. bigPoolNFT.inLongtermTillBlock = block.number + blocks; uint256 longtermPayment = blocks * bigPoolNFT.pricePerBlock; // Protecting from cheaters who want to rent longterm for 1 block and pay less than a flash loan fee require(longtermPayment >= bigPoolNFT.flashFee, "Longterm rent can't be cheaper than flashloan"); // Pull the money from lender require(WETH9.transferFrom(msg.sender, address(this), longtermPayment), "Can't transfer WETH9 lender fees"); // Calculate the part of fee that goes to the pool (flashFee * poolFee) uint256 poolPart = (poolFee * longtermPayment) / 1e18; // Add poolPart to the pool Owner balance if it's more than zero if (poolPart > 0) earnings[owner()] += poolPart; // Add the rest (flashFee - calculatedPoolFee) to NFT owner's earnings earnings[ownerOf(bigPoolNFT.lenderNFTId)] += longtermPayment - poolPart; uint256 newNFTId = borrowerNFTCount + 1; borrowerNFTCount = newNFTId; bigPoolNFT.borrowerNFTId = newNFTId; _poolNFTs[nftAddress][nftId] = fromBigPoolNFT(bigPoolNFT); _safeMint(receiverAddress, newNFTId); emit LongtermRent(nftAddress, nftId, blocks, longtermPayment, newNFTId, msg.sender); } ///////////////////// // Admin Functions // ///////////////////// /// @dev Change the pool fee (admin only) /// @dev Only admin should be able to do that /// @dev Only once per block and for one percentage point - to prevent frontrunning /// @param newPoolFee - The new pool fee value (percentage, where 100% is 1e18) function changePoolFee(uint256 newPoolFee) external onlyOwner { uint256 diff = newPoolFee > poolFee ? (newPoolFee - poolFee) : (poolFee - newPoolFee); require(diff <= 1e16, "Can't change the pool fee more than one percentage point in one step"); require(block.number != poolFeeChangedAtBlock, "Can't change the pool fee more than once in a block"); poolFee = newPoolFee; poolFeeChangedAtBlock = block.number; emit PoolFeeChanged(newPoolFee); } /// @dev Propose a new owner, who will be able to claim ownership over this contract /// @param newOwner New owner who will be able to claim ownership over this contract function proposeNewOwner(address newOwner) external onlyOwner { proposedOwner = newOwner; } /// @dev Claims the ownership of the contract if msg.sender is proposedOwner function claimOwnership() external { require(msg.sender == proposedOwner, "Only proposed owner can claim the ownership"); Ownable._transferOwnership(msg.sender); } /////////////////////// // Utility Functions // /////////////////////// /// @dev Converts packed PoolNFT struct to unpacked BigPoolNFT struct (uint256) /// @param poolNFT packed PoolNFT struct /// @return unpacked BigPoolNFT struct function toBigPoolNFT(PoolNFT memory poolNFT) public pure returns (BigPoolNFT memory) { return BigPoolNFT( uint256(poolNFT.flashFee), uint256(poolNFT.pricePerBlock), uint256(poolNFT.maxLongtermBlocks), uint256(poolNFT.inLongtermTillBlock), uint256(poolNFT.borrowerNFTId), uint256(poolNFT.lenderNFTId) + 2**32 ); } /// @dev Converts unpacked BigPoolNFT struct (uint256) to packed PoolNFT struct /// @param bigPoolNFT unpacked BigPoolNFT struct /// @return packed PoolNFT struct function fromBigPoolNFT(BigPoolNFT memory bigPoolNFT) public pure returns (PoolNFT memory) { // Check for overflows before downcasting (yes, Solidity 0.8 still doesn't revert during downcast!) require(bigPoolNFT.flashFee <= type(uint72).max, "flashFee doesn't fit in uint72"); require(bigPoolNFT.pricePerBlock <= type(uint72).max, "pricePerBlock doesn't fit in uint72"); require(bigPoolNFT.maxLongtermBlocks <= type(uint24).max, "maxLongtermBlocks doesn't fit in uint24"); require(bigPoolNFT.inLongtermTillBlock <= type(uint32).max, "inLongtermTillBlock doesn't fit in uint32"); require(bigPoolNFT.borrowerNFTId <= type(uint32).max, "borrowerNFTId doesn't fit in uint32"); require(bigPoolNFT.lenderNFTId - 2**32 <= type(uint32).max, "lenderNFTId doesn't fit in uint32"); return PoolNFT( uint72(bigPoolNFT.flashFee), uint72(bigPoolNFT.pricePerBlock), uint24(bigPoolNFT.maxLongtermBlocks), uint32(bigPoolNFT.inLongtermTillBlock), uint32(bigPoolNFT.borrowerNFTId), uint32(bigPoolNFT.lenderNFTId - 2**32) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.9; interface INafta { event AddNFT( address nftAddress, uint256 nftId, uint256 flashFee, uint256 pricePerBlock, uint256 maxLongtermBlocks, uint256 lenderNFTId, address msgSender ); event EditNFT( address nftAddress, uint256 nftId, uint256 flashFee, uint256 pricePerBlock, uint256 maxLongtermBlocks, uint256 lenderNFTId, address msgSender ); event RemoveNFT(address nftAddress, uint256 nftId, uint256 lenderNFTId, address msgSender); event WithdrawEarnings(uint256 earnings, address msgSender); event Flashloan(address nftAddress, uint256 nftId, uint256 earnedFees, address msgSender); event PoolFeeChanged(uint256 newPoolFee); event LongtermRent(address nftAddress, uint256 nftId, uint256 blocks, uint256 earnedFees, uint256 borrowerNFTId, address msgSender); // NFT Struct in the Pool (optimized to fit within 256 bits) struct PoolNFT { uint72 flashFee; // 72 bit - up to 4722.36648 ETH // fee for a single rent in WETH, uint72 pricePerBlock; // 72 bit - up to 4722.36648 ETH // price per block of longterm rent (0 if not available) uint24 maxLongtermBlocks; // 24 bit - up to 16 777 215 blocks // maximum amount of blocks for longterm rent (0 if not available) uint32 inLongtermTillBlock; // 32 bit - up to block 4 294 967 295 // This NFT is in longterm rent till this block uint32 borrowerNFTId; // 32 bit - up to ID 4 294 967 296 // ID of BorrowerNFT uint32 lenderNFTId; // 32 bit - up to ID 4 294 967 296 // ID of LenderNFT (subtracted 2**32 to fit) } // BIG NFT Struct in the Pool (all values converted to uin256 for the ease of use) struct BigPoolNFT { uint256 flashFee; // originally 72 bit - up to 4722.36648 ETH // fee for a single rent in WETH, uint256 pricePerBlock; // originally 72 bit - up to 4722.36648 ETH // price per block of longterm rent (0 if not available) uint256 maxLongtermBlocks; // originally 24 bit - up to 16 777 215 blocks // maximum amount of blocks for longterm rent (0 if not available) uint256 inLongtermTillBlock; // originally 32 bit - up to block 4 294 967 295 // This NFT is in longterm rent till this block uint256 borrowerNFTId; // originally 32 bit - up to ID 4 294 967 296 // ID of BorrowerNFT uint256 lenderNFTId; // originally 32 bit - up to ID 4 294 967 296 // ID of LenderNFT (add 2**32 to separate from BorrowerNFT) } // Getters function earnings(address userAddress) external returns (uint256); function poolNFTs(address nftAddress, uint256 nftId) external view returns (PoolNFT memory nft); function poolFee() external view returns (uint256 poolFee); function poolFeeChangedAtBlock() external view returns (uint256 poolFeeChangedAtBlock); function proposedOwner() external view returns (address proposedOwner); function borrowerNFTCount() external view returns (uint256 borrowerNFTCount); function lenderNFTCount() external view returns (uint256 lenderNFTCount); //////////////////// // Pool functions // //////////////////// /// @dev Add your NFT to the pool // /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to add /// @param flashFee - The fee user has to pay for a single rent (in WETH) /// @param pricePerBlock - If renting longterm - this is the price per block (0 if not renting longterm) /// @param maxLongtermBlocks - Maximum amount of blocks for longterm rent function addNFT( address nftAddress, uint256 nftId, uint256 flashFee, uint256 pricePerBlock, uint256 maxLongtermBlocks ) external; /// @dev Edit your NFT prices // /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you have in the pool /// @param flashFee - The fee user has to pay for a single rent (in WETH) /// @param pricePerBlock - If renting longterm - this is the price per block (0 if not renting longterm) /// @param maxLongtermBlocks - Maximum amount of blocks for longterm rent function editNFT( address nftAddress, uint256 nftId, uint256 flashFee, uint256 pricePerBlock, uint256 maxLongtermBlocks ) external; /// @dev Remove your NFT from the pool with earnings // /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to remove function removeNFT(address nftAddress, uint256 nftId) external; /// @dev Withdraw your earnings function withdrawEarnings() external; /// @dev Execute a Flashloan of NFT // /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to flashloan /// @param maxLoanPrice - Price the user is willing to pay for the flashloan /// @param receiverAddress - the contract that will receive the NFT (has to implement INFTFlashLoanReceiver interface) /// @param data - calldata that will be passed to the receiver contract (optional) function flashloan( address nftAddress, uint256 nftId, uint256 maxLoanPrice, address receiverAddress, bytes calldata data ) external; /////////////// // Flashlong // /////////////// /// @dev Utility function to update the status of longterm rent /// @dev Is called in some functions as well as can be called by public /// @dev will burn the BorrowerNFT if the longterm rent is over // /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to update function updateLongRent(address nftAddress, uint256 nftId) external; /// @dev You can buy a longterm rent for any NFT and don't pay fees for each use, and nobody else will be able to lend it while your rent lasts // /// @param nftAddress - The address of NFT contract /// @param nftId - ID of the NFT token you want to rent /// @param maxPricePerBlock - Price the user is willing to pay per block for renting the NFT /// @param receiverAddress - Who will receive the longterm rent BorrowerNFT /// @param blocks - How many blocks you want to rent (price is calculated per-block) function longRent( address nftAddress, uint256 nftId, uint256 maxPricePerBlock, address receiverAddress, uint256 blocks ) external; ///////////////////// // Admin Functions // ///////////////////// /// @dev Change the pool fee (admin only) /// @dev Only admin should be able to do that // /// @param newPoolFee - The new pool fee value (percentage) function changePoolFee(uint256 newPoolFee) external; /// @dev Propose a new owner, who will be able to claim ownership over this contract /// @param newOwner New owner who will be able to claim ownership over this contract function proposeNewOwner(address newOwner) external; /// @dev Claims the ownership of the contract if msg.sender is proposedOwner function claimOwnership() external; }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.9; import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; interface IFlashNFTReceiver is IERC721Receiver { function executeOperation(address nftAddress, uint256 nftId, uint256 feeInWeth, address msgSender, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (token/ERC721/utils/ERC721Holder.sol) pragma solidity ^0.8.0; import "../IERC721Receiver.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721Holder is IERC721Receiver { /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address, address, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (utils/Address.sol) 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) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0-rc.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
{ "optimizer": { "enabled": true, "runs": 999999 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"contract IERC20","name":"WETH9_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flashFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pricePerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxLongtermBlocks","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lenderNFTId","type":"uint256"},{"indexed":false,"internalType":"address","name":"msgSender","type":"address"}],"name":"AddNFT","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":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flashFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pricePerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxLongtermBlocks","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lenderNFTId","type":"uint256"},{"indexed":false,"internalType":"address","name":"msgSender","type":"address"}],"name":"EditNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"earnedFees","type":"uint256"},{"indexed":false,"internalType":"address","name":"msgSender","type":"address"}],"name":"Flashloan","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blocks","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"earnedFees","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"borrowerNFTId","type":"uint256"},{"indexed":false,"internalType":"address","name":"msgSender","type":"address"}],"name":"LongtermRent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPoolFee","type":"uint256"}],"name":"PoolFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lenderNFTId","type":"uint256"},{"indexed":false,"internalType":"address","name":"msgSender","type":"address"}],"name":"RemoveNFT","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":"uint256","name":"earnings","type":"uint256"},{"indexed":false,"internalType":"address","name":"msgSender","type":"address"}],"name":"WithdrawEarnings","type":"event"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"flashFee","type":"uint256"},{"internalType":"uint256","name":"pricePerBlock","type":"uint256"},{"internalType":"uint256","name":"maxLongtermBlocks","type":"uint256"}],"name":"addNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"borrowerNFTCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPoolFee","type":"uint256"}],"name":"changePoolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"earnings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"flashFee","type":"uint256"},{"internalType":"uint256","name":"pricePerBlock","type":"uint256"},{"internalType":"uint256","name":"maxLongtermBlocks","type":"uint256"}],"name":"editNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"maxLoanPrice","type":"uint256"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"flashloan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"flashFee","type":"uint256"},{"internalType":"uint256","name":"pricePerBlock","type":"uint256"},{"internalType":"uint256","name":"maxLongtermBlocks","type":"uint256"},{"internalType":"uint256","name":"inLongtermTillBlock","type":"uint256"},{"internalType":"uint256","name":"borrowerNFTId","type":"uint256"},{"internalType":"uint256","name":"lenderNFTId","type":"uint256"}],"internalType":"struct INafta.BigPoolNFT","name":"bigPoolNFT","type":"tuple"}],"name":"fromBigPoolNFT","outputs":[{"components":[{"internalType":"uint72","name":"flashFee","type":"uint72"},{"internalType":"uint72","name":"pricePerBlock","type":"uint72"},{"internalType":"uint24","name":"maxLongtermBlocks","type":"uint24"},{"internalType":"uint32","name":"inLongtermTillBlock","type":"uint32"},{"internalType":"uint32","name":"borrowerNFTId","type":"uint32"},{"internalType":"uint32","name":"lenderNFTId","type":"uint32"}],"internalType":"struct INafta.PoolNFT","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lenderNFTCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"maxPricePerBlock","type":"uint256"},{"internalType":"address","name":"receiverAddress","type":"address"},{"internalType":"uint256","name":"blocks","type":"uint256"}],"name":"longRent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolFeeChangedAtBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"poolNFTs","outputs":[{"components":[{"internalType":"uint72","name":"flashFee","type":"uint72"},{"internalType":"uint72","name":"pricePerBlock","type":"uint72"},{"internalType":"uint24","name":"maxLongtermBlocks","type":"uint24"},{"internalType":"uint32","name":"inLongtermTillBlock","type":"uint32"},{"internalType":"uint32","name":"borrowerNFTId","type":"uint32"},{"internalType":"uint32","name":"lenderNFTId","type":"uint32"}],"internalType":"struct INafta.PoolNFT","name":"nft","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"proposeNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proposedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"removeNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","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":[{"components":[{"internalType":"uint72","name":"flashFee","type":"uint72"},{"internalType":"uint72","name":"pricePerBlock","type":"uint72"},{"internalType":"uint24","name":"maxLongtermBlocks","type":"uint24"},{"internalType":"uint32","name":"inLongtermTillBlock","type":"uint32"},{"internalType":"uint32","name":"borrowerNFTId","type":"uint32"},{"internalType":"uint32","name":"lenderNFTId","type":"uint32"}],"internalType":"struct INafta.PoolNFT","name":"poolNFT","type":"tuple"}],"name":"toBigPoolNFT","outputs":[{"components":[{"internalType":"uint256","name":"flashFee","type":"uint256"},{"internalType":"uint256","name":"pricePerBlock","type":"uint256"},{"internalType":"uint256","name":"maxLongtermBlocks","type":"uint256"},{"internalType":"uint256","name":"inLongtermTillBlock","type":"uint256"},{"internalType":"uint256","name":"borrowerNFTId","type":"uint256"},{"internalType":"uint256","name":"lenderNFTId","type":"uint256"}],"internalType":"struct INafta.BigPoolNFT","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"},{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"updateLongRent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawEarnings","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040526000600c55640100000000600d553480156200001f57600080fd5b5060405162005703380380620057038339810160408190526200004291620002d5565b60408051808201825260088152671398599d1853919560c21b6020808301918252835180850190945260058452644e4146544160d81b9084015281519192916200008f9160009162000219565b508051620000a590600190602084019062000219565b505050620000c2620000bc620000ee60201b60201c565b620000f2565b6001600160a01b038116608052620000e68262000144602090811b620039cd17901c565b505062000351565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6006546001600160a01b03163314620001a45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b0381166200020b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016200019b565b6200021681620000f2565b50565b828054620002279062000314565b90600052602060002090601f0160209004810192826200024b576000855562000296565b82601f106200026657805160ff191683800117855562000296565b8280016001018555821562000296579182015b828111156200029657825182559160200191906001019062000279565b50620002a4929150620002a8565b5090565b5b80821115620002a45760008155600101620002a9565b6001600160a01b03811681146200021657600080fd5b60008060408385031215620002e957600080fd5b8251620002f681620002bf565b60208401519092506200030981620002bf565b809150509250929050565b600181811c908216806200032957607f821691505b602082108114156200034b57634e487b7160e01b600052602260045260246000fd5b50919050565b6080516153886200037b6000396000818161104a01528181612d30015261324301526153886000f3fe608060405234801561001057600080fd5b506004361061025c5760003560e01c8063715018a611610145578063b73c6ce9116100bd578063c94c9c921161008c578063e985e9c511610071578063e985e9c5146106e4578063f2fde38b1461072d578063ffc3fddd1461074057600080fd5b8063c94c9c92146106bb578063d153b60c146106c457600080fd5b8063b73c6ce91461067a578063b779cf9614610682578063b88d4fde14610695578063c87b56dd146106a857600080fd5b806395d89b41116101145780639c3d550c116100f95780639c3d550c1461064b578063a22cb46514610654578063b1f8100d1461066757600080fd5b806395d89b41146106305780639b9c72461461063857600080fd5b8063715018a6146105e45780637bbdb7da146105ec5780638d7901bd146105ff5780638da5cb5b1461061257600080fd5b806323b872dd116101d85780634e71e0c8116101a7578063543fd3131161018c578063543fd3131461059e5780636352211e146105be57806370a08231146105d157600080fd5b80634e71e0c81461058357806352d1976a1461058b57600080fd5b806323b872dd146103c157806342842e0e146103d4578063469e1322146103e757806349fd566b1461057057600080fd5b8063095ea7b31161022f578063150b7a0211610214578063150b7a021461030b57806317f750221461034f5780631ba66405146103ae57600080fd5b8063095ea7b3146102ed5780630e8ffd531461030257600080fd5b806301ffc9a71461026157806306fdde0314610289578063081812fc1461029e578063089fe6aa146102d6575b600080fd5b61027461026f366004614a8f565b610753565b60405190151581526020015b60405180910390f35b610291610838565b6040516102809190614b22565b6102b16102ac366004614b35565b6108ca565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610280565b6102df60095481565b604051908152602001610280565b6103006102fb366004614b70565b6109a9565b005b6102df600a5481565b61031e610319366004614c43565b610b36565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610280565b61036261035d366004614d57565b610b60565b6040516102809190600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b6103006103bc366004614de2565b610c20565b6103006103cf366004614e34565b61147f565b6103006103e2366004614e34565b611520565b6105026103f5366004614b70565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091525073ffffffffffffffffffffffffffffffffffffffff909116600090815260076020908152604080832093835292815290829020825160c081018452815468ffffffffffffffffff808216835269010000000000000000008204169382019390935262ffffff72010000000000000000000000000000000000008404169381019390935263ffffffff750100000000000000000000000000000000000000000083048116606085015279010000000000000000000000000000000000000000000000000090920482166080840152600101541660a082015290565b6040516102809190600060c08201905068ffffffffffffffffff8084511683528060208501511660208401525062ffffff6040840151166040830152606083015163ffffffff80821660608501528060808601511660808501528060a08601511660a0850152505092915050565b61030061057e366004614b70565b61153b565b6103006118ff565b610300610599366004614e75565b6119b1565b6102df6105ac366004614eb9565b60086020526000908152604090205481565b6102b16105cc366004614b35565b611e19565b6102df6105df366004614eb9565b611ecb565b610300611f99565b6105026105fa366004614ed6565b612024565b61030061060d366004614b70565b61245e565b60065473ffffffffffffffffffffffffffffffffffffffff166102b1565b610291612723565b610300610646366004614f30565b612732565b6102df600d5481565b610300610662366004614fe8565b613097565b610300610675366004614eb9565b6130a6565b61030061316e565b610300610690366004614e75565b613351565b6103006106a3366004614c43565b613808565b6102916106b6366004614b35565b6138b0565b6102df600c5481565b600b546102b19073ffffffffffffffffffffffffffffffffffffffff1681565b6102746106f2366004615021565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260056020908152604080832093909416825291909152205460ff1690565b61030061073b366004614eb9565b6139cd565b61030061074e366004614b35565b613afd565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806107e657507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061083257507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600080546108479061504f565b80601f01602080910402602001604051908101604052809291908181526020018280546108739061504f565b80156108c05780601f10610895576101008083540402835291602001916108c0565b820191906000526020600020905b8154815290600101906020018083116108a357829003601f168201915b5050505050905090565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff16610980576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060009081526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006109b482611e19565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a72576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610977565b3373ffffffffffffffffffffffffffffffffffffffff82161480610a9b5750610a9b81336106f2565b610b27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610977565b610b318383613d3b565b505050565b7f150b7a02000000000000000000000000000000000000000000000000000000005b949350505050565b610b996040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060c00160405280836000015168ffffffffffffffffff168152602001836020015168ffffffffffffffffff168152602001836040015162ffffff168152602001836060015163ffffffff168152602001836080015163ffffffff1681526020018360a0015163ffffffff16640100000000610c1891906150d2565b905292915050565b73ffffffffffffffffffffffffffffffffffffffff851660009081526007602090815260408083208784528252808320815160c081018352815468ffffffffffffffffff808216835269010000000000000000008204169482019490945262ffffff72010000000000000000000000000000000000008504169281019290925263ffffffff7501000000000000000000000000000000000000000000840481166060840152790100000000000000000000000000000000000000000000000000909304831660808301526001015490911660a0820152610cff90610b60565b90506000816020015111610d95576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54686973204e46542069736e277420617661696c61626c6520666f72206c6f6e60448201527f677465726d2072656e74000000000000000000000000000000000000000000006064820152608401610977565b8060400151821115610e29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4e46542063616e27742062652072656e74656420666f72207468617420616d6f60448201527f756e74206f662074696d650000000000000000000000000000000000000000006064820152608401610977565b610e33868661245e565b43816060015110610ec6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f43616e27742072656e74206c6f6e677465726d2062656361757365206974277360448201527f20616c72656164792072656e74656400000000000000000000000000000000006064820152608401610977565b8381602001511115610f5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f43616e27742072656e7420746865204e46542077697468207468652073656c6560448201527f63746564207072696365000000000000000000000000000000000000000000006064820152608401610977565b610f6482436150d2565b60608201526020810151600090610f7b90846150ea565b825190915081101561100f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f4c6f6e677465726d2072656e742063616e27742062652063686561706572207460448201527f68616e20666c6173686c6f616e000000000000000000000000000000000000006064820152608401610977565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303816000875af11580156110a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cc9190615127565b611132576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f43616e2774207472616e73666572205745544839206c656e64657220666565736044820152606401610977565b6000670de0b6b3a76400008260095461114b91906150ea565b6111559190615173565b905080156111d057806008600061118160065473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111ca91906150d2565b90915550505b6111da8183615187565b600860006111eb8660a00151611e19565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461123491906150d2565b9091555050600c5460009061124a9060016150d2565b600c81905560808501819052905061126184612024565b73ffffffffffffffffffffffffffffffffffffffff8a1660009081526007602090815260408083208c84528252918290208351815492850151938501516060860151608087015168ffffffffffffffffff9384167fffffffffffffffffffffffffffff0000000000000000000000000000000000009096169590951769010000000000000000009390961692909202949094177fffffffffffffff00000000000000ffffffffffffffffffffffffffffffffffff16720100000000000000000000000000000000000062ffffff909516949094027fffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffff1693909317750100000000000000000000000000000000000000000063ffffffff94851602177fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff167901000000000000000000000000000000000000000000000000009284169290920291909117815560a090920151600190920180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000016929091169190911790556114098682613ddb565b6040805173ffffffffffffffffffffffffffffffffffffffff8b168152602081018a905290810186905260608101849052608081018290523360a08201527fbb7c4e46b4b8b3736a5f0db61bd74377c6338dca392b4167a7fe36de7737f7c89060c00160405180910390a1505050505050505050565b6114893382613df5565b611515576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610977565b610b31838383613f61565b610b3183838360405180602001604052806000815250613808565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602090815260408083208484528252808320815160c081018352815468ffffffffffffffffff808216835269010000000000000000008204169482019490945262ffffff72010000000000000000000000000000000000008504169281019290925263ffffffff7501000000000000000000000000000000000000000000840481166060840152790100000000000000000000000000000000000000000000000000909304831660808301526001015490911660a082015261161a90610b60565b90503373ffffffffffffffffffffffffffffffffffffffff166116408260a00151611e19565b73ffffffffffffffffffffffffffffffffffffffff16146116e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4f6e6c79206f776e6572206f662074686520636f72726573706f6e64696e672060448201527f4c656e6465724e46542063616e2063616c6c20746869730000000000000000006064820152608401610977565b43816060015110611776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f43616e27742072656d6f7665204e46542066726f6d2074686520706f6f6c207760448201527f68696c6520696e206c6f6e677465726d2072656e7400000000000000000000006064820152608401610977565b611780838361245e565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600760209081526040808320858452909152902080547fffffff000000000000000000000000000000000000000000000000000000000016815560010180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000016905560a081015161180d906141c8565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201523360248201526044810183905273ffffffffffffffffffffffffffffffffffffffff8416906342842e0e90606401600060405180830381600087803b15801561188157600080fd5b505af1158015611895573d6000803e3d6000fd5b5050505060a08101516040805173ffffffffffffffffffffffffffffffffffffffff861681526020810185905280820192909252336060830152517fb2052cb24ccf368bd2f25dc5469a503f8cee339635f7391c0b72cce58b8f1fc69181900360800190a1505050565b600b5473ffffffffffffffffffffffffffffffffffffffff1633146119a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f6e6c792070726f706f736564206f776e65722063616e20636c61696d20746860448201527f65206f776e6572736869700000000000000000000000000000000000000000006064820152608401610977565b6119af33614295565b565b8115806119c75750826119c483836150ea565b10155b611a53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4d6178204c6f6e677465726d2072656e742063616e277420626520636865617060448201527f6572207468616e20666c6173686c6f616e0000000000000000000000000000006064820152608401610977565b73ffffffffffffffffffffffffffffffffffffffff851660009081526007602090815260408083208784528252808320815160c081018352815468ffffffffffffffffff808216835269010000000000000000008204169482019490945262ffffff72010000000000000000000000000000000000008504169281019290925263ffffffff7501000000000000000000000000000000000000000000840481166060840152790100000000000000000000000000000000000000000000000000909304831660808301526001015490911660a0820152611b3290610b60565b90503373ffffffffffffffffffffffffffffffffffffffff16611b588260a00151611e19565b73ffffffffffffffffffffffffffffffffffffffff1614611bfb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4f6e6c79206f776e6572206f662074686520636f72726573706f6e64696e672060448201527f4c656e6465724e46542063616e2063616c6c20746869730000000000000000006064820152608401610977565b8381526020810183905260408101829052611c1581612024565b73ffffffffffffffffffffffffffffffffffffffff871660008181526007602090815260408083208a84528252918290208451815486840151878601516060808a01516080808c015168ffffffffffffffffff9788167fffffffffffffffffffffffffffff0000000000000000000000000000000000009097169690961769010000000000000000009790951696909602939093177fffffffffffffff00000000000000ffffffffffffffffffffffffffffffffffff16720100000000000000000000000000000000000062ffffff909316929092027fffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffff1691909117750100000000000000000000000000000000000000000063ffffffff93841602177fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff167901000000000000000000000000000000000000000000000000009383169390930292909217845560a097880151600190940180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001694909116939093179092558686015184519586529285018b90529284018990528301879052908201859052918101919091523360c08201527ffd7cc319d4c8a3dc9db454b72f8daf14ed6b258a029fbd80efb88d7015c5ea729060e0015b60405180910390a1505050505050565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610832576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610977565b600073ffffffffffffffffffffffffffffffffffffffff8216611f70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610977565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b60065473ffffffffffffffffffffffffffffffffffffffff16331461201a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610977565b6119af6000614295565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a0810191909152815168ffffffffffffffffff10156120ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f666c61736846656520646f65736e27742066697420696e2075696e74373200006044820152606401610977565b602082015168ffffffffffffffffff1015612167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f7072696365506572426c6f636b20646f65736e27742066697420696e2075696e60448201527f74373200000000000000000000000000000000000000000000000000000000006064820152608401610977565b604082015162ffffff10156121fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f6d61784c6f6e677465726d426c6f636b7320646f65736e27742066697420696e60448201527f2075696e743234000000000000000000000000000000000000000000000000006064820152608401610977565b606082015163ffffffff1015612296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f696e4c6f6e677465726d54696c6c426c6f636b20646f65736e2774206669742060448201527f696e2075696e74333200000000000000000000000000000000000000000000006064820152608401610977565b608082015163ffffffff101561232e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f626f72726f7765724e4654496420646f65736e27742066697420696e2075696e60448201527f74333200000000000000000000000000000000000000000000000000000000006064820152608401610977565b60a082015163ffffffff906123499064010000000090615187565b11156123d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f6c656e6465724e4654496420646f65736e27742066697420696e2075696e743360448201527f32000000000000000000000000000000000000000000000000000000000000006064820152608401610977565b6040518060c00160405280836000015168ffffffffffffffffff168152602001836020015168ffffffffffffffffff168152602001836040015162ffffff168152602001836060015163ffffffff168152602001836080015163ffffffff1681526020016401000000008460a001516124509190615187565b63ffffffff16905292915050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526007602090815260408083208484528252808320815160c081018352815468ffffffffffffffffff808216835269010000000000000000008204169482019490945262ffffff72010000000000000000000000000000000000008504169281019290925263ffffffff7501000000000000000000000000000000000000000000840481166060840152790100000000000000000000000000000000000000000000000000909304831660808301526001015490911660a082015261253d90610b60565b9050600081606001511180156125565750438160600151105b15610b315761256881608001516141c8565b600060808201819052606082015261257f81612024565b73ffffffffffffffffffffffffffffffffffffffff939093166000908152600760209081526040808320948352938152908390208451815492860151948601516060870151608088015168ffffffffffffffffff9384167fffffffffffffffffffffffffffff0000000000000000000000000000000000009096169590951769010000000000000000009390971692909202959095177fffffffffffffff00000000000000ffffffffffffffffffffffffffffffffffff16720100000000000000000000000000000000000062ffffff909616959095027fffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffff1694909417750100000000000000000000000000000000000000000063ffffffff95861602177fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff167901000000000000000000000000000000000000000000000000009285169290920291909117815560a090930151600190930180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000169390921692909217905550565b6060600180546108479061504f565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101869052309073ffffffffffffffffffffffffffffffffffffffff881690636352211e90602401602060405180830381865afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c3919061519e565b73ffffffffffffffffffffffffffffffffffffffff1614612840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4e46542073686f756c6420626520696e2074686520706f6f6c000000000000006044820152606401610977565b61284a868661245e565b73ffffffffffffffffffffffffffffffffffffffff861660009081526007602090815260408083208884528252808320815160c081018352815468ffffffffffffffffff808216835269010000000000000000008204169482019490945262ffffff72010000000000000000000000000000000000008504169281019290925263ffffffff7501000000000000000000000000000000000000000000840481166060840152790100000000000000000000000000000000000000000000000000909304831660808301526001015490911660a082015261292990610b60565b60608101519091504311801590612a27573373ffffffffffffffffffffffffffffffffffffffff1661295e8360800151611e19565b73ffffffffffffffffffffffffffffffffffffffff1614612a27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605f60248201527f54686973204e465420697320696e206c6f6e677465726d2072656e74202d207960448201527f6f752063616e277420666c6173686c6f616e20697420756e6c65737320796f7560648201527f206861766520636f72726573706f6e64696e6720426f72726f7765724e465400608482015260a401610977565b600081612a35578251612a38565b60005b905086811115612aca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603460248201527f596f752063616e27742074616b652074686520666c6173686c6f616e20666f7260448201527f2074686520696e646963617465642070726963650000000000000000000000006064820152608401610977565b6040517f42842e0e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8088166024830152604482018a90528791908b16906342842e0e90606401600060405180830381600087803b158015612b4357600080fd5b505af1158015612b57573d6000803e3d6000fd5b50506040517f1b11d0ff00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169250631b11d0ff9150612bb7908d908d90879033908d908d906004016151bb565b6020604051808303816000875af1158015612bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfa9190615127565b612c60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4572726f7220647572696e6720466c6173684e465420457865637574696f6e006044820152606401610977565b6040517f42842e0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152306024830152604482018b90528b16906342842e0e90606401600060405180830381600087803b158015612cd657600080fd5b505af1158015612cea573d6000803e3d6000fd5b505050508280612db257506040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303816000875af1158015612d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612db29190615127565b612e18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f43616e2774207472616e73666572205745544839206c656e64657220666565736044820152606401610977565b6000670de0b6b3a764000083600954612e3191906150ea565b612e3b9190615173565b90508015612eb6578060086000612e6760065473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612eb091906150d2565b90915550505b612ec08184615187565b60086000612ed18860a00151611e19565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612f1a91906150d2565b90915550506040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018b9052309073ffffffffffffffffffffffffffffffffffffffff8d1690636352211e90602401602060405180830381865afa158015612f8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb0919061519e565b73ffffffffffffffffffffffffffffffffffffffff161461302d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4e46542073686f756c6420626520696e2074686520706f6f6c000000000000006044820152606401610977565b6040805173ffffffffffffffffffffffffffffffffffffffff8d168152602081018c90529081018490523360608201527ff9e53c874eda21d24939d6e987e2c85a32d19fc83535a302b9214132182384b09060800160405180910390a15050505050505050505050565b6130a233838361430c565b5050565b60065473ffffffffffffffffffffffffffffffffffffffff163314613127576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610977565b600b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b33600090815260086020526040902054806131e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4e6f206561726e696e677320746f2077697468647261770000000000000000006044820152606401610977565b3360008181526008602052604080822091909155517fa9059cbb00000000000000000000000000000000000000000000000000000000815260048101919091526024810182905273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af115801561328c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132b09190615127565b613316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5745544839207472616e73666572206661696c656400000000000000000000006044820152606401610977565b604080518281523360208201527f2c459af5dbdc73e026e5e2d6c3e8c986fd1eb66e32969a0ccf39c65fb39d21ca910160405180910390a150565b73ffffffffffffffffffffffffffffffffffffffff85163014156133d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f43616e277420616464204e61667461204e46547320746f204e616674610000006044820152606401610977565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260076020908152604080832087845290915290206001015463ffffffff1615613472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4e465420697320616c726561647920696e2074686520506f6f6c0000000000006044820152606401610977565b81158061348857508261348583836150ea565b10155b613514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4d6178204c6f6e677465726d2072656e742063616e277420626520636865617060448201527f6572207468616e20666c6173686c6f616e0000000000000000000000000000006064820152608401610977565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523360048201523060248201526044810185905273ffffffffffffffffffffffffffffffffffffffff8616906342842e0e90606401600060405180830381600087803b15801561358857600080fd5b505af115801561359c573d6000803e3d6000fd5b505050506000600d5460016135b191906150d2565b905080600d819055506135f16040518060c00160405280868152602001858152602001848152602001600081526020016000815260200183815250612024565b73ffffffffffffffffffffffffffffffffffffffff871660009081526007602090815260408083208984528252918290208351815492850151938501516060860151608087015168ffffffffffffffffff9384167fffffffffffffffffffffffffffff0000000000000000000000000000000000009096169590951769010000000000000000009390961692909202949094177fffffffffffffff00000000000000ffffffffffffffffffffffffffffffffffff16720100000000000000000000000000000000000062ffffff909516949094027fffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffffff1693909317750100000000000000000000000000000000000000000063ffffffff94851602177fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff167901000000000000000000000000000000000000000000000000009284169290920291909117815560a090920151600190920180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000016929091169190911790556137993382613ddb565b6040805173ffffffffffffffffffffffffffffffffffffffff8816815260208101879052908101859052606081018490526080810183905260a081018290523360c08201527fc1f7d9ccf422fe4ae58ca35f2092340ffc9dc7bd649881994a86512d986215469060e001611e09565b6138123383613df5565b61389e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610977565b6138aa8484848461443a565b50505050565b60008181526002602052604090205460609073ffffffffffffffffffffffffffffffffffffffff16613964576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610977565b600061397b60408051602081019091526000815290565b9050600081511161399b57604051806020016040528060008152506139c6565b806139a5846144dd565b6040516020016139b6929190615241565b6040516020818303038152906040525b9392505050565b60065473ffffffffffffffffffffffffffffffffffffffff163314613a4e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610977565b73ffffffffffffffffffffffffffffffffffffffff8116613af1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610977565b613afa81614295565b50565b60065473ffffffffffffffffffffffffffffffffffffffff163314613b7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610977565b60006009548211613b9c5781600954613b979190615187565b613ba9565b600954613ba99083615187565b9050662386f26fc10000811115613c69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526044602482018190527f43616e2774206368616e67652074686520706f6f6c20666565206d6f72652074908201527f68616e206f6e652070657263656e7461676520706f696e7420696e206f6e652060648201527f7374657000000000000000000000000000000000000000000000000000000000608482015260a401610977565b600a54431415613cfb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f43616e2774206368616e67652074686520706f6f6c20666565206d6f7265207460448201527f68616e206f6e636520696e206120626c6f636b000000000000000000000000006064820152608401610977565b600982905543600a556040518281527fd1d8d097d1660cb81b6153e880952b8eedb2818c55f0d2b750bea21d98ef26c59060200160405180910390a15050565b600081815260046020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091558190613d9582611e19565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6130a282826040518060200160405280600081525061460f565b60008181526002602052604081205473ffffffffffffffffffffffffffffffffffffffff16613ea6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610977565b6000613eb183611e19565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480613f2057508373ffffffffffffffffffffffffffffffffffffffff16613f08846108ca565b73ffffffffffffffffffffffffffffffffffffffff16145b80610b58575073ffffffffffffffffffffffffffffffffffffffff80821660009081526005602090815260408083209388168352929052205460ff16610b58565b8273ffffffffffffffffffffffffffffffffffffffff16613f8182611e19565b73ffffffffffffffffffffffffffffffffffffffff1614614024576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610977565b73ffffffffffffffffffffffffffffffffffffffff82166140c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610977565b6140d1600082613d3b565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120805460019290614107908490615187565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081208054600192906141429084906150d2565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006141d382611e19565b90506141e0600083613d3b565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600360205260408120805460019290614216908490615187565b909155505060008281526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555183919073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6006805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156143a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610977565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b614445848484613f61565b614451848484846146b2565b6138aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610977565b60608161451d57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115614547578061453181615270565b91506145409050600a83615173565b9150614521565b60008167ffffffffffffffff81111561456257614562614b9c565b6040519080825280601f01601f19166020018201604052801561458c576020820181803683370190505b5090505b8415610b58576145a1600183615187565b91506145ae600a866152a9565b6145b99060306150d2565b60f81b8183815181106145ce576145ce6152bd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350614608600a86615173565b9450614590565b614619838361489f565b61462660008484846146b2565b610b31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610977565b600073ffffffffffffffffffffffffffffffffffffffff84163b15614897576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a02906147299033908990889088906004016152ec565b6020604051808303816000875af1925050508015614782575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261477f91810190615335565b60015b61484c573d8080156147b0576040519150601f19603f3d011682016040523d82523d6000602084013e6147b5565b606091505b508051614844576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610977565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050610b58565b506001610b58565b73ffffffffffffffffffffffffffffffffffffffff821661491c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610977565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16156149a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610977565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081208054600192906149de9084906150d2565b909155505060008181526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114613afa57600080fd5b600060208284031215614aa157600080fd5b81356139c681614a61565b60005b83811015614ac7578181015183820152602001614aaf565b838111156138aa5750506000910152565b60008151808452614af0816020860160208601614aac565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006139c66020830184614ad8565b600060208284031215614b4757600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114613afa57600080fd5b60008060408385031215614b8357600080fd5b8235614b8e81614b4e565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715614bee57614bee614b9c565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715614c3b57614c3b614b9c565b604052919050565b60008060008060808587031215614c5957600080fd5b8435614c6481614b4e565b9350602085810135614c7581614b4e565b935060408601359250606086013567ffffffffffffffff80821115614c9957600080fd5b818801915088601f830112614cad57600080fd5b813581811115614cbf57614cbf614b9c565b614cef847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601614bf4565b91508082528984828501011115614d0557600080fd5b808484018584013760008482840101525080935050505092959194509250565b803568ffffffffffffffffff81168114614d3e57600080fd5b919050565b803563ffffffff81168114614d3e57600080fd5b600060c08284031215614d6957600080fd5b614d71614bcb565b614d7a83614d25565b8152614d8860208401614d25565b6020820152604083013562ffffff81168114614da357600080fd5b6040820152614db460608401614d43565b6060820152614dc560808401614d43565b6080820152614dd660a08401614d43565b60a08201529392505050565b600080600080600060a08688031215614dfa57600080fd5b8535614e0581614b4e565b945060208601359350604086013592506060860135614e2381614b4e565b949793965091946080013592915050565b600080600060608486031215614e4957600080fd5b8335614e5481614b4e565b92506020840135614e6481614b4e565b929592945050506040919091013590565b600080600080600060a08688031215614e8d57600080fd5b8535614e9881614b4e565b97602087013597506040870135966060810135965060800135945092505050565b600060208284031215614ecb57600080fd5b81356139c681614b4e565b600060c08284031215614ee857600080fd5b614ef0614bcb565b823581526020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201528091505092915050565b60008060008060008060a08789031215614f4957600080fd5b8635614f5481614b4e565b955060208701359450604087013593506060870135614f7281614b4e565b9250608087013567ffffffffffffffff80821115614f8f57600080fd5b818901915089601f830112614fa357600080fd5b813581811115614fb257600080fd5b8a6020828501011115614fc457600080fd5b6020830194508093505050509295509295509295565b8015158114613afa57600080fd5b60008060408385031215614ffb57600080fd5b823561500681614b4e565b9150602083013561501681614fda565b809150509250929050565b6000806040838503121561503457600080fd5b823561503f81614b4e565b9150602083013561501681614b4e565b600181811c9082168061506357607f821691505b6020821081141561509d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156150e5576150e56150a3565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615122576151226150a3565b500290565b60006020828403121561513957600080fd5b81516139c681614fda565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261518257615182615144565b500490565b600082821015615199576151996150a3565b500390565b6000602082840312156151b057600080fd5b81516139c681614b4e565b600073ffffffffffffffffffffffffffffffffffffffff808916835287602084015286604084015280861660608401525060a060808301528260a0830152828460c0840137600060c0848401015260c07fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8501168301019050979650505050505050565b60008351615253818460208801614aac565b835190830190615267818360208801614aac565b01949350505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156152a2576152a26150a3565b5060010190565b6000826152b8576152b8615144565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600073ffffffffffffffffffffffffffffffffffffffff80871683528086166020840152508360408301526080606083015261532b6080830184614ad8565b9695505050505050565b60006020828403121561534757600080fd5b81516139c681614a6156fea2646970667358221220a80095ea9cf2ad146fb303722b84d59b4ec324e5bb999b0b9e67da5220864df064736f6c634300080a003300000000000000000000000015886ae5a4d6e2fa3ff385a3de57e87b57638f71000000000000000000000000f4cf9f21d34bbeeaab3827bfd2d7aa03aec7de4b
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000015886ae5a4d6e2fa3ff385a3de57e87b57638f71000000000000000000000000f4cf9f21d34bbeeaab3827bfd2d7aa03aec7de4b
-----Decoded View---------------
Arg [0] : owner_ (address): 0x15886ae5a4d6e2fa3ff385a3de57e87b57638f71
Arg [1] : WETH9_ (address): 0xf4cf9f21d34bbeeaab3827bfd2d7aa03aec7de4b
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000015886ae5a4d6e2fa3ff385a3de57e87b57638f71
Arg [1] : 000000000000000000000000f4cf9f21d34bbeeaab3827bfd2d7aa03aec7de4b
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.