¡El código fuente de este contrato está verificado!
Metadatos del Contrato
Compilador
0.8.19+commit.7dd6d404
Idioma
Solidity
¡El código fuente de este contrato está verificado!
Metadatos del Contrato
Compilador
0.8.17+commit.8df45f5f
Idioma
Solidity
Código Fuente del Contrato
Archivo 1 de 49: AccessControl.sol
Código Fuente del Contrato
Archivo 2 de 49: AccessControlEnumerable.sol
Código Fuente del Contrato
Archivo 3 de 49: AccessControlPausable.sol
Código Fuente del Contrato
Archivo 4 de 49: Address.sol
Código Fuente del Contrato
Archivo 5 de 49: BaseSellable.sol
Código Fuente del Contrato
Archivo 6 de 49: BaseTokenURI.sol
Código Fuente del Contrato
Archivo 7 de 49: BytecodeStorage.sol
Código Fuente del Contrato
Archivo 8 de 49: Bytes32Strings.sol
Código Fuente del Contrato
Archivo 9 de 49: Constants.sol
Código Fuente del Contrato
Archivo 10 de 49: Context.sol
Código Fuente del Contrato
Archivo 11 de 49: DefaultOperatorFilterer.sol
Código Fuente del Contrato
Archivo 12 de 49: DiamondExhibition.sol
// SPDX-License-Identifier: MIT// Copyright 2023 PROOF Holdings Incpragmasolidity ^0.8.15;import {Strings} from"openzeppelin-contracts/utils/Strings.sol";
import {GenArt721CoreV3_Engine_Flex_PROOF} from"artblocks-contracts/GenArt721CoreV3_Engine_Flex_PROOF.sol";
import {ERC721A, ERC721ACommon, BaseTokenURI, ERC721ACommonBaseTokenURI} from"ethier/erc721/BaseTokenURI.sol";
import {OperatorFilterOS} from"ethier/erc721/OperatorFilterOS.sol";
import {artblocksTokenID} from"proof/artblocks/TokenIDMapping.sol";
import {IGenArt721CoreContractV3_Mintable} from"proof/artblocks/IGenArt721CoreContractV3_Mintable.sol";
import {SellableERC721ACommon} from"proof/sellers/sellable/SellableERC721ACommon.sol";
import {ProjectsConfig} from"./ProjectsConfig.sol";
import {TokenInfoManager} from"./TokenInfoManager.sol";
/**
* @notice Library for encoding and decoding purchase data for the Diamond Exhibition sellers.
*/libraryDiamondExhibitionLib{
functionencodePurchaseData(uint8[] memory projectIds) internalpurereturns (bytesmemory) {
returnabi.encode(projectIds);
}
functiondencodePurchaseData(bytesmemory data) internalpurereturns (uint8[] memory) {
returnabi.decode(data, (uint8[]));
}
}
/**
* @notice Diamond Exhibition
* @author David Huber (@cxkoda)
* @custom:reviewer Arran Schlosberg (@divergencearran)
*/contractDiamondExhibitionisERC721ACommonBaseTokenURI,
OperatorFilterOS,
SellableERC721ACommon,
ProjectsConfig,
TokenInfoManager{
// =================================================================================================================// Errors// =================================================================================================================/**
* @notice Thrown if the number of requested purchases exceeds the number of remaining tokens.
*/errorExceedingMaxTotalSupply(uint256 num, uint256 numLeft);
/**
* @notice Thrown if a user attempts to purchase tokens from an exhausted project.
*/errorProjectExhausted(uint8 projectId);
/**
* @notice Thrown if a user attempts to purchase tokens from an invalid project.
*/errorInvalidProject(uint8 projectId);
// =================================================================================================================// Constants// =================================================================================================================/**
* @notice The ArtBlocks engine flex contract.
*/
GenArt721CoreV3_Engine_Flex_PROOF publicimmutable flex;
/**
* @notice The ArtBlocks engine flex contract or a minter multiplexer.
*/
IGenArt721CoreContractV3_Mintable publicimmutable flexMintGateway;
/**
* @notice The maximum total number of tokens that can be minted.
* @dev This is intentionally not a compile-time constant for the sake of testing.
*/uint256publicimmutable maxTotalSupply;
// =========================================================================// Storage// =================================================================================================================/**
* @notice The number of tokens minted per project.
*/uint16[NUM_PROJECTS] internal _numPurchasedPerProject;
// =================================================================================================================// Storage// =================================================================================================================structConstructorParams {
address admin;
address steerer;
addresspayable secondaryReceiver;
GenArt721CoreV3_Engine_Flex_PROOF flex;
IGenArt721CoreContractV3_Mintable flexMintGateway;
}
constructor(ConstructorParams memory params)
ERC721ACommon(params.admin, params.steerer, "Diamond Exhibition", "DIAMOND", params.secondaryReceiver, 500)
BaseTokenURI("https://metadata.proof.xyz/diamond-exhibition/")
{
uint256 total;
uint256[NUM_PROJECTS] memory maxNumPerProject_ = _maxNumPerProject();
for (uint256 i =0; i < NUM_PROJECTS; i++) {
total += maxNumPerProject_[i];
}
maxTotalSupply = total;
flex = params.flex;
flexMintGateway = params.flexMintGateway;
}
// =================================================================================================================// Selling// =================================================================================================================/**
* @notice Assigns a project to a token.
* @dev Mints from the associated ArtBlocks project if the project is a longform project.
*/function_assignProject(uint256 tokenId, uint8 projectId, uint256[NUM_PROJECTS] memory maxNumPerProject_)
internal{
if (projectId >= NUM_PROJECTS) {
revert InvalidProject(projectId);
}
uint16 numPurchased = _numPurchasedPerProject[projectId];
if (numPurchased >= maxNumPerProject_[projectId]) {
revert ProjectExhausted(projectId);
}
_numPurchasedPerProject[projectId] = numPurchased +1;
if (_isLongformProject(projectId)) {
flexMintGateway.mint_Ecf(address(this), _artblocksProjectId(projectId), address(this));
}
_setTokenInfo(tokenId, projectId, numPurchased /* edition */ );
}
/**
* @inheritdoc SellableERC721ACommon
*/function_handleSale(address to, uint64 num, bytescalldata data) internalvirtualoverride{
if (num + _totalMinted() > maxTotalSupply) {
revert ExceedingMaxTotalSupply(num, maxTotalSupply - _totalMinted());
}
uint8[] memory projectIds = DiamondExhibitionLib.dencodePurchaseData(data);
assert(projectIds.length== num);
uint256 tokenId = _nextTokenId();
uint256[NUM_PROJECTS] memory maxNumPerProject_ = _maxNumPerProject();
for (uint256 i =0; i < num; ++i) {
_assignProject(tokenId++, projectIds[i], maxNumPerProject_);
}
SellableERC721ACommon._handleSale(to, num, data);
}
/**
* @inheritdoc ERC721A
*/functiontokenURI(uint256 tokenId) publicviewvirtualoverridereturns (stringmemory) {
TokenInfo memory info = _tokenInfo(tokenId);
if (projectType(info.projectId) == ProjectType.Curated) {
returnstring.concat(_baseURI(), Strings.toString(tokenId));
}
return flex.tokenURI(artblocksTokenID(_artblocksProjectId(info.projectId), info.edition));
}
/**
* @notice Returns all tokenIds for a given project.
* @dev Intended for front-end consumption and not optimised for gas.
*/functiontokenIdsByProjectId(uint8 projectId) externalviewreturns (uint256[] memory) {
uint256[] memory tokenIds =newuint256[](_numPurchasedPerProject[projectId]);
uint256 cursor;
uint256 supply = totalSupply();
for (uint256 tokenId =0; tokenId < supply; ++tokenId) {
if (_tokenInfo(tokenId).projectId == projectId) {
tokenIds[cursor++] = tokenId;
}
}
return tokenIds;
}
/**
* @notice Returns the number of tokens purchased for each project.
* @dev Intended for front-end consumption and not optimised for gas.
*/functionnumPurchasedPerProject() externalviewreturns (uint16[NUM_PROJECTS] memory) {
return _numPurchasedPerProject;
}
// =================================================================================================================// Inheritance resolution// =================================================================================================================/**
* @notice Helper function that returns true if the token belongs to a longform project.
*/function_isLongformToken(uint256 tokenId) internalviewvirtualreturns (bool) {
return _isLongformProject(_tokenInfo(tokenId).projectId);
}
functionsupportsInterface(bytes4 interfaceId)
publicviewvirtualoverride(ERC721ACommon, ERC721ACommonBaseTokenURI, SellableERC721ACommon)
returns (bool)
{
return ERC721ACommonBaseTokenURI.supportsInterface(interfaceId);
}
function_baseURI() internalviewvirtualoverride(ERC721A, ERC721ACommonBaseTokenURI) returns (stringmemory) {
return ERC721ACommonBaseTokenURI._baseURI();
}
functionsetApprovalForAll(address operator, bool approved) publicvirtualoverride(ERC721A, OperatorFilterOS) {
ERC721A.setApprovalForAll(operator, approved);
}
functionapprove(address operator, uint256 tokenId) publicpayablevirtualoverride(ERC721A, OperatorFilterOS) {
if (_isLongformToken(tokenId)) {
ERC721A.approve(operator, tokenId);
} else {
OperatorFilterOS.approve(operator, tokenId);
}
}
functiontransferFrom(addressfrom, address to, uint256 tokenId)
publicpayablevirtualoverride(ERC721A, OperatorFilterOS)
{
if (_isLongformToken(tokenId)) {
ERC721A.transferFrom(from, to, tokenId);
} else {
OperatorFilterOS.transferFrom(from, to, tokenId);
}
}
functionsafeTransferFrom(addressfrom, address to, uint256 tokenId)
publicpayablevirtualoverride(ERC721A, OperatorFilterOS)
{
if (_isLongformToken(tokenId)) {
ERC721A.safeTransferFrom(from, to, tokenId);
} else {
OperatorFilterOS.safeTransferFrom(from, to, tokenId);
}
}
functionsafeTransferFrom(addressfrom, address to, uint256 tokenId, bytesmemory data)
publicpayablevirtualoverride(ERC721A, OperatorFilterOS)
{
if (_isLongformToken(tokenId)) {
ERC721A.safeTransferFrom(from, to, tokenId, data);
} else {
OperatorFilterOS.safeTransferFrom(from, to, tokenId, data);
}
}
}
Código Fuente del Contrato
Archivo 13 de 49: ERC165.sol
Código Fuente del Contrato
Archivo 14 de 49: ERC2981.sol
Código Fuente del Contrato
Archivo 15 de 49: ERC4906.sol
Código Fuente del Contrato
Archivo 16 de 49: ERC721A.sol
Código Fuente del Contrato
Archivo 17 de 49: ERC721ACommon.sol
Código Fuente del Contrato
Archivo 18 de 49: ERC721_PackedHashSeed.sol
Código Fuente del Contrato
Archivo 19 de 49: EnumerableSet.sol
Código Fuente del Contrato
Archivo 20 de 49: GenArt721CoreV3_Engine_Flex_PROOF.sol
Código Fuente del Contrato
Archivo 21 de 49: IAccessControl.sol
Código Fuente del Contrato
Archivo 22 de 49: IAccessControlEnumerable.sol
Código Fuente del Contrato
Archivo 23 de 49: IAdminACLV0.sol
Código Fuente del Contrato
Archivo 24 de 49: IDependencyRegistryCompatibleV0.sol
Código Fuente del Contrato
Archivo 25 de 49: IERC165.sol
Código Fuente del Contrato
Archivo 26 de 49: IERC2981.sol
Código Fuente del Contrato
Archivo 27 de 49: IERC721.sol
Código Fuente del Contrato
Archivo 28 de 49: IERC721A.sol
Código Fuente del Contrato
Archivo 29 de 49: IERC721Metadata.sol
Código Fuente del Contrato
Archivo 30 de 49: IERC721Receiver.sol
Código Fuente del Contrato
Archivo 31 de 49: IEngineRegistryV0.sol
Código Fuente del Contrato
Archivo 32 de 49: IGenArt721CoreContractV3_Base.sol
Código Fuente del Contrato
Archivo 33 de 49: IGenArt721CoreContractV3_Engine.sol
Código Fuente del Contrato
Archivo 34 de 49: IGenArt721CoreContractV3_Engine_Flex.sol
Código Fuente del Contrato
Archivo 35 de 49: IGenArt721CoreContractV3_Mintable.sol
Código Fuente del Contrato
Archivo 36 de 49: IManifold.sol
Código Fuente del Contrato
Archivo 37 de 49: IOperatorFilterRegistry.sol
Código Fuente del Contrato
Archivo 38 de 49: IRandomizerV2.sol
Código Fuente del Contrato
Archivo 39 de 49: ISellable.sol
Código Fuente del Contrato
Archivo 40 de 49: Math.sol
Código Fuente del Contrato
Archivo 41 de 49: OperatorFilterOS.sol
Código Fuente del Contrato
Archivo 42 de 49: OperatorFilterer.sol
Código Fuente del Contrato
Archivo 43 de 49: Ownable.sol
Código Fuente del Contrato
Archivo 44 de 49: Pausable.sol
Código Fuente del Contrato
Archivo 45 de 49: ProjectsConfig.sol
// SPDX-License-Identifier: MIT// Copyright 2023 Proof Holdings Inc.pragmasolidity >=0.8.17;/**
* @notice Diamond Exhibition - Projects configuration.
* @author David Huber (@cxkoda)
* @custom:reviewer Arran Schlosberg (@divergencearran)
*/contractProjectsConfig{
/**
* @notice The number of longform projects.
*/uint8internalconstant _NUM_LONGFORM_PROJECTS =11;
/**
* @notice The number of pre-curated projects.
*/uint8internalconstant _NUM_CURATED_PROJECTS =10;
/**
* @notice The total number of projects.
*/uint8publicconstant NUM_PROJECTS = _NUM_LONGFORM_PROJECTS + _NUM_CURATED_PROJECTS;
/**
* @notice Returns the number of projects than can be minted per project.
*/function_maxNumPerProject() internalpurevirtualreturns (uint256[NUM_PROJECTS] memory sizes) {
return [
// Longformuint256(600), // Impossible Distance600, // cathedral study600, // Deja Vu800, // WaveShapes1000, // Ephemeral Tides600, // StackSlash450, // Viridaria1000, // Windwoven256, // Memory Loss1000, // The Collector's Room1000, // Extrañezas// Pre-curated100, // Everydays: Group Effort100, // Kid Heart100, // BEHEADED (SELF PORTRAIT)1127, // End Transmissions77, // DES CHOSES™100, // A Wintry Night in Chinatown100, // Penthouse200, // Hands of Umbra100, // Solitaire100// Remnants of a Distant Dream
];
}
/**
* @notice Returns the number of projects than can be minted per project.
*/functionmaxNumPerProject() externalpurereturns (uint256[NUM_PROJECTS] memory) {
return _maxNumPerProject();
}
// =========================================================================// Project Types// =========================================================================/**
* @notice The different types of projects.
*/enumProjectType {
Longform,
Curated
}
/**
* @notice Returns the project type for a given project ID.
*/functionprojectType(uint8 projectId) publicpurereturns (ProjectType) {
return projectId < _NUM_LONGFORM_PROJECTS ? ProjectType.Longform : ProjectType.Curated;
}
/**
* @notice Returns true iff the project is a longform project.
*/function_isLongformProject(uint8 projectId) internalpurevirtualreturns (bool) {
return projectType(projectId) == ProjectType.Longform;
}
// =========================================================================// Artblocks// =========================================================================/**
* @notice Returns the ArtBlocks engine project IDs for the longform projects.
*/function_artblocksProjectIds() internalpurevirtualreturns (uint8[_NUM_LONGFORM_PROJECTS] memory) {
return [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
}
/**
* @notice Returns the ArtBlocks engine project IDs for the longform projects.
*/functionartblocksProjectIds() externalpurereturns (uint8[_NUM_LONGFORM_PROJECTS] memory) {
return _artblocksProjectIds();
}
/**
* @notice Returns the ArtBlocks engine project ID for a given project ID.
* @dev Reverts if the project is not long-form.
*/function_artblocksProjectId(uint8 projectId) internalpurereturns (uint256) {
assert(_isLongformProject(projectId));
return _artblocksProjectIds()[projectId];
}
}
Código Fuente del Contrato
Archivo 46 de 49: SellableERC721ACommon.sol
Código Fuente del Contrato
Archivo 47 de 49: Strings.sol
Código Fuente del Contrato
Archivo 48 de 49: TokenIDMapping.sol
Código Fuente del Contrato
Archivo 49 de 49: TokenInfoManager.sol
// SPDX-License-Identifier: MIT// Copyright 2023 Proof Holdings Inc.pragmasolidity >=0.8.17;/**
* @notice Token information module for Diamond Exhibition.
* @author David Huber (@cxkoda)
* @custom:reviewer Arran Schlosberg (@divergencearran)
*/contractTokenInfoManager{
/**
* @notice Encodes token information.
* @param projectId the ID of the project associated with the token.
* @param edition the edition of the token within the given project.
*/structTokenInfo {
uint8 projectId;
uint16 edition;
}
/**
* @notice Max numbers of tokens that this contract can store.
* @dev This constant is intentionally very large so we never have to worry about it.
*/uint256internalconstant _NUM_MAX_TOKEN_INFO = (1<<32);
/**
* @notice Stores token information.
*/
TokenInfo[_NUM_MAX_TOKEN_INFO] private _infos;
/**
* @notice Returns the token information for the given token IDs.
* @dev Intended for off-chain use only.
*/functiontokenInfos(uint256[] calldata tokenIds) externalviewreturns (TokenInfo[] memory) {
TokenInfo[] memory infos =new TokenInfo[](tokenIds.length);
for (uint256 i =0; i < tokenIds.length; ++i) {
infos[i] = _tokenInfo(tokenIds[i]);
}
return infos;
}
/**
* @notice Returns the token information for the given token ID.
*/function_tokenInfo(uint256 tokenId) internalviewreturns (TokenInfo memory) {
return _infos[tokenId];
}
/**
* @notice Sets the token information for the given token ID.
*/function_setTokenInfo(uint256 tokenId, uint8 projectId, uint16 edition) internal{
_infos[tokenId] = TokenInfo({projectId: projectId, edition: edition});
}
}