Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Decrease Allowan... | 15101137 | 929 days ago | IN | 0 ETH | 0.00046638 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
13315618 | 1212 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Name:
TokenVault
Compiler Version
v0.8.5+commit.a4f2e591
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Interfaces/IWETH.sol"; import "./OpenZeppelin/math/Math.sol"; import "./OpenZeppelin/token/ERC20/ERC20.sol"; import "./OpenZeppelin/token/ERC721/ERC721.sol"; import "./OpenZeppelin/token/ERC721/ERC721Holder.sol"; import "./Settings.sol"; import "./OpenZeppelin/upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol"; import "./OpenZeppelin/upgradeable/token/ERC20/ERC20Upgradeable.sol"; contract TokenVault is ERC20Upgradeable, ERC721HolderUpgradeable { using Address for address; /// ----------------------------------- /// -------- BASIC INFORMATION -------- /// ----------------------------------- /// @notice weth address address public constant weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// ----------------------------------- /// -------- TOKEN INFORMATION -------- /// ----------------------------------- /// @notice the ERC721 token address of the vault's token address public token; /// @notice the ERC721 token ID of the vault's token uint256 public id; /// ------------------------------------- /// -------- AUCTION INFORMATION -------- /// ------------------------------------- /// @notice the unix timestamp end time of the token auction uint256 public auctionEnd; /// @notice the length of auctions uint256 public auctionLength; /// @notice reservePrice * votingTokens uint256 public reserveTotal; /// @notice the current price of the token during an auction uint256 public livePrice; /// @notice the current user winning the token auction address payable public winning; enum State { inactive, live, ended, redeemed } State public auctionState; /// ----------------------------------- /// -------- VAULT INFORMATION -------- /// ----------------------------------- string public constant version = "1.1"; /// @notice the governance contract which gets paid in ETH address public immutable settings; /// @notice the address who initially deposited the NFT address public curator; /// @notice the AUM fee paid to the curator yearly. 3 decimals. ie. 100 = 10% uint256 public fee; /// @notice the last timestamp where fees were claimed uint256 public lastClaimed; /// @notice a boolean to indicate if the vault has closed bool public vaultClosed; /// @notice the number of ownership tokens voting on the reserve price at any given time uint256 public votingTokens; /// @notice a mapping of users to their desired token price mapping(address => uint256) public userPrices; /// ------------------------ /// -------- EVENTS -------- /// ------------------------ /// @notice An event emitted when a user updates their price event PriceUpdate(address indexed user, uint price); /// @notice An event emitted when an auction starts event Start(address indexed buyer, uint price); /// @notice An event emitted when a bid is made event Bid(address indexed buyer, uint price); /// @notice An event emitted when an auction is won event Won(address indexed buyer, uint price); /// @notice An event emitted when someone redeems all tokens for the NFT event Redeem(address indexed redeemer); /// @notice An event emitted when someone cashes in ERC20 tokens for ETH from an ERC721 token sale event Cash(address indexed owner, uint256 shares); event UpdateAuctionLength(uint256 length); event UpdateCuratorFee(uint256 fee); event FeeClaimed(uint256 fee); constructor(address _settings) { settings = _settings; } function initialize(address _curator, address _token, uint256 _id, uint256 _supply, uint256 _listPrice, uint256 _fee, string memory _name, string memory _symbol) external initializer { // initialize inherited contracts __ERC20_init(_name, _symbol); __ERC721Holder_init(); // set storage variables token = _token; id = _id; auctionLength = 3 days; curator = _curator; fee = _fee; lastClaimed = block.timestamp; auctionState = State.inactive; userPrices[_curator] = _listPrice; _mint(_curator, _supply); } /// -------------------------------- /// -------- VIEW FUNCTIONS -------- /// -------------------------------- function reservePrice() public view returns(uint256) { return votingTokens == 0 ? 0 : reserveTotal / votingTokens; } /// ------------------------------- /// -------- GOV FUNCTIONS -------- /// ------------------------------- /// @notice allow governance to boot a bad actor curator /// @param _curator the new curator function kickCurator(address _curator) external { require(msg.sender == Ownable(settings).owner(), "kick:not gov"); curator = _curator; } /// @notice allow governance to remove bad reserve prices function removeReserve(address _user) external { require(msg.sender == Ownable(settings).owner(), "remove:not gov"); require(auctionState == State.inactive, "update:auction live cannot update price"); uint256 old = userPrices[_user]; require(0 != old, "update:not an update"); uint256 weight = balanceOf(_user); votingTokens -= weight; reserveTotal -= weight * old; userPrices[_user] = 0; emit PriceUpdate(_user, 0); } /// ----------------------------------- /// -------- CURATOR FUNCTIONS -------- /// ----------------------------------- /// @notice allow curator to update the curator address /// @param _curator the new curator function updateCurator(address _curator) external { require(msg.sender == curator, "update:not curator"); curator = _curator; } /// @notice allow curator to update the auction length /// @param _length the new base price function updateAuctionLength(uint256 _length) external { require(msg.sender == curator, "update:not curator"); require(_length >= ISettings(settings).minAuctionLength() && _length <= ISettings(settings).maxAuctionLength(), "update:invalid auction length"); auctionLength = _length; emit UpdateAuctionLength(_length); } /// @notice allow the curator to change their fee /// @param _fee the new fee function updateFee(uint256 _fee) external { require(msg.sender == curator, "update:not curator"); require(_fee < fee, "update:can't raise"); require(_fee <= ISettings(settings).maxCuratorFee(), "update:cannot increase fee this high"); _claimFees(); fee = _fee; emit UpdateCuratorFee(fee); } /// @notice external function to claim fees for the curator and governance function claimFees() external { _claimFees(); } /// @dev interal fuction to calculate and mint fees function _claimFees() internal { require(auctionState != State.ended, "claim:cannot claim after auction ends"); // get how much in fees the curator would make in a year uint256 currentAnnualFee = fee * totalSupply() / 1000; // get how much that is per second; uint256 feePerSecond = currentAnnualFee / 31536000; // get how many seconds they are eligible to claim uint256 sinceLastClaim = block.timestamp - lastClaimed; // get the amount of tokens to mint uint256 curatorMint = sinceLastClaim * feePerSecond; // now lets do the same for governance address govAddress = ISettings(settings).feeReceiver(); uint256 govFee = ISettings(settings).governanceFee(); currentAnnualFee = govFee * totalSupply() / 1000; feePerSecond = currentAnnualFee / 31536000; uint256 govMint = sinceLastClaim * feePerSecond; lastClaimed = block.timestamp; if (curator != address(0)) { _mint(curator, curatorMint); emit FeeClaimed(curatorMint); } if (govAddress != address(0)) { _mint(govAddress, govMint); emit FeeClaimed(govMint); } } /// -------------------------------- /// -------- CORE FUNCTIONS -------- /// -------------------------------- /// @notice a function for an end user to update their desired sale price /// @param _new the desired price in ETH function updateUserPrice(uint256 _new) external { require(auctionState == State.inactive, "update:auction live cannot update price"); uint256 old = userPrices[msg.sender]; require(_new != old, "update:not an update"); uint256 weight = balanceOf(msg.sender); if (votingTokens == 0) { votingTokens = weight; reserveTotal = weight * _new; } // they are the only one voting else if (weight == votingTokens && old != 0) { reserveTotal = weight * _new; } // previously they were not voting else if (old == 0) { uint256 averageReserve = reserveTotal / votingTokens; uint256 reservePriceMin = averageReserve * ISettings(settings).minReserveFactor() / 1000; require(_new >= reservePriceMin, "update:reserve price too low"); uint256 reservePriceMax = averageReserve * ISettings(settings).maxReserveFactor() / 1000; require(_new <= reservePriceMax, "update:reserve price too high"); votingTokens += weight; reserveTotal += weight * _new; } // they no longer want to vote else if (_new == 0) { votingTokens -= weight; reserveTotal -= weight * old; } // they are updating their vote else { uint256 averageReserve = (reserveTotal - (old * weight)) / (votingTokens - weight); uint256 reservePriceMin = averageReserve * ISettings(settings).minReserveFactor() / 1000; require(_new >= reservePriceMin, "update:reserve price too low"); uint256 reservePriceMax = averageReserve * ISettings(settings).maxReserveFactor() / 1000; require(_new <= reservePriceMax, "update:reserve price too high"); reserveTotal = reserveTotal + (weight * _new) - (weight * old); } userPrices[msg.sender] = _new; emit PriceUpdate(msg.sender, _new); } /// @notice an internal function used to update sender and receivers price on token transfer /// @param _from the ERC20 token sender /// @param _to the ERC20 token receiver /// @param _amount the ERC20 token amount function _beforeTokenTransfer(address _from, address _to, uint256 _amount) internal virtual override { if (auctionState == State.inactive) { uint256 fromPrice = userPrices[_from]; uint256 toPrice = userPrices[_to]; // only do something if users have different reserve price if (toPrice != fromPrice) { // new holder is not a voter if (toPrice == 0) { // get the average reserve price ignoring the senders amount votingTokens -= _amount; reserveTotal -= _amount * fromPrice; } // old holder is not a voter else if (fromPrice == 0) { votingTokens += _amount; reserveTotal += _amount * toPrice; } // both holders are voters else { reserveTotal = reserveTotal + (_amount * toPrice) - (_amount * fromPrice); } } } } /// @notice kick off an auction. Must send reservePrice in ETH function start() external payable { require(auctionState == State.inactive, "start:no auction starts"); require(msg.value >= reservePrice(), "start:too low bid"); require(votingTokens * 1000 >= ISettings(settings).minVotePercentage() * totalSupply(), "start:not enough voters"); auctionEnd = block.timestamp + auctionLength; auctionState = State.live; livePrice = msg.value; winning = payable(msg.sender); emit Start(msg.sender, msg.value); } /// @notice an external function to bid on purchasing the vaults NFT. The msg.value is the bid amount function bid() external payable { require(auctionState == State.live, "bid:auction is not live"); uint256 increase = ISettings(settings).minBidIncrease() + 1000; require(msg.value * 1000 >= livePrice * increase, "bid:too low bid"); require(block.timestamp < auctionEnd, "bid:auction ended"); // If bid is within 15 minutes of auction end, extend auction if (auctionEnd - block.timestamp <= 15 minutes) { auctionEnd += 15 minutes; } _sendETHOrWETH(winning, livePrice); livePrice = msg.value; winning = payable(msg.sender); emit Bid(msg.sender, msg.value); } /// @notice an external function to end an auction after the timer has run out function end() external { require(auctionState == State.live, "end:vault has already closed"); require(block.timestamp >= auctionEnd, "end:auction live"); _claimFees(); // transfer erc721 to winner IERC721(token).transferFrom(address(this), winning, id); auctionState = State.ended; emit Won(winning, livePrice); } /// @notice an external function to burn all ERC20 tokens to receive the ERC721 token function redeem() external { require(auctionState == State.inactive, "redeem:no redeeming"); _burn(msg.sender, totalSupply()); // transfer erc721 to redeemer IERC721(token).transferFrom(address(this), msg.sender, id); auctionState = State.redeemed; emit Redeem(msg.sender); } /// @notice an external function to burn ERC20 tokens to receive ETH from ERC721 token purchase function cash() external { require(auctionState == State.ended, "cash:vault not closed yet"); uint256 bal = balanceOf(msg.sender); require(bal > 0, "cash:no tokens to cash out"); uint256 share = bal * address(this).balance / totalSupply(); _burn(msg.sender, bal); _sendETHOrWETH(payable(msg.sender), share); emit Cash(msg.sender, share); } // Will attempt to transfer ETH, but will transfer WETH instead if it fails. function _sendETHOrWETH(address to, uint256 value) internal { // Try to transfer ETH to the given recipient. if (!_attemptETHTransfer(to, value)) { // If the transfer fails, wrap and send as WETH, so that // the auction is not impeded and the recipient still // can claim ETH via the WETH contract (similar to escrow). IWETH(weth).deposit{value: value}(); IWETH(weth).transfer(to, value); // At this point, the recipient can unwrap WETH. } } // Sending ETH is not guaranteed complete, and the method used here will return false if // it fails. For example, a contract can block ETH transfer, or might use // an excessive amount of gas, thereby griefing a new bidder. // We should limit the gas used in transfers, and handle failure cases. function _attemptETHTransfer(address to, uint256 value) internal returns (bool) { // Here increase the gas limit a reasonable amount above the default, and try // to send ETH to the recipient. // NOTE: This might allow the recipient to attempt a limited reentrancy attack. (bool success, ) = to.call{value: value, gas: 30000}(""); return success; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IWETH { function deposit() external payable; function withdraw(uint) external; function approve(address, uint) external returns(bool); function transfer(address, uint) external returns(bool); function transferFrom(address, address, uint) external returns(bool); function balanceOf(address) external view returns(uint); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/Context.sol"; import "./IERC20.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overloaded; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); _approve(sender, _msgSender(), currentAllowance - amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); _approve(_msgSender(), spender, currentAllowance - subtractedValue); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); _balances[sender] = senderBalance - amount; _balances[recipient] += amount; emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); _balances[account] = accountBalance - amount; _totalSupply -= amount; emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/Context.sol"; import "./IERC721.sol"; import "./IERC721Metadata.sol"; import "./IERC721Enumerable.sol"; import "./IERC721Receiver.sol"; import "../../introspection/ERC165.sol"; import "../../utils/Address.sol"; import "../../utils/EnumerableSet.sol"; import "../../utils/EnumerableMap.sol"; import "../../utils/Strings.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // 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; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /** * @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_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(type(IERC721).interfaceId); _registerInterface(type(IERC721Metadata).interfaceId); _registerInterface(type(IERC721Enumerable).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 _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @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 _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @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 || ERC721.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 { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_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 _tokenOwners.contains(tokenId); } /** * @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 || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `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); _holderTokens[to].add(tokenId); _tokenOwners.set(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); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(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"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @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(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { // solhint-disable-next-line no-inline-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @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` cannot be the zero address. * - `to` cannot be the zero address. * * 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 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 pragma solidity ^0.8.0; import "./OpenZeppelin/access/Ownable.sol"; import "./Interfaces/ISettings.sol"; contract Settings is Ownable, ISettings { /// @notice the maximum auction length uint256 public override maxAuctionLength; /// @notice the longest an auction can ever be uint256 public constant maxMaxAuctionLength = 8 weeks; /// @notice the minimum auction length uint256 public override minAuctionLength; /// @notice the shortest an auction can ever be uint256 public constant minMinAuctionLength = 0; /// @notice governance fee max uint256 public override governanceFee; /// @notice 10% fee is max uint256 public constant maxGovFee = 100; /// @notice max curator fee uint256 public override maxCuratorFee; /// @notice the % bid increase required for a new bid uint256 public override minBidIncrease; /// @notice 10% bid increase is max uint256 public constant maxMinBidIncrease = 100; /// @notice 1% bid increase is min uint256 public constant minMinBidIncrease = 10; /// @notice the % of tokens required to be voting for an auction to start uint256 public override minVotePercentage; /// @notice the max % increase over the initial uint256 public override maxReserveFactor; /// @notice the max % decrease from the initial uint256 public override minReserveFactor; /// @notice the address who receives auction fees address payable public override feeReceiver; event UpdateMaxAuctionLength(uint256 _old, uint256 _new); event UpdateMinAuctionLength(uint256 _old, uint256 _new); event UpdateGovernanceFee(uint256 _old, uint256 _new); event UpdateCuratorFee(uint256 _old, uint256 _new); event UpdateMinBidIncrease(uint256 _old, uint256 _new); event UpdateMinVotePercentage(uint256 _old, uint256 _new); event UpdateMaxReserveFactor(uint256 _old, uint256 _new); event UpdateMinReserveFactor(uint256 _old, uint256 _new); event UpdateFeeReceiver(address _old, address _new); constructor() { maxAuctionLength = 2 weeks; minAuctionLength = 1; feeReceiver = payable(msg.sender); minReserveFactor = 500; // 50% maxReserveFactor = 2000; // 200% minBidIncrease = 50; // 5% maxCuratorFee = 100; minVotePercentage = 500; // 50% } function setMaxAuctionLength(uint256 _length) external onlyOwner { require(_length <= maxMaxAuctionLength, "max auction length too high"); require(_length > minAuctionLength, "max auction length too low"); emit UpdateMaxAuctionLength(maxAuctionLength, _length); maxAuctionLength = _length; } function setMinAuctionLength(uint256 _length) external onlyOwner { require(_length >= minMinAuctionLength, "min auction length too low"); require(_length < maxAuctionLength, "min auction length too high"); emit UpdateMinAuctionLength(minAuctionLength, _length); minAuctionLength = _length; } function setGovernanceFee(uint256 _fee) external onlyOwner { require(_fee <= maxGovFee, "fee too high"); emit UpdateGovernanceFee(governanceFee, _fee); governanceFee = _fee; } function setMaxCuratorFee(uint256 _fee) external onlyOwner { emit UpdateCuratorFee(governanceFee, _fee); maxCuratorFee = _fee; } function setMinBidIncrease(uint256 _min) external onlyOwner { require(_min <= maxMinBidIncrease, "min bid increase too high"); require(_min >= minMinBidIncrease, "min bid increase too low"); emit UpdateMinBidIncrease(minBidIncrease, _min); minBidIncrease = _min; } function setMinVotePercentage(uint256 _min) external onlyOwner { // 1000 is 100% require(_min <= 1000, "min vote percentage too high"); emit UpdateMinVotePercentage(minVotePercentage, _min); minVotePercentage = _min; } function setMaxReserveFactor(uint256 _factor) external onlyOwner { require(_factor > minReserveFactor, "max reserve factor too low"); emit UpdateMaxReserveFactor(maxReserveFactor, _factor); maxReserveFactor = _factor; } function setMinReserveFactor(uint256 _factor) external onlyOwner { require(_factor < maxReserveFactor, "min reserve factor too high"); emit UpdateMinReserveFactor(minReserveFactor, _factor); minReserveFactor = _factor; } function setFeeReceiver(address payable _receiver) external onlyOwner { require(_receiver != address(0), "fees cannot go to 0 address"); emit UpdateFeeReceiver(feeReceiver, _receiver); feeReceiver = _receiver; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721ReceiverUpgradeable.sol"; import "../../../proxy/utils/Initializable.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 ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable { function __ERC721Holder_init() internal initializer { __ERC721Holder_init_unchained(); } function __ERC721Holder_init_unchained() internal initializer { } /** * @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; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} uint256[45] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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: MIT pragma solidity ^0.8.0; import "../../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 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 pragma solidity ^0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @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 pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(type(IERC165).interfaceId); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // 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; // solhint-disable-next-line no-inline-assembly 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"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (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"); // solhint-disable-next-line avoid-low-level-calls (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"); // solhint-disable-next-line avoid-low-level-calls (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"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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 // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant alphabet = "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] = alphabet[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../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 () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), 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 { emit OwnershipTransferred(_owner, address(0)); _owner = 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"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ISettings { function maxAuctionLength() external returns(uint256); function minAuctionLength() external returns(uint256); function maxCuratorFee() external returns(uint256); function governanceFee() external returns(uint256); function minBidIncrease() external returns(uint256); function minVotePercentage() external returns(uint256); function maxReserveFactor() external returns(uint256); function minReserveFactor() external returns(uint256); function feeReceiver() external returns(address payable); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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: MIT pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_settings","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Bid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Cash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"PriceUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"redeemer","type":"address"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Start","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"length","type":"uint256"}],"name":"UpdateAuctionLength","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"UpdateCuratorFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"Won","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"auctionEnd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionState","outputs":[{"internalType":"enum TokenVault.State","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"cash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"curator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"end","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"id","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_curator","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_supply","type":"uint256"},{"internalType":"uint256","name":"_listPrice","type":"uint256"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_curator","type":"address"}],"name":"kickCurator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"livePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"removeReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reservePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"settings","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"start","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_length","type":"uint256"}],"name":"updateAuctionLength","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_curator","type":"address"}],"name":"updateCurator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"updateFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_new","type":"uint256"}],"name":"updateUserPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultClosed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winning","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b50604051620038933803806200389383398101604081905262000034916200004a565b60601b6001600160601b0319166080526200007c565b6000602082840312156200005d57600080fd5b81516001600160a01b03811681146200007557600080fd5b9392505050565b60805160601c61379d620000f66000396000818161082301528181610a3601528181610cf701528181610e3701528181610ed4015281816112bc015281816113ba0152818161156f0152818161166d015281816117e901528181611afa0152818161204801528181612ba50152612c3c015261379d6000f3fe6080604052600436106102dc5760003560e01c80637fb4509911610184578063be040fb0116100d6578063dd62ed3e1161008a578063e66f53b711610064578063e66f53b714610845578063efbe1c1c14610865578063fc0c546a1461087a57600080fd5b8063dd62ed3e146107b5578063ddca3f43146107fb578063e06174e41461081157600080fd5b8063c91de649116100bb578063c91de6491461075e578063d294f0931461078b578063db2e1eed146107a057600080fd5b8063be040fb014610741578063be9a65551461075657600080fd5b8063961be39111610138578063a9059cbb11610112578063a9059cbb146106f5578063adc1b95614610715578063af640d0f1461072b57600080fd5b8063961be391146106aa5780639a4e6d34146106bf578063a457c2d7146106d557600080fd5b8063853a1b9011610169578063853a1b90146106555780639012c4a81461067557806395d89b411461069557600080fd5b80637fb450991461060757806380436fe01461063557600080fd5b8063313ce5671161023d5780635c9920fc116101f15780636da84e6c116101cb5780636da84e6c146105a557806370a08231146105bb5780637b5581ed146105f157600080fd5b80635c9920fc1461054b578063626fb2f0146105655780636a7757141461058557600080fd5b8063395093511161022257806339509351146104a25780633fc8cef3146104c257806354fd4d501461050257600080fd5b8063313ce56714610470578063325c25a21461048c57600080fd5b80631998aeef116102945780632a24f46c116102795780632a24f46c1461041a5780632a44f120146104305780632bf33bd91461045057600080fd5b80631998aeef146103f257806323b872dd146103fa57600080fd5b80630c6a62dd116102c55780630c6a62dd1461033c578063150b7a021461035e57806318160ddd146103d357600080fd5b806306fdde03146102e1578063095ea7b31461030c575b600080fd5b3480156102ed57600080fd5b506102f661089a565b6040516103039190613610565b60405180910390f35b34801561031857600080fd5b5061032c610327366004613568565b61092c565b6040519015158152602001610303565b34801561034857600080fd5b5061035c610357366004613384565b610942565b005b34801561036a57600080fd5b506103a2610379366004613438565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610303565b3480156103df57600080fd5b506035545b604051908152602001610303565b61035c6109c5565b34801561040657600080fd5b5061032c6104153660046133f7565b610c36565b34801561042657600080fd5b506103e460995481565b34801561043c57600080fd5b5061035c61044b366004613384565b610cf5565b34801561045c57600080fd5b5061035c61046b3660046135b6565b610de6565b34801561047c57600080fd5b5060405160128152602001610303565b34801561049857600080fd5b506103e4609a5481565b3480156104ae57600080fd5b5061032c6104bd366004613568565b610ff1565b3480156104ce57600080fd5b506104ea73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b039091168152602001610303565b34801561050e57600080fd5b506102f66040518060400160405280600381526020017f312e31000000000000000000000000000000000000000000000000000000000081525081565b34801561055757600080fd5b5060a15461032c9060ff1681565b34801561057157600080fd5b5061035c6105803660046134b8565b61102d565b34801561059157600080fd5b5061035c6105a03660046135b6565b611172565b3480156105b157600080fd5b506103e4609c5481565b3480156105c757600080fd5b506103e46105d6366004613384565b6001600160a01b031660009081526033602052604090205490565b3480156105fd57600080fd5b506103e4609b5481565b34801561061357600080fd5b50609d5461062890600160a01b900460ff1681565b60405161030391906135e8565b34801561064157600080fd5b5061035c610650366004613384565b6117e7565b34801561066157600080fd5b50609d546104ea906001600160a01b031681565b34801561068157600080fd5b5061035c6106903660046135b6565b611a58565b3480156106a157600080fd5b506102f6611c3c565b3480156106b657600080fd5b5061035c611c4b565b3480156106cb57600080fd5b506103e460a25481565b3480156106e157600080fd5b5061032c6106f0366004613568565b611d83565b34801561070157600080fd5b5061032c610710366004613568565b611e34565b34801561072157600080fd5b506103e460a05481565b34801561073757600080fd5b506103e460985481565b34801561074d57600080fd5b5061035c611e41565b61035c611f7f565b34801561076a57600080fd5b506103e4610779366004613384565b60a36020526000908152604090205481565b34801561079757600080fd5b5061035c6121c1565b3480156107ac57600080fd5b506103e46121cb565b3480156107c157600080fd5b506103e46107d03660046133be565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b34801561080757600080fd5b506103e4609f5481565b34801561081d57600080fd5b506104ea7f000000000000000000000000000000000000000000000000000000000000000081565b34801561085157600080fd5b50609e546104ea906001600160a01b031681565b34801561087157600080fd5b5061035c6121f2565b34801561088657600080fd5b506097546104ea906001600160a01b031681565b6060603680546108a9906136d5565b80601f01602080910402602001604051908101604052809291908181526020018280546108d5906136d5565b80156109225780601f106108f757610100808354040283529160200191610922565b820191906000526020600020905b81548152906001019060200180831161090557829003601f168201915b5050505050905090565b6000610939338484612390565b50600192915050565b609e546001600160a01b031633146109965760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b60448201526064015b60405180910390fd5b609e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001609d54600160a01b900460ff1660038111156109e5576109e5613726565b14610a325760405162461bcd60e51b815260206004820152601760248201527f6269643a61756374696f6e206973206e6f74206c697665000000000000000000604482015260640161098d565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637c513c0f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610a8f57600080fd5b505af1158015610aa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac791906135cf565b610ad3906103e8613665565b905080609c54610ae3919061369f565b610aef346103e861369f565b1015610b3d5760405162461bcd60e51b815260206004820152600f60248201527f6269643a746f6f206c6f77206269640000000000000000000000000000000000604482015260640161098d565b6099544210610b8e5760405162461bcd60e51b815260206004820152601160248201527f6269643a61756374696f6e20656e646564000000000000000000000000000000604482015260640161098d565b61038442609954610b9f91906136be565b11610bbe5761038460996000828254610bb89190613665565b90915550505b609d54609c54610bd7916001600160a01b0316906124e8565b34609c819055609d805473ffffffffffffffffffffffffffffffffffffffff191633908117909155604051918252907fe684a55f31b79eca403df938249029212a5925ec6be8012e099b45bc1019e5d29060200160405180910390a250565b6000610c43848484612612565b6001600160a01b038416600090815260346020908152604080832033845290915290205482811015610cdd5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161098d565b610cea8533858403612390565b506001949350505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d4e57600080fd5b505afa158015610d62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8691906133a1565b6001600160a01b0316336001600160a01b0316146109965760405162461bcd60e51b815260206004820152600c60248201527f6b69636b3a6e6f7420676f760000000000000000000000000000000000000000604482015260640161098d565b609e546001600160a01b03163314610e355760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b604482015260640161098d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a0b335e36040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e9057600080fd5b505af1158015610ea4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec891906135cf565b8110158015610f6957507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630e519ef96040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610f2d57600080fd5b505af1158015610f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6591906135cf565b8111155b610fb55760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a696e76616c69642061756374696f6e206c656e677468000000604482015260640161098d565b609a8190556040518181527f4ab86ae701798277aa378943b9dfd155d3b19703cd57be298908fadd32f7bf46906020015b60405180910390a150565b3360008181526034602090815260408083206001600160a01b03871684529091528120549091610939918590611028908690613665565b612390565b600054610100900460ff1680611046575060005460ff16155b6110a95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156110cb576000805461ffff19166101011790555b6110d58383612840565b6110dd612906565b609780546001600160a01b038a811673ffffffffffffffffffffffffffffffffffffffff199283161790925560988990556203f480609a55609e8054928c169290911682179055609f8590554260a055609d805460ff60a01b19169055600090815260a36020526040902085905561115589876129c1565b8015611167576000805461ff00191690555b505050505050505050565b6000609d54600160a01b900460ff16600381111561119257611192613726565b146111ef5760405162461bcd60e51b815260206004820152602760248201527f7570646174653a61756374696f6e206c6976652063616e6e6f742075706461746044820152666520707269636560c81b606482015260840161098d565b33600090815260a360205260409020548181141561124f5760405162461bcd60e51b815260206004820152601460248201527f7570646174653a6e6f7420616e20757064617465000000000000000000000000604482015260640161098d565b3360009081526033602052604090205460a25461127d5760a2819055611275838261369f565b609b55611796565b60a2548114801561128d57508115155b1561129c57611275838261369f565b816114f257600060a254609b546112b3919061367d565b905060006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166309990a966040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561131557600080fd5b505af1158015611329573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134d91906135cf565b611357908461369f565b611361919061367d565b9050808510156113b35760405162461bcd60e51b815260206004820152601c60248201527f7570646174653a7265736572766520707269636520746f6f206c6f7700000000604482015260640161098d565b60006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635410bfc96040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b91906135cf565b611455908561369f565b61145f919061367d565b9050808611156114b15760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a7265736572766520707269636520746f6f2068696768000000604482015260640161098d565b8360a260008282546114c39190613665565b909155506114d39050868561369f565b609b60008282546114e49190613665565b909155506117969350505050565b82611535578060a2600082825461150991906136be565b909155506115199050828261369f565b609b600082825461152a91906136be565b909155506117969050565b60008160a25461154591906136be565b61154f838561369f565b609b5461155c91906136be565b611566919061367d565b905060006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166309990a966040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156115c857600080fd5b505af11580156115dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160091906135cf565b61160a908461369f565b611614919061367d565b9050808510156116665760405162461bcd60e51b815260206004820152601c60248201527f7570646174653a7265736572766520707269636520746f6f206c6f7700000000604482015260640161098d565b60006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635410bfc96040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156116c657600080fd5b505af11580156116da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fe91906135cf565b611708908561369f565b611712919061367d565b9050808611156117645760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a7265736572766520707269636520746f6f2068696768000000604482015260640161098d565b61176e858561369f565b611778878661369f565b609b546117859190613665565b61178f91906136be565b609b555050505b33600081815260a3602052604090819020859055517f64e6e7bd72b853c4e62fd6ceaca05a104700c70a4cb567c75c7f2242ba7f037c906117da9086815260200190565b60405180910390a2505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561184057600080fd5b505afa158015611854573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187891906133a1565b6001600160a01b0316336001600160a01b0316146118d85760405162461bcd60e51b815260206004820152600e60248201527f72656d6f76653a6e6f7420676f76000000000000000000000000000000000000604482015260640161098d565b6000609d54600160a01b900460ff1660038111156118f8576118f8613726565b146119555760405162461bcd60e51b815260206004820152602760248201527f7570646174653a61756374696f6e206c6976652063616e6e6f742075706461746044820152666520707269636560c81b606482015260840161098d565b6001600160a01b038116600090815260a36020526040902054806119bb5760405162461bcd60e51b815260206004820152601460248201527f7570646174653a6e6f7420616e20757064617465000000000000000000000000604482015260640161098d565b6001600160a01b03821660009081526033602052604081205490508060a260008282546119e891906136be565b909155506119f89050828261369f565b609b6000828254611a0991906136be565b90915550506001600160a01b038316600081815260a360209081526040808320839055519182527f64e6e7bd72b853c4e62fd6ceaca05a104700c70a4cb567c75c7f2242ba7f037c91016117da565b609e546001600160a01b03163314611aa75760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b604482015260640161098d565b609f548110611af85760405162461bcd60e51b815260206004820152601260248201527f7570646174653a63616e27742072616973650000000000000000000000000000604482015260640161098d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638a364bc16040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611b5357600080fd5b505af1158015611b67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8b91906135cf565b811115611bff5760405162461bcd60e51b8152602060048201526024808201527f7570646174653a63616e6e6f7420696e6372656173652066656520746869732060448201527f6869676800000000000000000000000000000000000000000000000000000000606482015260840161098d565b611c07612ab4565b609f8190556040518181527f2d1dae59a9e9ec0bc2ab19d45b7d10c8c55304fa08b40a7998e9f67f03223d0490602001610fe6565b6060603780546108a9906136d5565b6002609d54600160a01b900460ff166003811115611c6b57611c6b613726565b14611cb85760405162461bcd60e51b815260206004820152601960248201527f636173683a7661756c74206e6f7420636c6f7365642079657400000000000000604482015260640161098d565b3360009081526033602052604090205480611d155760405162461bcd60e51b815260206004820152601a60248201527f636173683a6e6f20746f6b656e7320746f2063617368206f7574000000000000604482015260640161098d565b6000611d2060355490565b611d2a478461369f565b611d34919061367d565b9050611d403383612dc5565b611d4a33826124e8565b60405181815233907f730831a1e4aa2d187ddd8e03d7beeac760a3927da5f112d645e0f8df7494b3679060200160405180910390a25050565b3360009081526034602090815260408083206001600160a01b038616845290915281205482811015611e1d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161098d565b611e2a3385858403612390565b5060019392505050565b6000610939338484612612565b6000609d54600160a01b900460ff166003811115611e6157611e61613726565b14611eae5760405162461bcd60e51b815260206004820152601360248201527f72656465656d3a6e6f2072656465656d696e6700000000000000000000000000604482015260640161098d565b611ec033611ebb60355490565b612dc5565b6097546098546040516323b872dd60e01b815230600482015233602482015260448101919091526001600160a01b03909116906323b872dd90606401600060405180830381600087803b158015611f1657600080fd5b505af1158015611f2a573d6000803e3d6000fd5b5050609d805460ff60a01b191674030000000000000000000000000000000000000000179055505060405133907fd1b5ea7fe0f1c2fa09d49c2aa9b2200664ba57a734f1d95481d95b7f99af991c90600090a2565b6000609d54600160a01b900460ff166003811115611f9f57611f9f613726565b14611fec5760405162461bcd60e51b815260206004820152601760248201527f73746172743a6e6f2061756374696f6e20737461727473000000000000000000604482015260640161098d565b611ff46121cb565b3410156120435760405162461bcd60e51b815260206004820152601160248201527f73746172743a746f6f206c6f7720626964000000000000000000000000000000604482015260640161098d565b6035547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166332977c736040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156120a157600080fd5b505af11580156120b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d991906135cf565b6120e3919061369f565b60a2546120f2906103e861369f565b10156121405760405162461bcd60e51b815260206004820152601760248201527f73746172743a6e6f7420656e6f75676820766f74657273000000000000000000604482015260640161098d565b609a5461214d9042613665565b609955609d805434609c8190557fffffffffffffffffffffff00000000000000000000000000000000000000000090911633908117600160a01b179092556040519081527fcfb9c5312b25ec7b809d61e638df25f749eae5d5c25399e1c93d1d319bfd5821906020015b60405180910390a2565b6121c9612ab4565b565b600060a2546000146121ec5760a254609b546121e7919061367d565b905090565b50600090565b6001609d54600160a01b900460ff16600381111561221257612212613726565b1461225f5760405162461bcd60e51b815260206004820152601c60248201527f656e643a7661756c742068617320616c726561647920636c6f73656400000000604482015260640161098d565b6099544210156122b15760405162461bcd60e51b815260206004820152601060248201527f656e643a61756374696f6e206c69766500000000000000000000000000000000604482015260640161098d565b6122b9612ab4565b609754609d546098546040516323b872dd60e01b81523060048201526001600160a01b03928316602482015260448101919091529116906323b872dd90606401600060405180830381600087803b15801561231357600080fd5b505af1158015612327573d6000803e3d6000fd5b5050609d80547402000000000000000000000000000000000000000060ff60a01b19821617909155609c546040519081526001600160a01b0390911692507f8b01f9dd0400d6a1e84369a5fb8f6033934856ffa8ebadd707dca302ab55169591506020016121b7565b6001600160a01b03831661240b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b0382166124875760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6124f28282612f5d565b61260e5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561254557600080fd5b505af1158015612559573d6000803e3d6000fd5b50506040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03861660048201526024810185905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2935063a9059cbb92506044019050602060405180830381600087803b1580156125d457600080fd5b505af11580156125e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260c9190613594565b505b5050565b6001600160a01b03831661268e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b03821661270a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161098d565b612715838383612fc0565b6001600160a01b038316600090815260336020526040902054818110156127a45760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906127db908490613665565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161282791815260200190565b60405180910390a361283a84848461260c565b50505050565b600054610100900460ff1680612859575060005460ff16155b6128bc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156128de576000805461ffff19166101011790555b6128e66130c1565b6128f08383613172565b801561260c576000805461ff0019169055505050565b600054610100900460ff168061291f575060005460ff16155b6129825760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156129a4576000805461ffff19166101011790555b6129ac6130c1565b80156129be576000805461ff00191690555b50565b6001600160a01b038216612a175760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161098d565b612a2360008383612fc0565b8060356000828254612a359190613665565b90915550506001600160a01b03821660009081526033602052604081208054839290612a62908490613665565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a361260e6000838361260c565b6002609d54600160a01b900460ff166003811115612ad457612ad4613726565b1415612b485760405162461bcd60e51b815260206004820152602560248201527f636c61696d3a63616e6e6f7420636c61696d2061667465722061756374696f6e60448201527f20656e6473000000000000000000000000000000000000000000000000000000606482015260840161098d565b60006103e8612b5660355490565b609f54612b63919061369f565b612b6d919061367d565b90506000612b7f6301e133808361367d565b9050600060a05442612b9191906136be565b90506000612b9f838361369f565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b3f006746040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612bfe57600080fd5b505af1158015612c12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3691906133a1565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630ea90a126040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612c9557600080fd5b505af1158015612ca9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ccd91906135cf565b90506103e8612cdb60355490565b612ce5908361369f565b612cef919061367d565b9550612cff6301e133808761367d565b94506000612d0d868661369f565b4260a055609e549091506001600160a01b031615612d6f57609e54612d3b906001600160a01b0316856129c1565b6040518481527f62b10e3ff3d45b5ff546e740b893897facb1680285f989a64ae932d62c5388e19060200160405180910390a15b6001600160a01b03831615612dbc57612d8883826129c1565b6040518181527f62b10e3ff3d45b5ff546e740b893897facb1680285f989a64ae932d62c5388e19060200160405180910390a15b50505050505050565b6001600160a01b038216612e415760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161098d565b612e4d82600083612fc0565b6001600160a01b03821660009081526033602052604090205481811015612edc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b0383166000908152603360205260408120838303905560358054849290612f0b9084906136be565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a361260c8360008461260c565b600080836001600160a01b03168361753090604051600060405180830381858888f193505050503d8060008114612fb0576040519150601f19603f3d011682016040523d82523d6000602084013e612fb5565b606091505b509095945050505050565b6000609d54600160a01b900460ff166003811115612fe057612fe0613726565b141561260c576001600160a01b03808416600090815260a360205260408082205492851682529020548082146130ba5780613053578260a2600082825461302791906136be565b909155506130379050828461369f565b609b600082825461304891906136be565b909155506130ba9050565b8161308b578260a2600082825461306a9190613665565b9091555061307a9050818461369f565b609b60008282546130489190613665565b613095828461369f565b61309f828561369f565b609b546130ac9190613665565b6130b691906136be565b609b555b5050505050565b600054610100900460ff16806130da575060005460ff16155b61313d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156129ac576000805461ffff191661010117905580156129be576000805461ff001916905550565b600054610100900460ff168061318b575060005460ff16155b6131ee5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff16158015613210576000805461ffff19166101011790555b825161322390603690602086019061324e565b50815161323790603790602085019061324e565b50801561260c576000805461ff0019169055505050565b82805461325a906136d5565b90600052602060002090601f01602090048101928261327c57600085556132c2565b82601f1061329557805160ff19168380011785556132c2565b828001600101855582156132c2579182015b828111156132c25782518255916020019190600101906132a7565b506132ce9291506132d2565b5090565b5b808211156132ce57600081556001016132d3565b600067ffffffffffffffff808411156133025761330261373c565b604051601f8501601f19908116603f0116810190828211818310171561332a5761332a61373c565b8160405280935085815286868601111561334357600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261336e57600080fd5b61337d838335602085016132e7565b9392505050565b60006020828403121561339657600080fd5b813561337d81613752565b6000602082840312156133b357600080fd5b815161337d81613752565b600080604083850312156133d157600080fd5b82356133dc81613752565b915060208301356133ec81613752565b809150509250929050565b60008060006060848603121561340c57600080fd5b833561341781613752565b9250602084013561342781613752565b929592945050506040919091013590565b6000806000806080858703121561344e57600080fd5b843561345981613752565b9350602085013561346981613752565b925060408501359150606085013567ffffffffffffffff81111561348c57600080fd5b8501601f8101871361349d57600080fd5b6134ac878235602084016132e7565b91505092959194509250565b600080600080600080600080610100898b0312156134d557600080fd5b88356134e081613752565b975060208901356134f081613752565b965060408901359550606089013594506080890135935060a0890135925060c089013567ffffffffffffffff8082111561352957600080fd5b6135358c838d0161335d565b935060e08b013591508082111561354b57600080fd5b506135588b828c0161335d565b9150509295985092959890939650565b6000806040838503121561357b57600080fd5b823561358681613752565b946020939093013593505050565b6000602082840312156135a657600080fd5b8151801515811461337d57600080fd5b6000602082840312156135c857600080fd5b5035919050565b6000602082840312156135e157600080fd5b5051919050565b602081016004831061360a57634e487b7160e01b600052602160045260246000fd5b91905290565b600060208083528351808285015260005b8181101561363d57858101830151858201604001528201613621565b8181111561364f576000604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561367857613678613710565b500190565b60008261369a57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156136b9576136b9613710565b500290565b6000828210156136d0576136d0613710565b500390565b600181811c908216806136e957607f821691505b6020821081141561370a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146129be57600080fdfea264697066735822122023b4f7b3f61b075d7dfb06884c60af66aecb24b6542b1556550e9c2f32e91a8464736f6c63430008050033000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca
Deployed Bytecode
0x6080604052600436106102dc5760003560e01c80637fb4509911610184578063be040fb0116100d6578063dd62ed3e1161008a578063e66f53b711610064578063e66f53b714610845578063efbe1c1c14610865578063fc0c546a1461087a57600080fd5b8063dd62ed3e146107b5578063ddca3f43146107fb578063e06174e41461081157600080fd5b8063c91de649116100bb578063c91de6491461075e578063d294f0931461078b578063db2e1eed146107a057600080fd5b8063be040fb014610741578063be9a65551461075657600080fd5b8063961be39111610138578063a9059cbb11610112578063a9059cbb146106f5578063adc1b95614610715578063af640d0f1461072b57600080fd5b8063961be391146106aa5780639a4e6d34146106bf578063a457c2d7146106d557600080fd5b8063853a1b9011610169578063853a1b90146106555780639012c4a81461067557806395d89b411461069557600080fd5b80637fb450991461060757806380436fe01461063557600080fd5b8063313ce5671161023d5780635c9920fc116101f15780636da84e6c116101cb5780636da84e6c146105a557806370a08231146105bb5780637b5581ed146105f157600080fd5b80635c9920fc1461054b578063626fb2f0146105655780636a7757141461058557600080fd5b8063395093511161022257806339509351146104a25780633fc8cef3146104c257806354fd4d501461050257600080fd5b8063313ce56714610470578063325c25a21461048c57600080fd5b80631998aeef116102945780632a24f46c116102795780632a24f46c1461041a5780632a44f120146104305780632bf33bd91461045057600080fd5b80631998aeef146103f257806323b872dd146103fa57600080fd5b80630c6a62dd116102c55780630c6a62dd1461033c578063150b7a021461035e57806318160ddd146103d357600080fd5b806306fdde03146102e1578063095ea7b31461030c575b600080fd5b3480156102ed57600080fd5b506102f661089a565b6040516103039190613610565b60405180910390f35b34801561031857600080fd5b5061032c610327366004613568565b61092c565b6040519015158152602001610303565b34801561034857600080fd5b5061035c610357366004613384565b610942565b005b34801561036a57600080fd5b506103a2610379366004613438565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610303565b3480156103df57600080fd5b506035545b604051908152602001610303565b61035c6109c5565b34801561040657600080fd5b5061032c6104153660046133f7565b610c36565b34801561042657600080fd5b506103e460995481565b34801561043c57600080fd5b5061035c61044b366004613384565b610cf5565b34801561045c57600080fd5b5061035c61046b3660046135b6565b610de6565b34801561047c57600080fd5b5060405160128152602001610303565b34801561049857600080fd5b506103e4609a5481565b3480156104ae57600080fd5b5061032c6104bd366004613568565b610ff1565b3480156104ce57600080fd5b506104ea73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b039091168152602001610303565b34801561050e57600080fd5b506102f66040518060400160405280600381526020017f312e31000000000000000000000000000000000000000000000000000000000081525081565b34801561055757600080fd5b5060a15461032c9060ff1681565b34801561057157600080fd5b5061035c6105803660046134b8565b61102d565b34801561059157600080fd5b5061035c6105a03660046135b6565b611172565b3480156105b157600080fd5b506103e4609c5481565b3480156105c757600080fd5b506103e46105d6366004613384565b6001600160a01b031660009081526033602052604090205490565b3480156105fd57600080fd5b506103e4609b5481565b34801561061357600080fd5b50609d5461062890600160a01b900460ff1681565b60405161030391906135e8565b34801561064157600080fd5b5061035c610650366004613384565b6117e7565b34801561066157600080fd5b50609d546104ea906001600160a01b031681565b34801561068157600080fd5b5061035c6106903660046135b6565b611a58565b3480156106a157600080fd5b506102f6611c3c565b3480156106b657600080fd5b5061035c611c4b565b3480156106cb57600080fd5b506103e460a25481565b3480156106e157600080fd5b5061032c6106f0366004613568565b611d83565b34801561070157600080fd5b5061032c610710366004613568565b611e34565b34801561072157600080fd5b506103e460a05481565b34801561073757600080fd5b506103e460985481565b34801561074d57600080fd5b5061035c611e41565b61035c611f7f565b34801561076a57600080fd5b506103e4610779366004613384565b60a36020526000908152604090205481565b34801561079757600080fd5b5061035c6121c1565b3480156107ac57600080fd5b506103e46121cb565b3480156107c157600080fd5b506103e46107d03660046133be565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b34801561080757600080fd5b506103e4609f5481565b34801561081d57600080fd5b506104ea7f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca81565b34801561085157600080fd5b50609e546104ea906001600160a01b031681565b34801561087157600080fd5b5061035c6121f2565b34801561088657600080fd5b506097546104ea906001600160a01b031681565b6060603680546108a9906136d5565b80601f01602080910402602001604051908101604052809291908181526020018280546108d5906136d5565b80156109225780601f106108f757610100808354040283529160200191610922565b820191906000526020600020905b81548152906001019060200180831161090557829003601f168201915b5050505050905090565b6000610939338484612390565b50600192915050565b609e546001600160a01b031633146109965760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b60448201526064015b60405180910390fd5b609e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001609d54600160a01b900460ff1660038111156109e5576109e5613726565b14610a325760405162461bcd60e51b815260206004820152601760248201527f6269643a61756374696f6e206973206e6f74206c697665000000000000000000604482015260640161098d565b60007f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316637c513c0f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610a8f57600080fd5b505af1158015610aa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac791906135cf565b610ad3906103e8613665565b905080609c54610ae3919061369f565b610aef346103e861369f565b1015610b3d5760405162461bcd60e51b815260206004820152600f60248201527f6269643a746f6f206c6f77206269640000000000000000000000000000000000604482015260640161098d565b6099544210610b8e5760405162461bcd60e51b815260206004820152601160248201527f6269643a61756374696f6e20656e646564000000000000000000000000000000604482015260640161098d565b61038442609954610b9f91906136be565b11610bbe5761038460996000828254610bb89190613665565b90915550505b609d54609c54610bd7916001600160a01b0316906124e8565b34609c819055609d805473ffffffffffffffffffffffffffffffffffffffff191633908117909155604051918252907fe684a55f31b79eca403df938249029212a5925ec6be8012e099b45bc1019e5d29060200160405180910390a250565b6000610c43848484612612565b6001600160a01b038416600090815260346020908152604080832033845290915290205482811015610cdd5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606482015260840161098d565b610cea8533858403612390565b506001949350505050565b7f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d4e57600080fd5b505afa158015610d62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8691906133a1565b6001600160a01b0316336001600160a01b0316146109965760405162461bcd60e51b815260206004820152600c60248201527f6b69636b3a6e6f7420676f760000000000000000000000000000000000000000604482015260640161098d565b609e546001600160a01b03163314610e355760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b604482015260640161098d565b7f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b031663a0b335e36040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e9057600080fd5b505af1158015610ea4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec891906135cf565b8110158015610f6957507f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316630e519ef96040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610f2d57600080fd5b505af1158015610f41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6591906135cf565b8111155b610fb55760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a696e76616c69642061756374696f6e206c656e677468000000604482015260640161098d565b609a8190556040518181527f4ab86ae701798277aa378943b9dfd155d3b19703cd57be298908fadd32f7bf46906020015b60405180910390a150565b3360008181526034602090815260408083206001600160a01b03871684529091528120549091610939918590611028908690613665565b612390565b600054610100900460ff1680611046575060005460ff16155b6110a95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156110cb576000805461ffff19166101011790555b6110d58383612840565b6110dd612906565b609780546001600160a01b038a811673ffffffffffffffffffffffffffffffffffffffff199283161790925560988990556203f480609a55609e8054928c169290911682179055609f8590554260a055609d805460ff60a01b19169055600090815260a36020526040902085905561115589876129c1565b8015611167576000805461ff00191690555b505050505050505050565b6000609d54600160a01b900460ff16600381111561119257611192613726565b146111ef5760405162461bcd60e51b815260206004820152602760248201527f7570646174653a61756374696f6e206c6976652063616e6e6f742075706461746044820152666520707269636560c81b606482015260840161098d565b33600090815260a360205260409020548181141561124f5760405162461bcd60e51b815260206004820152601460248201527f7570646174653a6e6f7420616e20757064617465000000000000000000000000604482015260640161098d565b3360009081526033602052604090205460a25461127d5760a2819055611275838261369f565b609b55611796565b60a2548114801561128d57508115155b1561129c57611275838261369f565b816114f257600060a254609b546112b3919061367d565b905060006103e87f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b03166309990a966040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561131557600080fd5b505af1158015611329573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134d91906135cf565b611357908461369f565b611361919061367d565b9050808510156113b35760405162461bcd60e51b815260206004820152601c60248201527f7570646174653a7265736572766520707269636520746f6f206c6f7700000000604482015260640161098d565b60006103e87f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316635410bfc96040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144b91906135cf565b611455908561369f565b61145f919061367d565b9050808611156114b15760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a7265736572766520707269636520746f6f2068696768000000604482015260640161098d565b8360a260008282546114c39190613665565b909155506114d39050868561369f565b609b60008282546114e49190613665565b909155506117969350505050565b82611535578060a2600082825461150991906136be565b909155506115199050828261369f565b609b600082825461152a91906136be565b909155506117969050565b60008160a25461154591906136be565b61154f838561369f565b609b5461155c91906136be565b611566919061367d565b905060006103e87f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b03166309990a966040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156115c857600080fd5b505af11580156115dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160091906135cf565b61160a908461369f565b611614919061367d565b9050808510156116665760405162461bcd60e51b815260206004820152601c60248201527f7570646174653a7265736572766520707269636520746f6f206c6f7700000000604482015260640161098d565b60006103e87f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316635410bfc96040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156116c657600080fd5b505af11580156116da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fe91906135cf565b611708908561369f565b611712919061367d565b9050808611156117645760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a7265736572766520707269636520746f6f2068696768000000604482015260640161098d565b61176e858561369f565b611778878661369f565b609b546117859190613665565b61178f91906136be565b609b555050505b33600081815260a3602052604090819020859055517f64e6e7bd72b853c4e62fd6ceaca05a104700c70a4cb567c75c7f2242ba7f037c906117da9086815260200190565b60405180910390a2505050565b7f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561184057600080fd5b505afa158015611854573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061187891906133a1565b6001600160a01b0316336001600160a01b0316146118d85760405162461bcd60e51b815260206004820152600e60248201527f72656d6f76653a6e6f7420676f76000000000000000000000000000000000000604482015260640161098d565b6000609d54600160a01b900460ff1660038111156118f8576118f8613726565b146119555760405162461bcd60e51b815260206004820152602760248201527f7570646174653a61756374696f6e206c6976652063616e6e6f742075706461746044820152666520707269636560c81b606482015260840161098d565b6001600160a01b038116600090815260a36020526040902054806119bb5760405162461bcd60e51b815260206004820152601460248201527f7570646174653a6e6f7420616e20757064617465000000000000000000000000604482015260640161098d565b6001600160a01b03821660009081526033602052604081205490508060a260008282546119e891906136be565b909155506119f89050828261369f565b609b6000828254611a0991906136be565b90915550506001600160a01b038316600081815260a360209081526040808320839055519182527f64e6e7bd72b853c4e62fd6ceaca05a104700c70a4cb567c75c7f2242ba7f037c91016117da565b609e546001600160a01b03163314611aa75760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b604482015260640161098d565b609f548110611af85760405162461bcd60e51b815260206004820152601260248201527f7570646174653a63616e27742072616973650000000000000000000000000000604482015260640161098d565b7f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316638a364bc16040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611b5357600080fd5b505af1158015611b67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8b91906135cf565b811115611bff5760405162461bcd60e51b8152602060048201526024808201527f7570646174653a63616e6e6f7420696e6372656173652066656520746869732060448201527f6869676800000000000000000000000000000000000000000000000000000000606482015260840161098d565b611c07612ab4565b609f8190556040518181527f2d1dae59a9e9ec0bc2ab19d45b7d10c8c55304fa08b40a7998e9f67f03223d0490602001610fe6565b6060603780546108a9906136d5565b6002609d54600160a01b900460ff166003811115611c6b57611c6b613726565b14611cb85760405162461bcd60e51b815260206004820152601960248201527f636173683a7661756c74206e6f7420636c6f7365642079657400000000000000604482015260640161098d565b3360009081526033602052604090205480611d155760405162461bcd60e51b815260206004820152601a60248201527f636173683a6e6f20746f6b656e7320746f2063617368206f7574000000000000604482015260640161098d565b6000611d2060355490565b611d2a478461369f565b611d34919061367d565b9050611d403383612dc5565b611d4a33826124e8565b60405181815233907f730831a1e4aa2d187ddd8e03d7beeac760a3927da5f112d645e0f8df7494b3679060200160405180910390a25050565b3360009081526034602090815260408083206001600160a01b038616845290915281205482811015611e1d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161098d565b611e2a3385858403612390565b5060019392505050565b6000610939338484612612565b6000609d54600160a01b900460ff166003811115611e6157611e61613726565b14611eae5760405162461bcd60e51b815260206004820152601360248201527f72656465656d3a6e6f2072656465656d696e6700000000000000000000000000604482015260640161098d565b611ec033611ebb60355490565b612dc5565b6097546098546040516323b872dd60e01b815230600482015233602482015260448101919091526001600160a01b03909116906323b872dd90606401600060405180830381600087803b158015611f1657600080fd5b505af1158015611f2a573d6000803e3d6000fd5b5050609d805460ff60a01b191674030000000000000000000000000000000000000000179055505060405133907fd1b5ea7fe0f1c2fa09d49c2aa9b2200664ba57a734f1d95481d95b7f99af991c90600090a2565b6000609d54600160a01b900460ff166003811115611f9f57611f9f613726565b14611fec5760405162461bcd60e51b815260206004820152601760248201527f73746172743a6e6f2061756374696f6e20737461727473000000000000000000604482015260640161098d565b611ff46121cb565b3410156120435760405162461bcd60e51b815260206004820152601160248201527f73746172743a746f6f206c6f7720626964000000000000000000000000000000604482015260640161098d565b6035547f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b03166332977c736040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156120a157600080fd5b505af11580156120b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d991906135cf565b6120e3919061369f565b60a2546120f2906103e861369f565b10156121405760405162461bcd60e51b815260206004820152601760248201527f73746172743a6e6f7420656e6f75676820766f74657273000000000000000000604482015260640161098d565b609a5461214d9042613665565b609955609d805434609c8190557fffffffffffffffffffffff00000000000000000000000000000000000000000090911633908117600160a01b179092556040519081527fcfb9c5312b25ec7b809d61e638df25f749eae5d5c25399e1c93d1d319bfd5821906020015b60405180910390a2565b6121c9612ab4565b565b600060a2546000146121ec5760a254609b546121e7919061367d565b905090565b50600090565b6001609d54600160a01b900460ff16600381111561221257612212613726565b1461225f5760405162461bcd60e51b815260206004820152601c60248201527f656e643a7661756c742068617320616c726561647920636c6f73656400000000604482015260640161098d565b6099544210156122b15760405162461bcd60e51b815260206004820152601060248201527f656e643a61756374696f6e206c69766500000000000000000000000000000000604482015260640161098d565b6122b9612ab4565b609754609d546098546040516323b872dd60e01b81523060048201526001600160a01b03928316602482015260448101919091529116906323b872dd90606401600060405180830381600087803b15801561231357600080fd5b505af1158015612327573d6000803e3d6000fd5b5050609d80547402000000000000000000000000000000000000000060ff60a01b19821617909155609c546040519081526001600160a01b0390911692507f8b01f9dd0400d6a1e84369a5fb8f6033934856ffa8ebadd707dca302ab55169591506020016121b7565b6001600160a01b03831661240b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b0382166124875760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6124f28282612f5d565b61260e5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561254557600080fd5b505af1158015612559573d6000803e3d6000fd5b50506040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b03861660048201526024810185905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2935063a9059cbb92506044019050602060405180830381600087803b1580156125d457600080fd5b505af11580156125e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260c9190613594565b505b5050565b6001600160a01b03831661268e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b03821661270a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161098d565b612715838383612fc0565b6001600160a01b038316600090815260336020526040902054818110156127a45760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b038085166000908152603360205260408082208585039055918516815290812080548492906127db908490613665565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161282791815260200190565b60405180910390a361283a84848461260c565b50505050565b600054610100900460ff1680612859575060005460ff16155b6128bc5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156128de576000805461ffff19166101011790555b6128e66130c1565b6128f08383613172565b801561260c576000805461ff0019169055505050565b600054610100900460ff168061291f575060005460ff16155b6129825760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156129a4576000805461ffff19166101011790555b6129ac6130c1565b80156129be576000805461ff00191690555b50565b6001600160a01b038216612a175760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161098d565b612a2360008383612fc0565b8060356000828254612a359190613665565b90915550506001600160a01b03821660009081526033602052604081208054839290612a62908490613665565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a361260e6000838361260c565b6002609d54600160a01b900460ff166003811115612ad457612ad4613726565b1415612b485760405162461bcd60e51b815260206004820152602560248201527f636c61696d3a63616e6e6f7420636c61696d2061667465722061756374696f6e60448201527f20656e6473000000000000000000000000000000000000000000000000000000606482015260840161098d565b60006103e8612b5660355490565b609f54612b63919061369f565b612b6d919061367d565b90506000612b7f6301e133808361367d565b9050600060a05442612b9191906136be565b90506000612b9f838361369f565b905060007f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b031663b3f006746040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612bfe57600080fd5b505af1158015612c12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c3691906133a1565b905060007f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca6001600160a01b0316630ea90a126040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612c9557600080fd5b505af1158015612ca9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ccd91906135cf565b90506103e8612cdb60355490565b612ce5908361369f565b612cef919061367d565b9550612cff6301e133808761367d565b94506000612d0d868661369f565b4260a055609e549091506001600160a01b031615612d6f57609e54612d3b906001600160a01b0316856129c1565b6040518481527f62b10e3ff3d45b5ff546e740b893897facb1680285f989a64ae932d62c5388e19060200160405180910390a15b6001600160a01b03831615612dbc57612d8883826129c1565b6040518181527f62b10e3ff3d45b5ff546e740b893897facb1680285f989a64ae932d62c5388e19060200160405180910390a15b50505050505050565b6001600160a01b038216612e415760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161098d565b612e4d82600083612fc0565b6001600160a01b03821660009081526033602052604090205481811015612edc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161098d565b6001600160a01b0383166000908152603360205260408120838303905560358054849290612f0b9084906136be565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a361260c8360008461260c565b600080836001600160a01b03168361753090604051600060405180830381858888f193505050503d8060008114612fb0576040519150601f19603f3d011682016040523d82523d6000602084013e612fb5565b606091505b509095945050505050565b6000609d54600160a01b900460ff166003811115612fe057612fe0613726565b141561260c576001600160a01b03808416600090815260a360205260408082205492851682529020548082146130ba5780613053578260a2600082825461302791906136be565b909155506130379050828461369f565b609b600082825461304891906136be565b909155506130ba9050565b8161308b578260a2600082825461306a9190613665565b9091555061307a9050818461369f565b609b60008282546130489190613665565b613095828461369f565b61309f828561369f565b609b546130ac9190613665565b6130b691906136be565b609b555b5050505050565b600054610100900460ff16806130da575060005460ff16155b61313d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff161580156129ac576000805461ffff191661010117905580156129be576000805461ff001916905550565b600054610100900460ff168061318b575060005460ff16155b6131ee5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161098d565b600054610100900460ff16158015613210576000805461ffff19166101011790555b825161322390603690602086019061324e565b50815161323790603790602085019061324e565b50801561260c576000805461ff0019169055505050565b82805461325a906136d5565b90600052602060002090601f01602090048101928261327c57600085556132c2565b82601f1061329557805160ff19168380011785556132c2565b828001600101855582156132c2579182015b828111156132c25782518255916020019190600101906132a7565b506132ce9291506132d2565b5090565b5b808211156132ce57600081556001016132d3565b600067ffffffffffffffff808411156133025761330261373c565b604051601f8501601f19908116603f0116810190828211818310171561332a5761332a61373c565b8160405280935085815286868601111561334357600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261336e57600080fd5b61337d838335602085016132e7565b9392505050565b60006020828403121561339657600080fd5b813561337d81613752565b6000602082840312156133b357600080fd5b815161337d81613752565b600080604083850312156133d157600080fd5b82356133dc81613752565b915060208301356133ec81613752565b809150509250929050565b60008060006060848603121561340c57600080fd5b833561341781613752565b9250602084013561342781613752565b929592945050506040919091013590565b6000806000806080858703121561344e57600080fd5b843561345981613752565b9350602085013561346981613752565b925060408501359150606085013567ffffffffffffffff81111561348c57600080fd5b8501601f8101871361349d57600080fd5b6134ac878235602084016132e7565b91505092959194509250565b600080600080600080600080610100898b0312156134d557600080fd5b88356134e081613752565b975060208901356134f081613752565b965060408901359550606089013594506080890135935060a0890135925060c089013567ffffffffffffffff8082111561352957600080fd5b6135358c838d0161335d565b935060e08b013591508082111561354b57600080fd5b506135588b828c0161335d565b9150509295985092959890939650565b6000806040838503121561357b57600080fd5b823561358681613752565b946020939093013593505050565b6000602082840312156135a657600080fd5b8151801515811461337d57600080fd5b6000602082840312156135c857600080fd5b5035919050565b6000602082840312156135e157600080fd5b5051919050565b602081016004831061360a57634e487b7160e01b600052602160045260246000fd5b91905290565b600060208083528351808285015260005b8181101561363d57858101830151858201604001528201613621565b8181111561364f576000604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561367857613678613710565b500190565b60008261369a57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156136b9576136b9613710565b500290565b6000828210156136d0576136d0613710565b500390565b600181811c908216806136e957607f821691505b6020821081141561370a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146129be57600080fdfea264697066735822122023b4f7b3f61b075d7dfb06884c60af66aecb24b6542b1556550e9c2f32e91a8464736f6c63430008050033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca
-----Decoded View---------------
Arg [0] : _settings (address): 0xE0FC79183a22106229B84ECDd55cA017A07eddCa
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.