More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,304 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint | 20686297 | 150 days ago | IN | 0 ETH | 0.00174491 | ||||
Mint | 18565177 | 447 days ago | IN | 0 ETH | 0.02460789 | ||||
Mint | 18522368 | 453 days ago | IN | 0 ETH | 0.01287502 | ||||
Mint | 17823928 | 551 days ago | IN | 0 ETH | 0.01004827 | ||||
Mint | 17823925 | 551 days ago | IN | 0 ETH | 0.01106327 | ||||
Mint | 17780648 | 557 days ago | IN | 0 ETH | 0.00882628 | ||||
Mint | 17641591 | 576 days ago | IN | 0 ETH | 0.00805956 | ||||
Mint | 17636067 | 577 days ago | IN | 0 ETH | 0.01334188 | ||||
Mint | 17608328 | 581 days ago | IN | 0 ETH | 0.0069558 | ||||
Mint | 17606656 | 581 days ago | IN | 0 ETH | 0.00749375 | ||||
Mint | 17605726 | 581 days ago | IN | 0 ETH | 0.0070767 | ||||
Mint | 17596201 | 583 days ago | IN | 0 ETH | 0.01224838 | ||||
Transfer | 17596132 | 583 days ago | IN | 0 ETH | 0.00033902 | ||||
Mint | 17595355 | 583 days ago | IN | 0 ETH | 0.00700037 | ||||
Mint | 17595313 | 583 days ago | IN | 0 ETH | 0.00729323 | ||||
Mint | 17591596 | 583 days ago | IN | 0 ETH | 0.00843312 | ||||
Mint | 17590418 | 584 days ago | IN | 0 ETH | 0.010518 | ||||
Mint | 17589589 | 584 days ago | IN | 0 ETH | 0.01299024 | ||||
Mint | 17583986 | 584 days ago | IN | 0 ETH | 0.0077598 | ||||
Mint | 17583979 | 584 days ago | IN | 0 ETH | 0.00754425 | ||||
Mint | 17582853 | 585 days ago | IN | 0 ETH | 0.0064665 | ||||
Mint | 17582603 | 585 days ago | IN | 0 ETH | 0.00744747 | ||||
Mint | 17582144 | 585 days ago | IN | 0 ETH | 0.0077598 | ||||
Mint | 17427248 | 606 days ago | IN | 0 ETH | 0.01097811 | ||||
Mint | 17404543 | 610 days ago | IN | 0 ETH | 0.0094369 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
ERC721VaultFactory
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 "./OpenZeppelin/access/Ownable.sol"; import "./OpenZeppelin/utils/Pausable.sol"; import "./OpenZeppelin/token/ERC721/ERC721.sol"; import "./OpenZeppelin/token/ERC721/ERC721Holder.sol"; import "./InitializedProxy.sol"; import "./Settings.sol"; import "./ERC721TokenVault.sol"; contract ERC721VaultFactory is Ownable, Pausable { /// @notice the number of ERC721 vaults uint256 public vaultCount; /// @notice the mapping of vault number to vault contract mapping(uint256 => address) public vaults; /// @notice a settings contract controlled by governance address public immutable settings; /// @notice the TokenVault logic contract address public immutable logic; event Mint(address indexed token, uint256 id, uint256 price, address vault, uint256 vaultId); constructor(address _settings) { settings = _settings; logic = address(new TokenVault(_settings)); } /// @notice the function to mint a new vault /// @param _name the desired name of the vault /// @param _symbol the desired sumbol of the vault /// @param _token the ERC721 token address fo the NFT /// @param _id the uint256 ID of the token /// @param _supply is the initial total supply of the token /// @param _listPrice the initial price of the NFT /// @param _fee is the curators fee on creation /// @return the ID of the vault function mint(string memory _name, string memory _symbol, address _token, uint256 _id, uint256 _supply, uint256 _listPrice, uint256 _fee) external whenNotPaused returns(uint256) { bytes memory _initializationCalldata = abi.encodeWithSignature( "initialize(address,address,uint256,uint256,uint256,uint256,string,string)", msg.sender, _token, _id, _supply, _listPrice, _fee, _name, _symbol ); address vault = address( new InitializedProxy( logic, _initializationCalldata ) ); emit Mint(_token, _id, _listPrice, vault, vaultCount); IERC721(_token).safeTransferFrom(msg.sender, vault, _id); vaults[vaultCount] = vault; vaultCount++; return vaultCount - 1; } function pause() external onlyOwner { _pause(); } function unpause() external onlyOwner { _unpause(); } }
// 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; import "./Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// 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; /** * @title InitializedProxy * @author Anna Carroll */ contract InitializedProxy { // address of logic contract address public immutable logic; // ======== Constructor ========= constructor( address _logic, bytes memory _initializationCalldata ) { logic = _logic; // Delegatecall into the logic contract, supplying initialization calldata (bool _ok, bytes memory returnData) = _logic.delegatecall(_initializationCalldata); // Revert if delegatecall to implementation reverts require(_ok, string(returnData)); } // ======== Fallback ========= fallback() external payable { address _impl = logic; assembly { let ptr := mload(0x40) calldatacopy(ptr, 0, calldatasize()) let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0) let size := returndatasize() returndatacopy(ptr, 0, size) switch result case 0 { revert(ptr, size) } default { return(ptr, size) } } } // ======== Receive ========= receive() external payable {} // solhint-disable-line no-empty-blocks }
//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 = 1 days; /// @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 = 3 days; 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 "./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 -------- /// ----------------------------------- /// @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); 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; reserveTotal = _listPrice * _supply; auctionLength = 7 days; curator = _curator; fee = _fee; lastClaimed = block.timestamp; votingTokens = _listPrice == 0 ? 0 : _supply; auctionState = State.inactive; _mint(_curator, _supply); userPrices[_curator] = _listPrice; } /// -------------------------------- /// -------- 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; } /// @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 <= ISettings(settings).maxCuratorFee(), "update:cannot increase fee this high"); _claimFees(); fee = _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; _mint(curator, curatorMint); _mint(govAddress, 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 (_from != address(0) && 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; } _sendWETH(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); } /// @dev internal helper function to send ETH and WETH on failure function _sendWETH(address who, uint256 amount) internal { IWETH(weth).deposit{value: amount}(); IWETH(weth).transfer(who, IWETH(weth).balanceOf(address(this))); } /// @dev internal helper function to send ETH and WETH on failure function _sendETHOrWETH(address who, uint256 amount) internal { // contracts get bet WETH because they can be mean if (who.isContract()) { IWETH(weth).deposit{value: amount}(); IWETH(weth).transfer(who, IWETH(weth).balanceOf(address(this))); } else { payable(who).transfer(amount); } } }
// 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; 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; 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; 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 "../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 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; /** * @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":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"address","name":"vault","type":"address"},{"indexed":false,"internalType":"uint256","name":"vaultId","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"logic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_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"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settings","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vaults","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c060405234801561001057600080fd5b5060405161485738038061485783398101604081905261002f916100ed565b600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506000805460ff60a01b191690556001600160601b0319606082901b16608052604051819061009d906100e0565b6001600160a01b039091168152602001604051809103906000f0801580156100c9573d6000803e3d6000fd5b5060601b6001600160601b03191660a0525061011d565b6137e78061107083390190565b6000602082840312156100ff57600080fd5b81516001600160a01b038116811461011657600080fd5b9392505050565b60805160601c60a05160601c610f2161014f600039600081816101ad0152610474015260006101d50152610f216000f3fe60806040523480156200001157600080fd5b5060043610620000d95760003560e01c80638da5cb5b116200008b578063d7dfa0dd1162000062578063d7dfa0dd14620001a7578063e06174e414620001cf578063f2fde38b14620001f757600080fd5b80638da5cb5b1462000165578063a7c6a1001462000177578063bdc01110146200019057600080fd5b8063715018a611620000c0578063715018a6146200010c5780638456cb5914620001165780638c64ea4a146200012057600080fd5b80633f4ba83a14620000de5780635c975abb14620000ea575b600080fd5b620000e86200020e565b005b600054600160a01b900460ff1660405190151581526020015b60405180910390f35b620000e86200027a565b620000e86200032d565b6200014c6200013136600462000a2e565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200162000103565b6000546001600160a01b03166200014c565b6200018160015481565b60405190815260200162000103565b62000181620001a13660046200098c565b62000393565b6200014c7f000000000000000000000000000000000000000000000000000000000000000081565b6200014c7f000000000000000000000000000000000000000000000000000000000000000081565b620000e86200020836600462000967565b62000625565b6000546001600160a01b031633146200026e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6200027862000767565b565b6000546001600160a01b03163314620002d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000265565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b03163314620003895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000265565b620002786200080f565b60008054600160a01b900460ff1615620003f05760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640162000265565b60003387878787878e8e6040516024016200041398979695949392919062000a98565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f626fb2f000000000000000000000000000000000000000000000000000000000179052519091506000907f0000000000000000000000000000000000000000000000000000000000000000908390620004a190620008a7565b620004ae92919062000b04565b604051809103906000f080158015620004cb573d6000803e3d6000fd5b509050876001600160a01b03167ff9c32fbc56ff04f32a233ebc26e388564223745e28abd8d0781dd906537f563e8887846001546040516200052f949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b60405180910390a26040517f42842e0e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038281166024830152604482018990528916906342842e0e90606401600060405180830381600087803b158015620005a157600080fd5b505af1158015620005b6573d6000803e3d6000fd5b5050600180546000908152600260205260408120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03871617905581549350909150620006028362000b4a565b91905055506001805462000617919062000b30565b9a9950505050505050505050565b6000546001600160a01b03163314620006815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000265565b6001600160a01b038116620006ff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840162000265565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600054600160a01b900460ff16620007c25760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640162000265565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600054600160a01b900460ff16156200086b5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640162000265565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620007f23390565b6103578062000b9583390190565b80356001600160a01b0381168114620008cd57600080fd5b919050565b600082601f830112620008e457600080fd5b813567ffffffffffffffff8082111562000902576200090262000b7e565b604051601f8301601f19908116603f011681019082821181831017156200092d576200092d62000b7e565b816040528381528660208588010111156200094757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156200097a57600080fd5b6200098582620008b5565b9392505050565b600080600080600080600060e0888a031215620009a857600080fd5b873567ffffffffffffffff80821115620009c157600080fd5b620009cf8b838c01620008d2565b985060208a0135915080821115620009e657600080fd5b50620009f58a828b01620008d2565b96505062000a0660408901620008b5565b969995985095966060810135965060808101359560a0820135955060c0909101359350915050565b60006020828403121562000a4157600080fd5b5035919050565b6000815180845260005b8181101562000a705760208185018101518683018201520162000a52565b8181111562000a83576000602083870101525b50601f01601f19169290920160200192915050565b60006101006001600160a01b03808c168452808b166020850152508860408401528760608401528660808401528560a08401528060c084015262000adf8184018662000a48565b905082810360e084015262000af5818562000a48565b9b9a5050505050505050505050565b6001600160a01b038316815260406020820152600062000b28604083018462000a48565b949350505050565b60008282101562000b455762000b4562000b68565b500390565b600060001982141562000b615762000b6162000b68565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe60a060405234801561001057600080fd5b5060405161035738038061035783398101604081905261002f916100d7565b6001600160601b0319606083901b1660805260405160009081906001600160a01b0385169061005f9085906101a5565b600060405180830381855af49150503d806000811461009a576040519150601f19603f3d011682016040523d82523d6000602084013e61009f565b606091505b50915091508181906100cd5760405162461bcd60e51b81526004016100c491906101c1565b60405180910390fd5b505050505061023a565b600080604083850312156100ea57600080fd5b82516001600160a01b038116811461010157600080fd5b60208401519092506001600160401b038082111561011e57600080fd5b818501915085601f83011261013257600080fd5b81518181111561014457610144610224565b604051601f8201601f19908116603f0116810190838211818310171561016c5761016c610224565b8160405282815288602084870101111561018557600080fd5b6101968360208301602088016101f4565b80955050505050509250929050565b600082516101b78184602087016101f4565b9190910192915050565b60208152600082518060208401526101e08160408501602087016101f4565b601f01601f19169190910160400192915050565b60005b8381101561020f5781810151838201526020016101f7565b8381111561021e576000848401525b50505050565b634e487b7160e01b600052604160045260246000fd5b60805160601c60fc61025b60003960008181602a0152607b015260fc6000f3fe608060405260043610601f5760003560e01c8063d7dfa0dd14606b576025565b36602557005b6040517f00000000000000000000000000000000000000000000000000000000000000009036600082376000803683855af43d806000843e8180156067578184f35b8184fd5b348015607657600080fd5b50609d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f3fea264697066735822122013174273c18ed4bea127cbc0952900378004a1870c433d85adc8dafba30dae5764736f6c63430008050033a2646970667358221220ba70a56848ff1300b0acc89509d945d46863341057515849573a7e6aa090b12464736f6c6343000805003360a06040523480156200001157600080fd5b50604051620037e7380380620037e783398101604081905262000034916200004a565b60601b6001600160601b0319166080526200007c565b6000602082840312156200005d57600080fd5b81516001600160a01b03811681146200007557600080fd5b9392505050565b60805160601c6136f1620000f6600039600081816107cf015281816109e201528181610ca301528181610de301528181610e800152818161126f0152818161136d01528181611522015281816116200152818161179c01528181611a5c01528181611f7a01528181612b420152612bd901526136f16000f3fe6080604052600436106102d15760003560e01c806380436fe011610179578063be040fb0116100d6578063dd62ed3e1161008a578063e66f53b711610064578063e66f53b7146107f1578063efbe1c1c14610811578063fc0c546a1461082657600080fd5b8063dd62ed3e14610761578063ddca3f43146107a7578063e06174e4146107bd57600080fd5b8063c91de649116100bb578063c91de6491461070a578063d294f09314610737578063db2e1eed1461074c57600080fd5b8063be040fb0146106ed578063be9a65551461070257600080fd5b80639a4e6d341161012d578063a9059cbb11610112578063a9059cbb146106a1578063adc1b956146106c1578063af640d0f146106d757600080fd5b80639a4e6d341461066b578063a457c2d71461068157600080fd5b80639012c4a81161015e5780639012c4a81461062157806395d89b4114610641578063961be3911461065657600080fd5b806380436fe0146105e1578063853a1b901461060157600080fd5b8063313ce56711610232578063626fb2f0116101e657806370a08231116101c057806370a08231146105675780637b5581ed1461059d5780637fb45099146105b357600080fd5b8063626fb2f0146105115780636a775714146105315780636da84e6c1461055157600080fd5b8063395093511161021757806339509351146104975780633fc8cef3146104b75780635c9920fc146104f757600080fd5b8063313ce56714610465578063325c25a21461048157600080fd5b80631998aeef116102895780632a24f46c1161026e5780632a24f46c1461040f5780632a44f120146104255780632bf33bd91461044557600080fd5b80631998aeef146103e757806323b872dd146103ef57600080fd5b80630c6a62dd116102ba5780630c6a62dd14610331578063150b7a021461035357806318160ddd146103c857600080fd5b806306fdde03146102d6578063095ea7b314610301575b600080fd5b3480156102e257600080fd5b506102eb610846565b6040516102f89190613564565b60405180910390f35b34801561030d57600080fd5b5061032161031c3660046134bc565b6108d8565b60405190151581526020016102f8565b34801561033d57600080fd5b5061035161034c3660046132d8565b6108ee565b005b34801561035f57600080fd5b5061039761036e36600461338c565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020016102f8565b3480156103d457600080fd5b506035545b6040519081526020016102f8565b610351610971565b3480156103fb57600080fd5b5061032161040a36600461334b565b610be2565b34801561041b57600080fd5b506103d960995481565b34801561043157600080fd5b506103516104403660046132d8565b610ca1565b34801561045157600080fd5b5061035161046036600461350a565b610d92565b34801561047157600080fd5b50604051601281526020016102f8565b34801561048d57600080fd5b506103d9609a5481565b3480156104a357600080fd5b506103216104b23660046134bc565b610f66565b3480156104c357600080fd5b506104df73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b0390911681526020016102f8565b34801561050357600080fd5b5060a1546103219060ff1681565b34801561051d57600080fd5b5061035161052c36600461340c565b610fa2565b34801561053d57600080fd5b5061035161054c36600461350a565b611125565b34801561055d57600080fd5b506103d9609c5481565b34801561057357600080fd5b506103d96105823660046132d8565b6001600160a01b031660009081526033602052604090205490565b3480156105a957600080fd5b506103d9609b5481565b3480156105bf57600080fd5b50609d546105d490600160a01b900460ff1681565b6040516102f8919061353c565b3480156105ed57600080fd5b506103516105fc3660046132d8565b61179a565b34801561060d57600080fd5b50609d546104df906001600160a01b031681565b34801561062d57600080fd5b5061035161063c36600461350a565b611a0b565b34801561064d57600080fd5b506102eb611b6e565b34801561066257600080fd5b50610351611b7d565b34801561067757600080fd5b506103d960a25481565b34801561068d57600080fd5b5061032161069c3660046134bc565b611cb5565b3480156106ad57600080fd5b506103216106bc3660046134bc565b611d66565b3480156106cd57600080fd5b506103d960a05481565b3480156106e357600080fd5b506103d960985481565b3480156106f957600080fd5b50610351611d73565b610351611eb1565b34801561071657600080fd5b506103d96107253660046132d8565b60a36020526000908152604090205481565b34801561074357600080fd5b506103516120f3565b34801561075857600080fd5b506103d96120fd565b34801561076d57600080fd5b506103d961077c366004613312565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b3480156107b357600080fd5b506103d9609f5481565b3480156107c957600080fd5b506104df7f000000000000000000000000000000000000000000000000000000000000000081565b3480156107fd57600080fd5b50609e546104df906001600160a01b031681565b34801561081d57600080fd5b50610351612124565b34801561083257600080fd5b506097546104df906001600160a01b031681565b60606036805461085590613629565b80601f016020809104026020016040519081016040528092919081815260200182805461088190613629565b80156108ce5780601f106108a3576101008083540402835291602001916108ce565b820191906000526020600020905b8154815290600101906020018083116108b157829003601f168201915b5050505050905090565b60006108e53384846122c2565b50600192915050565b609e546001600160a01b031633146109425760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b60448201526064015b60405180910390fd5b609e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001609d54600160a01b900460ff1660038111156109915761099161367a565b146109de5760405162461bcd60e51b815260206004820152601760248201527f6269643a61756374696f6e206973206e6f74206c6976650000000000000000006044820152606401610939565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637c513c0f6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610a3b57600080fd5b505af1158015610a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a739190613523565b610a7f906103e86135b9565b905080609c54610a8f91906135f3565b610a9b346103e86135f3565b1015610ae95760405162461bcd60e51b815260206004820152600f60248201527f6269643a746f6f206c6f772062696400000000000000000000000000000000006044820152606401610939565b6099544210610b3a5760405162461bcd60e51b815260206004820152601160248201527f6269643a61756374696f6e20656e6465640000000000000000000000000000006044820152606401610939565b61038442609954610b4b9190613612565b11610b6a5761038460996000828254610b6491906135b9565b90915550505b609d54609c54610b83916001600160a01b03169061241a565b34609c819055609d805473ffffffffffffffffffffffffffffffffffffffff191633908117909155604051918252907fe684a55f31b79eca403df938249029212a5925ec6be8012e099b45bc1019e5d29060200160405180910390a250565b6000610bef8484846125c2565b6001600160a01b038416600090815260346020908152604080832033845290915290205482811015610c895760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e63650000000000000000000000000000000000000000000000006064820152608401610939565b610c9685338584036122c2565b506001949350505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cfa57600080fd5b505afa158015610d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3291906132f5565b6001600160a01b0316336001600160a01b0316146109425760405162461bcd60e51b815260206004820152600c60248201527f6b69636b3a6e6f7420676f7600000000000000000000000000000000000000006044820152606401610939565b609e546001600160a01b03163314610de15760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b6044820152606401610939565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a0b335e36040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610e3c57600080fd5b505af1158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e749190613523565b8110158015610f1557507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630e519ef96040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610ed957600080fd5b505af1158015610eed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f119190613523565b8111155b610f615760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a696e76616c69642061756374696f6e206c656e6774680000006044820152606401610939565b609a55565b3360008181526034602090815260408083206001600160a01b038716845290915281205490916108e5918590610f9d9086906135b9565b6122c2565b600054610100900460ff1680610fbb575060005460ff16155b61101e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610939565b600054610100900460ff16158015611040576000805461ffff19166101011790555b61104a83836127e5565b6110526128ab565b6097805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038a16179055609887905561108986866135f3565b609b5562093a80609a55609e805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038b16179055609f8490554260a05584156110d057856110d3565b60005b60a255609d805460ff60a01b191690556110ed8987612966565b6001600160a01b038916600090815260a360205260409020859055801561111a576000805461ff00191690555b505050505050505050565b6000609d54600160a01b900460ff1660038111156111455761114561367a565b146111a25760405162461bcd60e51b815260206004820152602760248201527f7570646174653a61756374696f6e206c6976652063616e6e6f742075706461746044820152666520707269636560c81b6064820152608401610939565b33600090815260a36020526040902054818114156112025760405162461bcd60e51b815260206004820152601460248201527f7570646174653a6e6f7420616e207570646174650000000000000000000000006044820152606401610939565b3360009081526033602052604090205460a2546112305760a281905561122883826135f3565b609b55611749565b60a2548114801561124057508115155b1561124f5761122883826135f3565b816114a557600060a254609b5461126691906135d1565b905060006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166309990a966040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156112c857600080fd5b505af11580156112dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113009190613523565b61130a90846135f3565b61131491906135d1565b9050808510156113665760405162461bcd60e51b815260206004820152601c60248201527f7570646174653a7265736572766520707269636520746f6f206c6f77000000006044820152606401610939565b60006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635410bfc96040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156113c657600080fd5b505af11580156113da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113fe9190613523565b61140890856135f3565b61141291906135d1565b9050808611156114645760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a7265736572766520707269636520746f6f20686967680000006044820152606401610939565b8360a2600082825461147691906135b9565b90915550611486905086856135f3565b609b600082825461149791906135b9565b909155506117499350505050565b826114e8578060a260008282546114bc9190613612565b909155506114cc905082826135f3565b609b60008282546114dd9190613612565b909155506117499050565b60008160a2546114f89190613612565b61150283856135f3565b609b5461150f9190613612565b61151991906135d1565b905060006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166309990a966040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561157b57600080fd5b505af115801561158f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b39190613523565b6115bd90846135f3565b6115c791906135d1565b9050808510156116195760405162461bcd60e51b815260206004820152601c60248201527f7570646174653a7265736572766520707269636520746f6f206c6f77000000006044820152606401610939565b60006103e87f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635410bfc96040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561167957600080fd5b505af115801561168d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b19190613523565b6116bb90856135f3565b6116c591906135d1565b9050808611156117175760405162461bcd60e51b815260206004820152601d60248201527f7570646174653a7265736572766520707269636520746f6f20686967680000006044820152606401610939565b61172185856135f3565b61172b87866135f3565b609b5461173891906135b9565b6117429190613612565b609b555050505b33600081815260a3602052604090819020859055517f64e6e7bd72b853c4e62fd6ceaca05a104700c70a4cb567c75c7f2242ba7f037c9061178d9086815260200190565b60405180910390a2505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156117f357600080fd5b505afa158015611807573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182b91906132f5565b6001600160a01b0316336001600160a01b03161461188b5760405162461bcd60e51b815260206004820152600e60248201527f72656d6f76653a6e6f7420676f760000000000000000000000000000000000006044820152606401610939565b6000609d54600160a01b900460ff1660038111156118ab576118ab61367a565b146119085760405162461bcd60e51b815260206004820152602760248201527f7570646174653a61756374696f6e206c6976652063616e6e6f742075706461746044820152666520707269636560c81b6064820152608401610939565b6001600160a01b038116600090815260a360205260409020548061196e5760405162461bcd60e51b815260206004820152601460248201527f7570646174653a6e6f7420616e207570646174650000000000000000000000006044820152606401610939565b6001600160a01b03821660009081526033602052604081205490508060a2600082825461199b9190613612565b909155506119ab905082826135f3565b609b60008282546119bc9190613612565b90915550506001600160a01b038316600081815260a360209081526040808320839055519182527f64e6e7bd72b853c4e62fd6ceaca05a104700c70a4cb567c75c7f2242ba7f037c910161178d565b609e546001600160a01b03163314611a5a5760405162461bcd60e51b81526020600482015260126024820152713ab83230ba329d3737ba1031bab930ba37b960711b6044820152606401610939565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638a364bc16040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611ab557600080fd5b505af1158015611ac9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aed9190613523565b811115611b615760405162461bcd60e51b8152602060048201526024808201527f7570646174653a63616e6e6f7420696e6372656173652066656520746869732060448201527f68696768000000000000000000000000000000000000000000000000000000006064820152608401610939565b611b69612a51565b609f55565b60606037805461085590613629565b6002609d54600160a01b900460ff166003811115611b9d57611b9d61367a565b14611bea5760405162461bcd60e51b815260206004820152601960248201527f636173683a7661756c74206e6f7420636c6f73656420796574000000000000006044820152606401610939565b3360009081526033602052604090205480611c475760405162461bcd60e51b815260206004820152601a60248201527f636173683a6e6f20746f6b656e7320746f2063617368206f75740000000000006044820152606401610939565b6000611c5260355490565b611c5c47846135f3565b611c6691906135d1565b9050611c723383612cda565b611c7c3382612e6b565b60405181815233907f730831a1e4aa2d187ddd8e03d7beeac760a3927da5f112d645e0f8df7494b3679060200160405180910390a25050565b3360009081526034602090815260408083206001600160a01b038616845290915281205482811015611d4f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610939565b611d5c33858584036122c2565b5060019392505050565b60006108e53384846125c2565b6000609d54600160a01b900460ff166003811115611d9357611d9361367a565b14611de05760405162461bcd60e51b815260206004820152601360248201527f72656465656d3a6e6f2072656465656d696e67000000000000000000000000006044820152606401610939565b611df233611ded60355490565b612cda565b6097546098546040516323b872dd60e01b815230600482015233602482015260448101919091526001600160a01b03909116906323b872dd90606401600060405180830381600087803b158015611e4857600080fd5b505af1158015611e5c573d6000803e3d6000fd5b5050609d805460ff60a01b191674030000000000000000000000000000000000000000179055505060405133907fd1b5ea7fe0f1c2fa09d49c2aa9b2200664ba57a734f1d95481d95b7f99af991c90600090a2565b6000609d54600160a01b900460ff166003811115611ed157611ed161367a565b14611f1e5760405162461bcd60e51b815260206004820152601760248201527f73746172743a6e6f2061756374696f6e207374617274730000000000000000006044820152606401610939565b611f266120fd565b341015611f755760405162461bcd60e51b815260206004820152601160248201527f73746172743a746f6f206c6f77206269640000000000000000000000000000006044820152606401610939565b6035547f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166332977c736040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611fd357600080fd5b505af1158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b9190613523565b61201591906135f3565b60a254612024906103e86135f3565b10156120725760405162461bcd60e51b815260206004820152601760248201527f73746172743a6e6f7420656e6f75676820766f746572730000000000000000006044820152606401610939565b609a5461207f90426135b9565b609955609d805434609c8190557fffffffffffffffffffffff00000000000000000000000000000000000000000090911633908117600160a01b179092556040519081527fcfb9c5312b25ec7b809d61e638df25f749eae5d5c25399e1c93d1d319bfd5821906020015b60405180910390a2565b6120fb612a51565b565b600060a25460001461211e5760a254609b5461211991906135d1565b905090565b50600090565b6001609d54600160a01b900460ff1660038111156121445761214461367a565b146121915760405162461bcd60e51b815260206004820152601c60248201527f656e643a7661756c742068617320616c726561647920636c6f736564000000006044820152606401610939565b6099544210156121e35760405162461bcd60e51b815260206004820152601060248201527f656e643a61756374696f6e206c697665000000000000000000000000000000006044820152606401610939565b6121eb612a51565b609754609d546098546040516323b872dd60e01b81523060048201526001600160a01b03928316602482015260448101919091529116906323b872dd90606401600060405180830381600087803b15801561224557600080fd5b505af1158015612259573d6000803e3d6000fd5b5050609d80547402000000000000000000000000000000000000000060ff60a01b19821617909155609c546040519081526001600160a01b0390911692507f8b01f9dd0400d6a1e84369a5fb8f6033934856ffa8ebadd707dca302ab55169591506020016120e9565b6001600160a01b03831661233d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610939565b6001600160a01b0382166123b95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610939565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561246957600080fd5b505af115801561247d573d6000803e3d6000fd5b50506040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2935063a9059cbb925085915083906370a082319060240160206040518083038186803b1580156124ef57600080fd5b505afa158015612503573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125279190613523565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561258557600080fd5b505af1158015612599573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125bd91906134e8565b505050565b6001600160a01b03831661263e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610939565b6001600160a01b0382166126ba5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610939565b6126c5838383612f00565b6001600160a01b038316600090815260336020526040902054818110156127545760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610939565b6001600160a01b0380851660009081526033602052604080822085850390559185168152908120805484929061278b9084906135b9565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516127d791815260200190565b60405180910390a350505050565b600054610100900460ff16806127fe575060005460ff16155b6128615760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610939565b600054610100900460ff16158015612883576000805461ffff19166101011790555b61288b613015565b61289583836130c6565b80156125bd576000805461ff0019169055505050565b600054610100900460ff16806128c4575060005460ff16155b6129275760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610939565b600054610100900460ff16158015612949576000805461ffff19166101011790555b612951613015565b8015612963576000805461ff00191690555b50565b6001600160a01b0382166129bc5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610939565b6129c860008383612f00565b80603560008282546129da91906135b9565b90915550506001600160a01b03821660009081526033602052604081208054839290612a079084906135b9565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6002609d54600160a01b900460ff166003811115612a7157612a7161367a565b1415612ae55760405162461bcd60e51b815260206004820152602560248201527f636c61696d3a63616e6e6f7420636c61696d2061667465722061756374696f6e60448201527f20656e64730000000000000000000000000000000000000000000000000000006064820152608401610939565b60006103e8612af360355490565b609f54612b0091906135f3565b612b0a91906135d1565b90506000612b1c6301e13380836135d1565b9050600060a05442612b2e9190613612565b90506000612b3c83836135f3565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b3f006746040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612b9b57600080fd5b505af1158015612baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd391906132f5565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630ea90a126040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612c3257600080fd5b505af1158015612c46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6a9190613523565b90506103e8612c7860355490565b612c8290836135f3565b612c8c91906135d1565b9550612c9c6301e13380876135d1565b94506000612caa86866135f3565b4260a055609e54909150612cc7906001600160a01b031685612966565b612cd18382612966565b50505050505050565b6001600160a01b038216612d565760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610939565b612d6282600083612f00565b6001600160a01b03821660009081526033602052604090205481811015612df15760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610939565b6001600160a01b0383166000908152603360205260408120838303905560358054849290612e20908490613612565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b6001600160a01b0382163b15612eca5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561246957600080fd5b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156125bd573d6000803e3d6000fd5b6001600160a01b03831615801590612f3557506000609d54600160a01b900460ff166003811115612f3357612f3361367a565b145b156125bd576001600160a01b03808416600090815260a3602052604080822054928516825290205480821461300e5780612fa7578260a26000828254612f7b9190613612565b90915550612f8b905082846135f3565b609b6000828254612f9c9190613612565b9091555061300e9050565b81612fdf578260a26000828254612fbe91906135b9565b90915550612fce905081846135f3565b609b6000828254612f9c91906135b9565b612fe982846135f3565b612ff382856135f3565b609b5461300091906135b9565b61300a9190613612565b609b555b5050505050565b600054610100900460ff168061302e575060005460ff16155b6130915760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610939565b600054610100900460ff16158015612951576000805461ffff19166101011790558015612963576000805461ff001916905550565b600054610100900460ff16806130df575060005460ff16155b6131425760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610939565b600054610100900460ff16158015613164576000805461ffff19166101011790555b82516131779060369060208601906131a2565b50815161318b9060379060208501906131a2565b5080156125bd576000805461ff0019169055505050565b8280546131ae90613629565b90600052602060002090601f0160209004810192826131d05760008555613216565b82601f106131e957805160ff1916838001178555613216565b82800160010185558215613216579182015b828111156132165782518255916020019190600101906131fb565b50613222929150613226565b5090565b5b808211156132225760008155600101613227565b600067ffffffffffffffff8084111561325657613256613690565b604051601f8501601f19908116603f0116810190828211818310171561327e5761327e613690565b8160405280935085815286868601111561329757600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126132c257600080fd5b6132d18383356020850161323b565b9392505050565b6000602082840312156132ea57600080fd5b81356132d1816136a6565b60006020828403121561330757600080fd5b81516132d1816136a6565b6000806040838503121561332557600080fd5b8235613330816136a6565b91506020830135613340816136a6565b809150509250929050565b60008060006060848603121561336057600080fd5b833561336b816136a6565b9250602084013561337b816136a6565b929592945050506040919091013590565b600080600080608085870312156133a257600080fd5b84356133ad816136a6565b935060208501356133bd816136a6565b925060408501359150606085013567ffffffffffffffff8111156133e057600080fd5b8501601f810187136133f157600080fd5b6134008782356020840161323b565b91505092959194509250565b600080600080600080600080610100898b03121561342957600080fd5b8835613434816136a6565b97506020890135613444816136a6565b965060408901359550606089013594506080890135935060a0890135925060c089013567ffffffffffffffff8082111561347d57600080fd5b6134898c838d016132b1565b935060e08b013591508082111561349f57600080fd5b506134ac8b828c016132b1565b9150509295985092959890939650565b600080604083850312156134cf57600080fd5b82356134da816136a6565b946020939093013593505050565b6000602082840312156134fa57600080fd5b815180151581146132d157600080fd5b60006020828403121561351c57600080fd5b5035919050565b60006020828403121561353557600080fd5b5051919050565b602081016004831061355e57634e487b7160e01b600052602160045260246000fd5b91905290565b600060208083528351808285015260005b8181101561359157858101830151858201604001528201613575565b818111156135a3576000604083870101525b50601f01601f1916929092016040019392505050565b600082198211156135cc576135cc613664565b500190565b6000826135ee57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561360d5761360d613664565b500290565b60008282101561362457613624613664565b500390565b600181811c9082168061363d57607f821691505b6020821081141561365e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461296357600080fdfea264697066735822122009eaa460294f2586548fcee7adf930582315b96b5b120dd2d4ae489c62917b0a64736f6c63430008050033000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca
Deployed Bytecode
0x60806040523480156200001157600080fd5b5060043610620000d95760003560e01c80638da5cb5b116200008b578063d7dfa0dd1162000062578063d7dfa0dd14620001a7578063e06174e414620001cf578063f2fde38b14620001f757600080fd5b80638da5cb5b1462000165578063a7c6a1001462000177578063bdc01110146200019057600080fd5b8063715018a611620000c0578063715018a6146200010c5780638456cb5914620001165780638c64ea4a146200012057600080fd5b80633f4ba83a14620000de5780635c975abb14620000ea575b600080fd5b620000e86200020e565b005b600054600160a01b900460ff1660405190151581526020015b60405180910390f35b620000e86200027a565b620000e86200032d565b6200014c6200013136600462000a2e565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200162000103565b6000546001600160a01b03166200014c565b6200018160015481565b60405190815260200162000103565b62000181620001a13660046200098c565b62000393565b6200014c7f0000000000000000000000007b0fce54574d9746414d11367f54c9ab94e53dca81565b6200014c7f000000000000000000000000e0fc79183a22106229b84ecdd55ca017a07eddca81565b620000e86200020836600462000967565b62000625565b6000546001600160a01b031633146200026e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6200027862000767565b565b6000546001600160a01b03163314620002d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000265565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b03163314620003895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000265565b620002786200080f565b60008054600160a01b900460ff1615620003f05760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640162000265565b60003387878787878e8e6040516024016200041398979695949392919062000a98565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f626fb2f000000000000000000000000000000000000000000000000000000000179052519091506000907f0000000000000000000000007b0fce54574d9746414d11367f54c9ab94e53dca908390620004a190620008a7565b620004ae92919062000b04565b604051809103906000f080158015620004cb573d6000803e3d6000fd5b509050876001600160a01b03167ff9c32fbc56ff04f32a233ebc26e388564223745e28abd8d0781dd906537f563e8887846001546040516200052f949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b60405180910390a26040517f42842e0e0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038281166024830152604482018990528916906342842e0e90606401600060405180830381600087803b158015620005a157600080fd5b505af1158015620005b6573d6000803e3d6000fd5b5050600180546000908152600260205260408120805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03871617905581549350909150620006028362000b4a565b91905055506001805462000617919062000b30565b9a9950505050505050505050565b6000546001600160a01b03163314620006815760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000265565b6001600160a01b038116620006ff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840162000265565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600054600160a01b900460ff16620007c25760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640162000265565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600054600160a01b900460ff16156200086b5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640162000265565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620007f23390565b6103578062000b9583390190565b80356001600160a01b0381168114620008cd57600080fd5b919050565b600082601f830112620008e457600080fd5b813567ffffffffffffffff8082111562000902576200090262000b7e565b604051601f8301601f19908116603f011681019082821181831017156200092d576200092d62000b7e565b816040528381528660208588010111156200094757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156200097a57600080fd5b6200098582620008b5565b9392505050565b600080600080600080600060e0888a031215620009a857600080fd5b873567ffffffffffffffff80821115620009c157600080fd5b620009cf8b838c01620008d2565b985060208a0135915080821115620009e657600080fd5b50620009f58a828b01620008d2565b96505062000a0660408901620008b5565b969995985095966060810135965060808101359560a0820135955060c0909101359350915050565b60006020828403121562000a4157600080fd5b5035919050565b6000815180845260005b8181101562000a705760208185018101518683018201520162000a52565b8181111562000a83576000602083870101525b50601f01601f19169290920160200192915050565b60006101006001600160a01b03808c168452808b166020850152508860408401528760608401528660808401528560a08401528060c084015262000adf8184018662000a48565b905082810360e084015262000af5818562000a48565b9b9a5050505050505050505050565b6001600160a01b038316815260406020820152600062000b28604083018462000a48565b949350505050565b60008282101562000b455762000b4562000b68565b500390565b600060001982141562000b615762000b6162000b68565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe60a060405234801561001057600080fd5b5060405161035738038061035783398101604081905261002f916100d7565b6001600160601b0319606083901b1660805260405160009081906001600160a01b0385169061005f9085906101a5565b600060405180830381855af49150503d806000811461009a576040519150601f19603f3d011682016040523d82523d6000602084013e61009f565b606091505b50915091508181906100cd5760405162461bcd60e51b81526004016100c491906101c1565b60405180910390fd5b505050505061023a565b600080604083850312156100ea57600080fd5b82516001600160a01b038116811461010157600080fd5b60208401519092506001600160401b038082111561011e57600080fd5b818501915085601f83011261013257600080fd5b81518181111561014457610144610224565b604051601f8201601f19908116603f0116810190838211818310171561016c5761016c610224565b8160405282815288602084870101111561018557600080fd5b6101968360208301602088016101f4565b80955050505050509250929050565b600082516101b78184602087016101f4565b9190910192915050565b60208152600082518060208401526101e08160408501602087016101f4565b601f01601f19169190910160400192915050565b60005b8381101561020f5781810151838201526020016101f7565b8381111561021e576000848401525b50505050565b634e487b7160e01b600052604160045260246000fd5b60805160601c60fc61025b60003960008181602a0152607b015260fc6000f3fe608060405260043610601f5760003560e01c8063d7dfa0dd14606b576025565b36602557005b6040517f00000000000000000000000000000000000000000000000000000000000000009036600082376000803683855af43d806000843e8180156067578184f35b8184fd5b348015607657600080fd5b50609d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f3fea264697066735822122013174273c18ed4bea127cbc0952900378004a1870c433d85adc8dafba30dae5764736f6c63430008050033a2646970667358221220ba70a56848ff1300b0acc89509d945d46863341057515849573a7e6aa090b12464736f6c63430008050033
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.