{ "language": "Solidity", "sources": { "contracts/NounsBRAuctionHouse.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/// @title The NounsBR DAO auction house\n\n/*********************************\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░██░░░████░░██░░░████░░░ *\n * ░░██████░░░████████░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n *********************************/\n\n// LICENSE\n// NounsBRAuctionHouse.sol is a modified version of Zora's AuctionHouse.sol:\n// https://github.com/ourzora/auction-house/blob/54a12ec1a6cf562e49f0a4917990474b11350a2d/contracts/AuctionHouse.sol\n//\n// AuctionHouse.sol source code Copyright Zora licensed under the GPL-3.0 license.\n// With modifications by NoundersBR DAO.\n\npragma solidity ^0.8.6;\n\nimport { PausableUpgradeable } from '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';\nimport { ReentrancyGuardUpgradeable } from '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';\nimport { OwnableUpgradeable } from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';\nimport { IERC20 } from '@openzeppelin/contracts/token/ERC20/IERC20.sol';\nimport { INounsBRAuctionHouse } from './interfaces/INounsBRAuctionHouse.sol';\nimport { INounsBRToken } from './interfaces/INounsBRToken.sol';\nimport { IWETH } from './interfaces/IWETH.sol';\n\ncontract NounsBRAuctionHouse is\n INounsBRAuctionHouse,\n PausableUpgradeable,\n ReentrancyGuardUpgradeable,\n OwnableUpgradeable\n{\n // The NounsBR ERC721 token contract\n INounsBRToken public nounsbr;\n\n // The address of the WETH contract\n address public weth;\n\n // The minimum amount of time left in an auction after a new bid is created\n uint256 public timeBuffer;\n\n // The minimum price accepted in an auction\n uint256 public reservePrice;\n\n // The minimum percentage difference between the last bid amount and the current bid\n uint8 public minBidIncrementPercentage;\n\n // The duration of a single auction\n uint256 public duration;\n\n // The active auction\n INounsBRAuctionHouse.Auction public auction;\n\n /**\n * @notice Initialize the auction house and base contracts,\n * populate configuration values, and pause the contract.\n * @dev This function can only be called once.\n */\n function initialize(\n INounsBRToken _nounsbr,\n address _weth,\n uint256 _timeBuffer,\n uint256 _reservePrice,\n uint8 _minBidIncrementPercentage,\n uint256 _duration\n ) external initializer {\n __Pausable_init();\n __ReentrancyGuard_init();\n __Ownable_init();\n\n _pause();\n\n nounsbr = _nounsbr;\n weth = _weth;\n timeBuffer = _timeBuffer;\n reservePrice = _reservePrice;\n minBidIncrementPercentage = _minBidIncrementPercentage;\n duration = _duration;\n }\n\n /**\n * @notice Settle the current auction, mint a new NounBR, and put it up for auction.\n */\n function settleCurrentAndCreateNewAuction() external override nonReentrant whenNotPaused {\n _settleAuction();\n _createAuction();\n }\n\n /**\n * @notice Settle the current auction.\n * @dev This function can only be called when the contract is paused.\n */\n function settleAuction() external override whenPaused nonReentrant {\n _settleAuction();\n }\n\n /**\n * @notice Create a bid for a NounBR, with a given amount.\n * @dev This contract only accepts payment in ETH.\n */\n function createBid(uint256 nounbrId) external payable override nonReentrant {\n INounsBRAuctionHouse.Auction memory _auction = auction;\n\n require(_auction.nounbrId == nounbrId, 'NounBR not up for auction');\n require(block.timestamp < _auction.endTime, 'Auction expired');\n require(msg.value >= reservePrice, 'Must send at least reservePrice');\n require(\n msg.value >= _auction.amount + ((_auction.amount * minBidIncrementPercentage) / 100),\n 'Must send more than last bid by minBidIncrementPercentage amount'\n );\n\n address payable lastBidder = _auction.bidder;\n\n // Refund the last bidder, if applicable\n if (lastBidder != address(0)) {\n _safeTransferETHWithFallback(lastBidder, _auction.amount);\n }\n\n auction.amount = msg.value;\n auction.bidder = payable(msg.sender);\n\n // Extend the auction if the bid was received within `timeBuffer` of the auction end time\n bool extended = _auction.endTime - block.timestamp < timeBuffer;\n if (extended) {\n auction.endTime = _auction.endTime = block.timestamp + timeBuffer;\n }\n\n emit AuctionBid(_auction.nounbrId, msg.sender, msg.value, extended);\n\n if (extended) {\n emit AuctionExtended(_auction.nounbrId, _auction.endTime);\n }\n }\n\n /**\n * @notice Pause the NounsBR auction house.\n * @dev This function can only be called by the owner when the\n * contract is unpaused. While no new auctions can be started when paused,\n * anyone can settle an ongoing auction.\n */\n function pause() external override onlyOwner {\n _pause();\n }\n\n /**\n * @notice Unpause the NounsBR auction house.\n * @dev This function can only be called by the owner when the\n * contract is paused. If required, this function will start a new auction.\n */\n function unpause() external override onlyOwner {\n _unpause();\n\n if (auction.startTime == 0 || auction.settled) {\n _createAuction();\n }\n }\n\n /**\n * @notice Set the auction time buffer.\n * @dev Only callable by the owner.\n */\n function setTimeBuffer(uint256 _timeBuffer) external override onlyOwner {\n timeBuffer = _timeBuffer;\n\n emit AuctionTimeBufferUpdated(_timeBuffer);\n }\n\n /**\n * @notice Set the auction reserve price.\n * @dev Only callable by the owner.\n */\n function setReservePrice(uint256 _reservePrice) external override onlyOwner {\n reservePrice = _reservePrice;\n\n emit AuctionReservePriceUpdated(_reservePrice);\n }\n\n /**\n * @notice Set the auction minimum bid increment percentage.\n * @dev Only callable by the owner.\n */\n function setMinBidIncrementPercentage(uint8 _minBidIncrementPercentage) external override onlyOwner {\n minBidIncrementPercentage = _minBidIncrementPercentage;\n\n emit AuctionMinBidIncrementPercentageUpdated(_minBidIncrementPercentage);\n }\n\n /**\n * @notice Create an auction.\n * @dev Store the auction details in the `auction` state variable and emit an AuctionCreated event.\n * If the mint reverts, the minter was updated without pausing this contract first. To remedy this,\n * catch the revert and pause this contract.\n */\n function _createAuction() internal {\n try nounsbr.mint() returns (uint256 nounbrId) {\n uint256 startTime = block.timestamp;\n uint256 endTime = startTime + duration;\n\n auction = Auction({\n nounbrId: nounbrId,\n amount: 0,\n startTime: startTime,\n endTime: endTime,\n bidder: payable(0),\n settled: false\n });\n\n emit AuctionCreated(nounbrId, startTime, endTime);\n } catch Error(string memory) {\n _pause();\n }\n }\n\n /**\n * @notice Settle an auction, finalizing the bid and paying out to the owner.\n * @dev If there are no bids, the NounBR is burned.\n */\n function _settleAuction() internal {\n INounsBRAuctionHouse.Auction memory _auction = auction;\n\n require(_auction.startTime != 0, \"Auction hasn't begun\");\n require(!_auction.settled, 'Auction has already been settled');\n require(block.timestamp >= _auction.endTime, \"Auction hasn't completed\");\n\n auction.settled = true;\n\n if (_auction.bidder == address(0)) {\n nounsbr.burn(_auction.nounbrId);\n } else {\n nounsbr.transferFrom(address(this), _auction.bidder, _auction.nounbrId);\n }\n\n if (_auction.amount > 0) {\n _safeTransferETHWithFallback(owner(), _auction.amount);\n }\n\n emit AuctionSettled(_auction.nounbrId, _auction.bidder, _auction.amount);\n }\n\n /**\n * @notice Transfer ETH. If the ETH transfer fails, wrap the ETH and try send it as WETH.\n */\n function _safeTransferETHWithFallback(address to, uint256 amount) internal {\n if (!_safeTransferETH(to, amount)) {\n IWETH(weth).deposit{ value: amount }();\n IERC20(weth).transfer(to, amount);\n }\n }\n\n /**\n * @notice Transfer ETH and return the success status.\n * @dev This function only forwards 30,000 gas to the callee.\n */\n function _safeTransferETH(address to, uint256 value) internal returns (bool) {\n (bool success, ) = to.call{ value: value, gas: 30_000 }(new bytes(0));\n return success;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal initializer {\n __Context_init_unchained();\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal initializer {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n uint256[49] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuardUpgradeable is Initializable {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n function __ReentrancyGuard_init() internal initializer {\n __ReentrancyGuard_init_unchained();\n }\n\n function __ReentrancyGuard_init_unchained() internal initializer {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n uint256[49] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal initializer {\n __Context_init_unchained();\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal initializer {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n uint256[49] private __gap;\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" }, "contracts/interfaces/INounsBRAuctionHouse.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/// @title Interface for NounBR Auction Houses\n\n/*********************************\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░██░░░████░░██░░░████░░░ *\n * ░░██████░░░████████░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n *********************************/\n\npragma solidity ^0.8.6;\n\ninterface INounsBRAuctionHouse {\n struct Auction {\n // ID for the NounBR (ERC721 token ID)\n uint256 nounbrId;\n // The current highest bid amount\n uint256 amount;\n // The time that the auction started\n uint256 startTime;\n // The time that the auction is scheduled to end\n uint256 endTime;\n // The address of the current highest bid\n address payable bidder;\n // Whether or not the auction has been settled\n bool settled;\n }\n\n event AuctionCreated(uint256 indexed nounbrId, uint256 startTime, uint256 endTime);\n\n event AuctionBid(uint256 indexed nounbrId, address sender, uint256 value, bool extended);\n\n event AuctionExtended(uint256 indexed nounbrId, uint256 endTime);\n\n event AuctionSettled(uint256 indexed nounbrId, address winner, uint256 amount);\n\n event AuctionTimeBufferUpdated(uint256 timeBuffer);\n\n event AuctionReservePriceUpdated(uint256 reservePrice);\n\n event AuctionMinBidIncrementPercentageUpdated(uint256 minBidIncrementPercentage);\n\n function settleAuction() external;\n\n function settleCurrentAndCreateNewAuction() external;\n\n function createBid(uint256 nounbrId) external payable;\n\n function pause() external;\n\n function unpause() external;\n\n function setTimeBuffer(uint256 timeBuffer) external;\n\n function setReservePrice(uint256 reservePrice) external;\n\n function setMinBidIncrementPercentage(uint8 minBidIncrementPercentage) external;\n}\n" }, "contracts/interfaces/INounsBRToken.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/// @title Interface for NounsBRToken\n\n/*********************************\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░██░░░████░░██░░░████░░░ *\n * ░░██████░░░████████░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n *********************************/\n\npragma solidity ^0.8.6;\n\nimport { IERC721 } from '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport { INounsBRDescriptorMinimal } from './INounsBRDescriptorMinimal.sol';\nimport { INounsBRSeeder } from './INounsBRSeeder.sol';\n\ninterface INounsBRToken is IERC721 {\n event NounBRCreated(uint256 indexed tokenId, INounsBRSeeder.Seed seed);\n\n event NounBRBurned(uint256 indexed tokenId);\n\n event NoundersBRDAOUpdated(address noundersbrDAO);\n\n event MinterUpdated(address minter);\n\n event MinterLocked();\n\n event DescriptorUpdated(INounsBRDescriptorMinimal descriptor);\n\n event DescriptorLocked();\n\n event SeederUpdated(INounsBRSeeder seeder);\n\n event SeederLocked();\n\n function mint() external returns (uint256);\n\n function burn(uint256 tokenId) external;\n\n function dataURI(uint256 tokenId) external returns (string memory);\n\n function setNoundersBRDAO(address noundersbrDAO) external;\n\n function setMinter(address minter) external;\n\n function lockMinter() external;\n\n function setDescriptor(INounsBRDescriptorMinimal descriptor) external;\n\n function lockDescriptor() external;\n\n function setSeeder(INounsBRSeeder seeder) external;\n\n function lockSeeder() external;\n}\n" }, "contracts/interfaces/IWETH.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.6;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256 wad) external;\n\n function transfer(address to, uint256 value) external returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal initializer {\n __Context_init_unchained();\n }\n\n function __Context_init_unchained() internal initializer {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(_initializing || !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/INounsBRDescriptorMinimal.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/// @title Common interface for NounsBRDescriptor versions, as used by NounsBRToken and NounsBRSeeder.\n\n/*********************************\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░██░░░████░░██░░░████░░░ *\n * ░░██████░░░████████░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n *********************************/\n\npragma solidity ^0.8.6;\n\nimport { INounsBRSeeder } from './INounsBRSeeder.sol';\n\ninterface INounsBRDescriptorMinimal {\n ///\n /// USED BY TOKEN\n ///\n\n function tokenURI(uint256 tokenId, INounsBRSeeder.Seed memory seed) external view returns (string memory);\n\n function dataURI(uint256 tokenId, INounsBRSeeder.Seed memory seed) external view returns (string memory);\n\n ///\n /// USED BY SEEDER\n ///\n\n function backgroundCount() external view returns (uint256);\n\n function bodyCount() external view returns (uint256);\n\n function accessoryCount() external view returns (uint256);\n\n function headCount() external view returns (uint256);\n\n function glassesCount() external view returns (uint256);\n}\n" }, "contracts/interfaces/INounsBRSeeder.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/// @title Interface for NounsBRSeeder\n\n/*********************************\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░██░░░████░░██░░░████░░░ *\n * ░░██████░░░████████░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░██░░██░░░████░░██░░░████░░░ *\n * ░░░░░░█████████░░█████████░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *\n *********************************/\n\npragma solidity ^0.8.6;\n\nimport { INounsBRDescriptorMinimal } from './INounsBRDescriptorMinimal.sol';\n\ninterface INounsBRSeeder {\n struct Seed {\n uint48 background;\n uint48 body;\n uint48 accessory;\n uint48 head;\n uint48 glasses;\n }\n\n function generateSeed(uint256 nounbrId, INounsBRDescriptorMinimal descriptor) external view returns (Seed memory);\n}\n" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }