Verified contractExactMIT
Garden
Address0xd28de34e1d739e5b60e50c77fe64cfa8eb072066
- Balance
0 ETH
- Transactions
8
- Compiler
solc 0.8.38
- Same code
Only this contract
Details
- Compiler
- solc 0.8.38+commit.1835d247
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,377,105
- Creation transaction
- 0x2d3e0610b8…3fbab96bcc
58 files
The source code is large: one file is shown at a time. Choose a file in the list.
- project/contracts/drops/garden/Garden.solmain9.75 KB
- npm/@1001-digital/[email protected]/contracts/OneOfEachPerWallet.sol973 B
- npm/@1001-digital/[email protected]/contracts/Soulbound1155.sol873 B
- npm/@openzeppelin/[email protected]/access/Ownable2StepUpgradeable.sol3.51 KB
- npm/@openzeppelin/[email protected]/access/OwnableUpgradeable.sol4.05 KB
- npm/@openzeppelin/[email protected]/proxy/utils/Initializable.sol144 B
- npm/@openzeppelin/[email protected]/utils/ContextUpgradeable.sol1.22 KB
- npm/@openzeppelin/[email protected]/access/Ownable.sol3.1 KB
- npm/@openzeppelin/[email protected]/access/Ownable2Step.sol2.48 KB
- npm/@openzeppelin/[email protected]/interfaces/IERC5313.sol435 B
- npm/@openzeppelin/[email protected]/interfaces/draft-IERC6093.sol6.54 KB
- npm/@openzeppelin/[email protected]/proxy/utils/Initializable.sol9.28 KB
- npm/@openzeppelin/[email protected]/token/ERC1155/ERC1155.sol15.71 KB
- npm/@openzeppelin/[email protected]/token/ERC1155/IERC1155.sol4.75 KB
- npm/@openzeppelin/[email protected]/token/ERC1155/IERC1155Receiver.sol2.6 KB
- npm/@openzeppelin/[email protected]/token/ERC1155/extensions/IERC1155MetadataURI.sol677 B
- npm/@openzeppelin/[email protected]/token/ERC1155/utils/ERC1155Utils.sol3.55 KB
- npm/@openzeppelin/[email protected]/token/ERC721/ERC721.sol16.2 KB
- npm/@openzeppelin/[email protected]/token/ERC721/IERC721.sol4.93 KB
- npm/@openzeppelin/[email protected]/token/ERC721/IERC721Receiver.sol997 B
- npm/@openzeppelin/[email protected]/token/ERC721/extensions/IERC721Metadata.sol792 B
- npm/@openzeppelin/[email protected]/token/ERC721/utils/ERC721Utils.sol1.92 KB
- npm/@openzeppelin/[email protected]/utils/Arrays.sol35.17 KB
- npm/@openzeppelin/[email protected]/utils/Base64.sol10.66 KB
- npm/@openzeppelin/[email protected]/utils/Bytes.sol14.74 KB
- npm/@openzeppelin/[email protected]/utils/Comparators.sol443 B
- npm/@openzeppelin/[email protected]/utils/Context.sol963 B
- npm/@openzeppelin/[email protected]/utils/Panic.sol1.97 KB
- npm/@openzeppelin/[email protected]/utils/ReentrancyGuard.sol4.77 KB
- npm/@openzeppelin/[email protected]/utils/SlotDerivation.sol5.32 KB
- npm/@openzeppelin/[email protected]/utils/StorageSlot.sol4.18 KB
- npm/@openzeppelin/[email protected]/utils/Strings.sol21.54 KB
- npm/@openzeppelin/[email protected]/utils/introspection/ERC165.sol879 B
- npm/@openzeppelin/[email protected]/utils/introspection/IERC165.sol871 B
- npm/@openzeppelin/[email protected]/utils/math/Math.sol32.66 KB
- npm/@openzeppelin/[email protected]/utils/math/SafeCast.sol34.94 KB
- npm/@openzeppelin/[email protected]/utils/math/SignedMath.sol2.61 KB
- npm/[email protected]/src/utils/LibBytes.sol38.18 KB
- npm/[email protected]/src/utils/LibString.sol44.25 KB
- project/contracts/drops/garden/GardenPatronEdition.sol10.77 KB
- project/contracts/studio/NetworkedAuctionRouter.sol19.95 KB
- project/contracts/studio/interfaces/INetworkedAuctionEngine.sol1.02 KB
- project/contracts/studio/interfaces/INetworkedAuctionRouter.sol6.08 KB
- project/contracts/studio/interfaces/INetworkedDrop.sol3.79 KB
- project/contracts/studio/interfaces/INetworkedDropMint.sol963 B
- project/contracts/studio/lib/RouterReentrancyGuard.sol638 B
- project/contracts/studio/primitives/auction/StudioOracleEscrow.sol583 B
- project/contracts/studio/primitives/interfaces/IStudioAggregator.sol581 B
- project/contracts/studio/primitives/interfaces/IStudioAuctionsCommon.sol2.27 KB
- project/contracts/studio/primitives/interfaces/IStudioFeeLedger.sol1.32 KB
- project/contracts/studio/primitives/interfaces/IStudioPatronEditionRenderer.sol524 B
- project/contracts/studio/primitives/interfaces/IStudioReverseRegistrar.sol373 B
- project/contracts/studio/primitives/interfaces/IStudioUsdOracle.sol1.02 KB
- project/contracts/studio/primitives/lib/StudioCollectionOwnership.sol1.02 KB
- project/contracts/studio/primitives/lib/StudioFeeCategories.sol527 B
- project/contracts/studio/primitives/lib/StudioPushPullEscrow.sol2.89 KB
- project/contracts/studio/primitives/oracle/StudioUsdOracle.sol3.2 KB
- project/contracts/studio/primitives/renderers/StudioGenericPatronEditionRenderer.sol1.95 KB
project/contracts/drops/garden/Garden.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.38;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { LibString } from "solady/src/utils/LibString.sol";
import "../../studio/NetworkedAuctionRouter.sol";
import "../../studio/interfaces/INetworkedAuctionEngine.sol";
import "./GardenPatronEdition.sol";
/// @title The Garden by Doy
///
/// @notice 138 one-of-one works by DOY. 69 Dark and Gold pairs,
/// with fixed IPFS metadata and a companion Patron Edition.
contract Garden is ERC721, Ownable2Step, ReentrancyGuard {
using LibString for uint256;
// ───────────────────────────────── Types ─────────────────────────────────
enum Allocation { Unassigned, Placed, Auction }
// ─────────────────────── Constants and dependencies ──────────────────────
uint256 public constant MAX_SUPPLY = 138;
uint40 public constant AUCTION_DURATION = 48 hours;
NetworkedAuctionRouter public immutable auctionRouter;
address public immutable auctionEngine;
address public immutable patronEdition;
uint40 public immutable launchStart;
uint40 public immutable launchEnd;
// ──────────────────────────────── Storage ────────────────────────────────
/// @notice The total number of originals minted.
uint256 public totalSupply;
/// @notice Fixed IPFS root with a trailing slash.
string public baseURI;
/// @notice Permanent assignment of each original.
mapping(uint256 => Allocation) public allocationOf;
/// @notice Launch auction controlling the work's Patron window.
mapping(uint256 => uint256) public firstAuctionOf;
// ───────────────────────────────── Errors ────────────────────────────────
error InvalidVenue();
error InvalidWindow();
error InvalidBaseURI();
error InvalidTokenId();
error InvalidRecipient();
error InvalidBatch();
error AllocationClosed();
error AlreadyAllocated();
error NotAuctionEngine();
error InvalidAuction();
error RenounceDisabled();
// ────────────────────────────── Constructor ──────────────────────────────
/// @notice Pin the artist, sale contracts, launch time and metadata.
constructor(
address artist,
address router_,
address engine_,
uint40 start,
string memory baseURI_
) ERC721("The Garden", "GRDN") Ownable(artist) {
if (router_.code.length == 0 || engine_.code.length == 0) revert InvalidVenue();
if (INetworkedAuctionEngine(engine_).router() != router_) revert InvalidVenue();
if (start <= block.timestamp || start > type(uint40).max - AUCTION_DURATION) revert InvalidWindow();
bytes memory root = bytes(baseURI_);
if (
root.length <= 8 || bytes7(root) != bytes7("ipfs://")
|| root[root.length - 1] != bytes1("/")
) revert InvalidBaseURI();
auctionRouter = NetworkedAuctionRouter(router_);
auctionEngine = engine_;
launchStart = start;
launchEnd = start + AUCTION_DURATION;
baseURI = baseURI_;
GardenPatronEdition edition = new GardenPatronEdition(address(this), engine_);
patronEdition = address(edition);
}
// ─────────────────────────────── Placement ───────────────────────────────
/// @notice Mint an original to a collector before launch.
function place(uint256 tokenId, address recipient) external onlyOwner nonReentrant {
_place(tokenId, recipient);
}
/// @notice Place several originals before launch.
function placeBatch(uint256[] calldata tokenIds, address[] calldata recipients)
external
onlyOwner
nonReentrant
{
uint256 count = tokenIds.length;
if (count == 0 || count > MAX_SUPPLY || count != recipients.length) revert InvalidBatch();
for (uint256 i; i < count; ++i) _place(tokenIds[i], recipients[i]);
}
// ────────────────────────── Auction registration ─────────────────────────
/// @notice Bind the launch auction and mint the original to the artist.
/// The first qualifying bid takes custody.
/// @dev Only the pinned engine may register a matching router auction.
/// The assignment and Patron window cannot be reopened.
function registerAuction(uint256 tokenId, uint256 auctionId) external nonReentrant {
if (msg.sender != auctionEngine) revert NotAuctionEngine();
_requireUnassigned(tokenId);
if (auctionId == 0) revert InvalidAuction();
INetworkedAuctionRouter.Auction memory auction = auctionRouter.getAuction(auctionId);
if (
auction.seller != owner()
|| auction.request.scope != INetworkedAuctionRouter.Scope.TokenAuction
|| auction.request.tokenStandard != INetworkedAuctionRouter.TokenStandard.ERC721
|| auction.request.collection != address(this)
|| auction.request.tokenId != tokenId || auction.request.quantity != 1
|| auction.startTimestamp != launchStart || auction.endTimestamp != launchEnd
|| auction.outcome != INetworkedAuctionRouter.Outcome.Active
|| auctionRouter.getEngine(auction.engineId).implementation != auctionEngine
) revert InvalidAuction();
allocationOf[tokenId] = Allocation.Auction;
firstAuctionOf[tokenId] = auctionId;
++totalSupply;
_reportWindow(tokenId, auctionId);
_safeMint(auction.seller, tokenId);
}
// ───────────────────────────── Patron windows ────────────────────────────
/// @notice Whether the work's Patron window is open.
function patronOpen(uint256 tokenId) external view returns (bool open) {
(,, open) = patronWindow(tokenId);
}
/// @notice The work's Patron window, inclusive at both ends.
/// Placed works use the launch window; auctions follow extensions.
/// Unassigned works are closed.
/// @dev Does not check whether a recipient already holds an edition.
function patronWindow(uint256 tokenId) public view returns (uint40 start, uint40 end, bool open) {
_requireValidToken(tokenId);
(INetworkedAuctionRouter.PatronWindow memory window, bool eligible) = auctionRouter.patronWindow(address(this), tokenId);
return (window.start, window.end, eligible);
}
// ──────────────────────────────── Metadata ───────────────────────────────
/// @notice Token metadata, available before minting.
function previewURI(uint256 tokenId) public view returns (string memory) {
_requireValidToken(tokenId);
return string.concat(baseURI, "metadata/", tokenId.toString(), ".json");
}
/// @inheritdoc ERC721
function tokenURI(uint256 tokenId) public view override returns (string memory) {
_requireOwned(tokenId);
return previewURI(tokenId);
}
/// @notice Collection metadata.
function contractURI() external view returns (string memory) {
return string.concat(baseURI, "contract.json");
}
// ────────────────────────── Collection ownership ─────────────────────────
/// @notice Disabled. Always reverts.
function renounceOwnership() public view override onlyOwner {
revert RenounceDisabled();
}
// ─────────────────────────────── Internals ───────────────────────────────
function _place(uint256 tokenId, address recipient) private {
_requireUnassigned(tokenId);
if (recipient == address(0)) revert InvalidRecipient();
allocationOf[tokenId] = Allocation.Placed;
++totalSupply;
_reportWindow(tokenId, 0);
_safeMint(recipient, tokenId);
}
function _reportWindow(uint256 tokenId, uint256 auctionId) private {
auctionRouter.registerCollection(address(this));
auctionRouter.configurePatronWindow(tokenId, auctionId, launchStart, launchEnd, 2500);
}
function _requireUnassigned(uint256 tokenId) private view {
if (block.timestamp >= launchStart) revert AllocationClosed();
_requireValidToken(tokenId);
if (allocationOf[tokenId] != Allocation.Unassigned) revert AlreadyAllocated();
}
function _requireValidToken(uint256 tokenId) private pure {
if (tokenId == 0 || tokenId > MAX_SUPPLY) revert InvalidTokenId();
}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"npm/@1001-digital/[email protected]/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"npm/@openzeppelin/[email protected]/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@1001-digital/erc721-extensions/=npm/@1001-digital/[email protected]/",
"project/:@openzeppelin/contracts-upgradeable/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:solady/=npm/[email protected]/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.