文件 1 的 20:Address.sol
pragma solidity ^0.8.1;
library Address {
function isContract(address account) internal view returns (bool) {
return account.code.length > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
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");
}
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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
文件 2 的 20:Clones.sol
pragma solidity ^0.8.0;
library Clones {
function clone(address implementation) internal returns (address instance) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
instance := create(0, ptr, 0x37)
}
require(instance != address(0), "ERC1167: create failed");
}
function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
instance := create2(0, ptr, 0x37, salt)
}
require(instance != address(0), "ERC1167: create2 failed");
}
function predictDeterministicAddress(
address implementation,
bytes32 salt,
address deployer
) internal pure returns (address predicted) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
mstore(add(ptr, 0x38), shl(0x60, deployer))
mstore(add(ptr, 0x4c), salt)
mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
predicted := keccak256(add(ptr, 0x37), 0x55)
}
}
function predictDeterministicAddress(address implementation, bytes32 salt)
internal
view
returns (address predicted)
{
return predictDeterministicAddress(implementation, salt, address(this));
}
}
文件 3 的 20:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 4 的 20:Eclipse.sol
pragma solidity ^0.8.0;
import {EclipseAccess} from "../access/EclipseAccess.sol";
import {EclipseCollectionFactory, CollectionParams} from "../factory/EclipseCollectionFactory.sol";
import {EclipsePaymentSplitterFactory} from "../factory/EclipsePaymentSplitterFactory.sol";
import {IEclipseERC721} from "../interface/IEclipseERC721.sol";
import {IEclipseMinter} from "../interface/IEclipseMinter.sol";
import {EclipseStorage, Collection, Artist} from "../storage/EclipseStorage.sol";
struct CreateCollectionParams {
string name;
string symbol;
string script;
uint8 collectionType;
uint24 maxSupply;
uint8 erc721Index;
uint8[] pricingMode;
bytes[] pricingData;
address[] payeesMint;
address[] payeesRoyalties;
uint24[] sharesMint;
uint24[] sharesRoyalties;
}
struct PricingParams {
uint8 mode;
bytes data;
}
struct CollectionInfo {
string name;
string symbol;
Collection collection;
Artist artist;
}
contract Eclipse is EclipseAccess {
address public collectionFactory;
address public paymentSplitterFactory;
address public platformPayoutAddress;
mapping(uint8 => address) public minters;
mapping(uint8 => address) public gateTypes;
EclipseStorage public store;
constructor(
address collectionFactory_,
address paymentSplitterFactory_,
address store_,
address platformPayoutAddress_
) {
collectionFactory = collectionFactory_;
paymentSplitterFactory = paymentSplitterFactory_;
platformPayoutAddress = platformPayoutAddress_;
store = EclipseStorage(store_);
}
modifier onlyArtist(address collection) {
address artist = store.getCollection(collection).artist;
require(
_msgSender() == artist,
"EclipseAccess: caller is not the artist"
);
_;
}
function _cloneCollection(
CollectionParams memory params
) internal returns (address instance, uint256 id) {
return
EclipseCollectionFactory(collectionFactory).cloneCollectionContract(
params
);
}
function _createCollection(
CollectionParams memory params
) internal returns (address instance, uint256 id) {
(instance, id) = _cloneCollection(params);
store.setCollection(
Collection(
id,
params.artist,
instance,
params.maxSupply,
params.script,
params.paymentSplitter
)
);
}
function createCollection(CreateCollectionParams calldata params) external {
uint24 maxSupply = params.maxSupply;
require(maxSupply <= 1_000_000, "maxSupply too big");
address artist = _msgSender();
_createArtist(artist);
address paymentSplitter = EclipsePaymentSplitterFactory(
paymentSplitterFactory
).clone(
owner(),
platformPayoutAddress,
artist,
params.payeesMint,
params.payeesRoyalties,
params.sharesMint,
params.sharesRoyalties
);
address instance = EclipseCollectionFactory(collectionFactory)
.predictDeterministicAddress(params.erc721Index);
bytes[] memory pricingData = params.pricingData;
uint8[] memory pricingMode = params.pricingMode;
address[] memory collectionMinters = new address[](pricingMode.length);
for (uint8 i; i < pricingMode.length; i++) {
address minter = minters[pricingMode[i]];
collectionMinters[i] = minter;
_addMinterToCollection(instance, artist, minter, pricingData[i]);
}
_createCollection(
CollectionParams(
artist,
params.name,
params.symbol,
params.script,
params.collectionType,
maxSupply,
address(this),
params.erc721Index,
collectionMinters,
paymentSplitter
)
);
}
function _createArtist(address artist) internal {
if (store.getArtist(artist).wallet != address(0)) return;
address[] memory collections_;
store.setArtist(Artist(artist, collections_));
}
function _addMinterToCollection(
address collection,
address sender,
address minter,
bytes memory pricingData
) internal {
IEclipseMinter(minter).setPricing(collection, sender, pricingData);
}
function setCollectionFactory(address factory) external onlyAdmin {
collectionFactory = factory;
}
function setPaymentSplitterFactory(address factory) external onlyAdmin {
paymentSplitterFactory = factory;
}
function enableMinterForCollection(
address collection,
uint8 pricingMode,
bytes memory pricingData,
bool enable
) external onlyArtist(collection) {
address minter = minters[pricingMode];
if (enable) {
_addMinterToCollection(
collection,
_msgSender(),
minter,
pricingData
);
}
IEclipseERC721(collection).setMinter(minter, enable);
}
function addMinter(uint8 index, address minter) external onlyAdmin {
minters[index] = minter;
}
function addGate(uint8 index, address gate) external onlyAdmin {
gateTypes[index] = gate;
}
function getCollectionInfo(
address collection
) external view returns (CollectionInfo memory info) {
(
string memory name,
string memory symbol,
address artist,
,
,
) = IEclipseERC721(collection).getInfo();
Artist memory artist_ = store.getArtist(artist);
info = CollectionInfo(
name,
symbol,
store.getCollection(collection),
artist_
);
}
}
文件 5 的 20:EclipseAccess.sol
pragma solidity ^0.8.0;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
abstract contract EclipseAccess is Ownable {
mapping(address => bool) public admins;
address public eclipseAdmin;
constructor() Ownable() {
eclipseAdmin = _msgSender();
}
modifier onlyAdmin() {
address sender = _msgSender();
require(
owner() == sender || admins[sender],
"EclipseAccess: caller is not the owner nor admin"
);
_;
}
modifier onlyEclipseAdmin() {
address sender = _msgSender();
require(
eclipseAdmin == sender,
"EclipseAccess: caller is not eclipse admin"
);
_;
}
function setEclipseAdmin(address admin) public onlyEclipseAdmin {
eclipseAdmin = admin;
}
function setAdminAccess(
address admin,
bool access
) public onlyEclipseAdmin {
admins[admin] = access;
}
}
文件 6 的 20:EclipseCollectionFactory.sol
pragma solidity ^0.8.0;
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {EclipseAccess} from "../access/EclipseAccess.sol";
import {IEclipseMinter} from "../interface/IEclipseMinter.sol";
struct CollectionParams {
address artist;
string name;
string symbol;
string script;
uint8 collectionType;
uint24 maxSupply;
address contractAdmin;
uint8 erc721Index;
address[] minters;
address paymentSplitter;
}
struct CollectionEvent {
uint256 id;
address contractAddress;
uint8 collectionType;
address artist;
string name;
string symbol;
string script;
uint24 maxSupply;
address implementation;
address paymentSplitter;
}
struct CollectionType {
string name;
uint256 prefix;
uint256 lastId;
}
struct InitializerParams {
uint256 id;
address artist;
string name;
string symbol;
uint24 maxSupply;
address contractAdmin;
address[] minters;
address paymentSplitter;
}
contract EclipseCollectionFactory is EclipseAccess {
mapping(uint8 => address) public erc721Implementations;
mapping(uint8 => CollectionType) public collectionTypes;
address public paymentSplitterImplementation;
string public uri;
event Created(CollectionEvent collection);
constructor(string memory uri_) EclipseAccess() {
uri = uri_;
uint256 chain;
assembly {
chain := chainid()
}
collectionTypes[0] = CollectionType(
"js",
chain * 1_000_000_000 + 100_000_000,
0
);
}
function _getNextCollectionId(
uint8 collectionType
) internal returns (uint256) {
CollectionType storage obj = collectionTypes[collectionType];
require(obj.prefix != 0, "invalid collectionType");
obj.lastId += 1;
uint256 id = obj.prefix + obj.lastId;
return id;
}
function _createInitializer(
InitializerParams memory params
) internal view returns (bytes memory) {
return
abi.encodeWithSignature(
"initialize(string,string,string,uint256,uint24,address,address,address,address[],address)",
params.name,
params.symbol,
uri,
params.id,
params.maxSupply,
eclipseAdmin,
params.contractAdmin,
params.artist,
params.minters,
params.paymentSplitter
);
}
function cloneCollectionContract(
CollectionParams memory params
) external onlyAdmin returns (address, uint256) {
address implementation = erc721Implementations[params.erc721Index];
require(implementation != address(0), "invalid erc721Index");
uint24 maxSupply = params.maxSupply;
require(maxSupply <= 99_999, "maxSupply must not be greater 99.999");
uint8 collectionType = params.collectionType;
uint256 id = _getNextCollectionId(collectionType);
address paymentSplitter = params.paymentSplitter;
address artist = params.artist;
address contractAdmin = params.contractAdmin;
address[] memory minters = params.minters;
string memory symbol = params.symbol;
string memory name = params.name;
string memory script = params.script;
bytes memory initializer = _createInitializer(
InitializerParams(
id,
artist,
name,
symbol,
maxSupply,
contractAdmin,
minters,
paymentSplitter
)
);
address instance = Clones.cloneDeterministic(
implementation,
bytes32(block.number)
);
Address.functionCall(instance, initializer);
emit Created(
CollectionEvent(
id,
instance,
collectionType,
artist,
name,
symbol,
script,
maxSupply,
implementation,
paymentSplitter
)
);
return (instance, id);
}
function addErc721Implementation(
uint8 index,
address implementation
) external onlyAdmin {
erc721Implementations[index] = implementation;
}
function addCollectionType(
uint8 index,
string memory name,
uint256 prefix,
uint256 lastId
) external onlyAdmin {
collectionTypes[index] = CollectionType(name, prefix, lastId);
}
function setUri(string memory uri_) external onlyAdmin {
uri = uri_;
}
function predictDeterministicAddress(
uint8 erc721Index
) external view returns (address) {
return
Clones.predictDeterministicAddress(
erc721Implementations[erc721Index],
bytes32(block.number),
address(this)
);
}
}
文件 7 的 20:EclipseMinterBase.sol
pragma solidity ^0.8.0;
import {EclipseAccess} from "../access/EclipseAccess.sol";
import {Eclipse} from "../app/Eclipse.sol";
import {IEclipseMinter} from "../interface/IEclipseMinter.sol";
import {IEclipseMintGate, UserMint} from "../interface/IEclipseMintGate.sol";
struct GateParams {
uint8 gateType;
bytes gateCalldata;
}
abstract contract EclipseMinterBase is EclipseAccess, IEclipseMinter {
struct CollectionMintParams {
address artist;
uint48 startTime;
uint48 endTime;
uint24 maxSupply;
address gateAddress;
uint8 gateType;
}
struct CollectionState {
CollectionMintParams params;
uint24 available;
uint24 minted;
}
Eclipse public eclipse;
mapping(address => CollectionMintParams[]) public collections;
constructor(address eclipse_) EclipseAccess() {
eclipse = Eclipse(eclipse_);
}
function setEclipse(address eclipse_) external onlyAdmin {
eclipse = Eclipse(eclipse_);
}
function _getAvailableSupply(
address collection,
uint8 index
) internal view returns (uint24 available, uint24 minted) {
address gateAddress = collections[collection][index].gateAddress;
IEclipseMintGate gate = IEclipseMintGate(gateAddress);
uint24 totalMinted = gate.getTotalMinted(
collection,
address(this),
index
);
return (
collections[collection][index].maxSupply - totalMinted,
totalMinted
);
}
function getAllowedMintsForUser(
address collection,
uint8 index,
address user
) external view override returns (UserMint memory) {
address gateAddress = collections[collection][index].gateAddress;
IEclipseMintGate gate = IEclipseMintGate(gateAddress);
return gate.getUserMint(collection, address(this), index, user);
}
function getAvailableSupply(
address collection,
uint8 index
) external view override returns (uint24 available, uint24 minted) {
return _getAvailableSupply(collection, index);
}
function getCollectionState(
address collection
) external view returns (CollectionState[] memory) {
CollectionMintParams[] memory params = collections[collection];
CollectionState[] memory returnArr = new CollectionState[](
params.length
);
for (uint8 i; i < params.length; i++) {
(uint24 available, uint24 minted) = _getAvailableSupply(
collection,
i
);
returnArr[i] = CollectionState(params[i], available, minted);
}
return returnArr;
}
function _checkState(
address collection,
uint8 index
) internal view virtual {
uint256 timestamp = block.timestamp;
uint256 startTime = collections[collection][index].startTime;
uint256 endTime = collections[collection][index].endTime;
require(
startTime != 0 && startTime <= timestamp,
"mint not started yet"
);
if (endTime != 0) {
require(timestamp <= endTime, "mint ended");
}
}
function _getAllowedMints(
address collection,
uint8 index,
address minter,
address gateAddress,
address sender,
uint24 amount
) internal view returns (uint24) {
IEclipseMintGate gate = IEclipseMintGate(gateAddress);
uint24 allowedMints = gate.getAllowedMints(
collection,
minter,
index,
sender
);
require(allowedMints > 0, "no mints available");
uint24 minted = gate.getTotalMinted(collection, minter, index);
uint24 availableSupply = collections[collection][index].maxSupply -
minted;
require(availableSupply > 0, "sold out");
uint24 mints = amount > allowedMints ? allowedMints : amount;
return mints > availableSupply ? availableSupply : mints;
}
function _getAllowedMintsAndUpdate(
address collection,
uint8 index,
address minter,
address gateAddress,
address sender,
uint24 amount
) internal returns (uint24) {
IEclipseMintGate gate = IEclipseMintGate(gateAddress);
uint24 minted = _getAllowedMints(
collection,
index,
minter,
gateAddress,
sender,
amount
);
gate.update(collection, minter, index, sender, minted);
return minted;
}
}
文件 8 的 20:EclipseMinterFree.sol
pragma solidity ^0.8.0;
import {Eclipse} from "../app/Eclipse.sol";
import {IEclipseERC721} from "../interface/IEclipseERC721.sol";
import {IEclipseMintGate} from "../interface/IEclipseMintGate.sol";
import {IEclipsePaymentSplitter} from "../interface/IEclipsePaymentSplitter.sol";
import {EclipseMinterBase, GateParams} from "./EclipseMinterBase.sol";
contract EclipseMinterFree is EclipseMinterBase {
struct FreeParams {
address artist;
uint48 startTime;
uint48 endTime;
uint24 maxSupply;
GateParams gate;
}
event PricingSet(
address collection,
CollectionMintParams mint,
uint8 index
);
constructor(address eclipse_) EclipseMinterBase(eclipse_) {}
function setPricing(
address collection,
address sender,
bytes memory data
) external override onlyAdmin {
FreeParams memory params = abi.decode(data, (FreeParams));
CollectionMintParams[] storage col = collections[collection];
address artist = params.artist;
uint48 startTime = params.startTime;
uint48 endTime = params.endTime;
uint24 maxSupply = params.maxSupply;
uint8 index = uint8(col.length);
uint8 gateType = params.gate.gateType;
address gateAddress = Eclipse(eclipse).gateTypes(gateType);
checkParams(artist, sender, startTime, endTime, maxSupply);
IEclipseMintGate(gateAddress).addGateForCollection(
collection,
address(this),
index,
params.gate.gateCalldata
);
CollectionMintParams memory mintParams = CollectionMintParams(
artist,
startTime,
endTime,
maxSupply,
gateAddress,
gateType
);
col.push(mintParams);
emit PricingSet(collection, mintParams, index);
}
function checkParams(
address artist,
address sender,
uint48 startTime,
uint48 endTime,
uint24 maxSupply
) internal view {
require(sender == artist, "invalid collection");
require(startTime > block.timestamp, "startTime too early");
if (endTime != 0) {
require(endTime > startTime, "endTime must be greater startTime");
}
require(maxSupply > 0, "maxSupply must be greater 0");
}
function getPrice(address, uint8) public pure override returns (uint256) {
return 0;
}
function mintOne(
address collection,
uint8 index
) external payable override {
_checkState(collection, index);
address user = _msgSender();
address minter = address(this);
address gate = collections[collection][index].gateAddress;
_getAllowedMintsAndUpdate(collection, index, minter, gate, user, 1);
IEclipseERC721(collection).mintOne(user);
}
function mint(
address collection,
uint8 index,
uint24 amount
) external payable override {
_checkState(collection, index);
address user = _msgSender();
address minter = address(this);
address gate = collections[collection][index].gateAddress;
uint24 allowedMints = _getAllowedMintsAndUpdate(
collection,
index,
minter,
gate,
user,
amount
);
IEclipseERC721(collection).mint(user, allowedMints);
}
function getCollectionPricing(address) external pure returns (uint256) {
return 0;
}
}
文件 9 的 20:EclipsePaymentSplitterFactory.sol
pragma solidity ^0.8.0;
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {EclipseAccess} from "../access/EclipseAccess.sol";
contract EclipsePaymentSplitterFactory is EclipseAccess {
struct Payment {
address[] payees;
uint24[] shares;
}
address public implementation;
event Created(
address contractAddress,
address artist,
address[] payeesMint,
address[] payeesRoyalties,
uint24[] sharesMint,
uint24[] sharesRoyalties
);
constructor(address implementation_) EclipseAccess() {
implementation = implementation_;
}
function _createInitializer(
address owner,
address platformPayout,
address[] memory payeesMint,
address[] memory payeesRoyalties,
uint24[] memory sharesMint,
uint24[] memory sharesRoyalties
) internal pure returns (bytes memory) {
return
abi.encodeWithSignature(
"initialize(address,address,address[],address[],uint24[],uint24[])",
owner,
platformPayout,
payeesMint,
payeesRoyalties,
sharesMint,
sharesRoyalties
);
}
function clone(
address owner,
address platformPayout,
address artist,
address[] memory payeesMint,
address[] memory payeesRoyalties,
uint24[] memory sharesMint,
uint24[] memory sharesRoyalties
) external onlyAdmin returns (address) {
bytes memory initializer = _createInitializer(
owner,
platformPayout,
payeesMint,
payeesRoyalties,
sharesMint,
sharesRoyalties
);
address instance = Clones.clone(implementation);
Address.functionCall(instance, initializer);
emit Created(
instance,
artist,
payeesMint,
payeesRoyalties,
sharesMint,
sharesRoyalties
);
return instance;
}
function setImplementation(address implementation_) external onlyAdmin {
implementation = implementation_;
}
}
文件 10 的 20:EclipseStorage.sol
pragma solidity ^0.8.0;
import {EclipseAccess} from "../access/EclipseAccess.sol";
import {EclipseCollectionFactory} from "../factory/EclipseCollectionFactory.sol";
import {EclipsePaymentSplitterFactory} from "../factory/EclipsePaymentSplitterFactory.sol";
import {IEclipseERC721} from "../interface/IEclipseERC721.sol";
import {IEclipseMinter} from "../interface/IEclipseMinter.sol";
struct Collection {
uint256 id;
address artist;
address contractAddress;
uint256 maxSupply;
string script;
address paymentSplitter;
}
struct Artist {
address wallet;
address[] collections;
}
contract EclipseStorage is EclipseAccess {
mapping(address => Collection) public collections;
mapping(address => Artist) public artists;
event ScriptUpdated(address collection, string script);
function getPaymentSplitterForCollection(
address collection
) external view returns (address) {
return collections[collection].paymentSplitter;
}
function updateScript(address collection, string memory script) external {
require(collections[collection].artist == _msgSender(), "not allowed");
collections[collection].script = script;
emit ScriptUpdated(collection, script);
}
function setCollection(Collection calldata collection) external onlyAdmin {
collections[collection.contractAddress] = collection;
artists[collection.artist].collections.push(collection.contractAddress);
}
function setArtist(Artist calldata artist) external onlyAdmin {
artists[artist.wallet] = artist;
}
function getArtist(address artist) external view returns (Artist memory) {
return artists[artist];
}
function getCollection(
address collection
) external view returns (Collection memory) {
return collections[collection];
}
function getArtistOfCollection(
address collection
) external view returns (address) {
return collections[collection].artist;
}
function setPaymentSplitter(
address collection,
address paymentSplitter
) external onlyAdmin {
collections[collection].paymentSplitter = paymentSplitter;
}
}
文件 11 的 20:IERC165Upgradeable.sol
pragma solidity ^0.8.0;
interface IERC165Upgradeable {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 12 的 20:IERC2981Upgradeable.sol
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165Upgradeable.sol";
interface IERC2981Upgradeable is IERC165Upgradeable {
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
文件 13 的 20:IERC721EnumerableUpgradeable.sol
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
function totalSupply() external view returns (uint256);
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 14 的 20:IERC721MetadataUpgradeable.sol
pragma solidity ^0.8.0;
import "../IERC721Upgradeable.sol";
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function tokenURI(uint256 tokenId) external view returns (string memory);
}
文件 15 的 20:IERC721Upgradeable.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165Upgradeable.sol";
interface IERC721Upgradeable is IERC165Upgradeable {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function setApprovalForAll(address operator, bool _approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
文件 16 的 20:IEclipseERC721.sol
pragma solidity ^0.8.0;
import {IERC2981Upgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
import {IERC721EnumerableUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC721EnumerableUpgradeable.sol";
import {IERC721MetadataUpgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC721MetadataUpgradeable.sol";
interface IEclipseERC721 is
IERC721MetadataUpgradeable,
IERC2981Upgradeable,
IERC721EnumerableUpgradeable
{
function initialize(
string memory name,
string memory symbol,
string memory uri,
uint256 id,
uint24 maxSupply,
address admin,
address contractAdmin,
address artist,
address[] memory minters,
address paymentSplitter
) external;
function getTokensByOwner(
address _owner
) external view returns (uint256[] memory);
function getInfo()
external
view
returns (
string memory name,
string memory symbol,
address artist,
uint256 id,
uint24 maxSupply,
uint256 totalSupply
);
function mint(address to, uint24 amount) external;
function mintOne(address to) external;
function setMinter(address minter, bool enable) external;
}
文件 17 的 20:IEclipseMintGate.sol
pragma solidity ^0.8.0;
struct UserMint {
uint24 allowed;
uint24 minted;
}
interface IEclipseMintGate {
function getAllowedMints(
address collection,
address minterContract,
uint8 index,
address user
) external view returns (uint24);
function update(
address collection,
address minterContract,
uint8 index,
address user,
uint24 amount
) external;
function isUserAllowed(
address collection,
address minterContract,
uint8 index,
address user
) external view returns (bool);
function addGateForCollection(
address collection,
address minterContract,
uint8 index,
bytes memory data
) external;
function getTotalMinted(
address collection,
address minterContract,
uint8 index
) external view returns (uint24);
function getUserMint(
address collection,
address minterContract,
uint8 index,
address user
) external view returns (UserMint memory);
}
文件 18 的 20:IEclipseMinter.sol
pragma solidity ^0.8.0;
import {UserMint} from "./IEclipseMintGate.sol";
interface IEclipseMinter {
function mintOne(address collection, uint8 index) external payable;
function mint(
address collection,
uint8 index,
uint24 amount
) external payable;
function getPrice(
address collection,
uint8 index
) external view returns (uint256);
function getAllowedMintsForUser(
address collection,
uint8 index,
address user
) external view returns (UserMint memory);
function setPricing(
address collection,
address sender,
bytes memory data
) external;
function getAvailableSupply(
address collection,
uint8 index
) external view returns (uint24 available, uint24 minted);
}
文件 19 的 20:IEclipsePaymentSplitter.sol
pragma solidity ^0.8.0;
interface IEclipsePaymentSplitter {
function splitPayment() external payable;
function getTotalShares() external view returns (uint256);
function getTotalRoyaltyShares() external view returns (uint256);
function release(address account) external;
function updatePayee(
uint8 paymentType,
uint8 payeeIndex,
address newPayee
) external;
}
文件 20 的 20:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
{
"compilationTarget": {
"contracts/minter/EclipseMinterFree.sol": "EclipseMinterFree"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"eclipse_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"collection","type":"address"},{"components":[{"internalType":"address","name":"artist","type":"address"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint24","name":"maxSupply","type":"uint24"},{"internalType":"address","name":"gateAddress","type":"address"},{"internalType":"uint8","name":"gateType","type":"uint8"}],"indexed":false,"internalType":"struct EclipseMinterBase.CollectionMintParams","name":"mint","type":"tuple"},{"indexed":false,"internalType":"uint8","name":"index","type":"uint8"}],"name":"PricingSet","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"admins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"collections","outputs":[{"internalType":"address","name":"artist","type":"address"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint24","name":"maxSupply","type":"uint24"},{"internalType":"address","name":"gateAddress","type":"address"},{"internalType":"uint8","name":"gateType","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eclipse","outputs":[{"internalType":"contract Eclipse","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eclipseAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"address","name":"user","type":"address"}],"name":"getAllowedMintsForUser","outputs":[{"components":[{"internalType":"uint24","name":"allowed","type":"uint24"},{"internalType":"uint24","name":"minted","type":"uint24"}],"internalType":"struct UserMint","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint8","name":"index","type":"uint8"}],"name":"getAvailableSupply","outputs":[{"internalType":"uint24","name":"available","type":"uint24"},{"internalType":"uint24","name":"minted","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getCollectionPricing","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"}],"name":"getCollectionState","outputs":[{"components":[{"components":[{"internalType":"address","name":"artist","type":"address"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint24","name":"maxSupply","type":"uint24"},{"internalType":"address","name":"gateAddress","type":"address"},{"internalType":"uint8","name":"gateType","type":"uint8"}],"internalType":"struct EclipseMinterBase.CollectionMintParams","name":"params","type":"tuple"},{"internalType":"uint24","name":"available","type":"uint24"},{"internalType":"uint24","name":"minted","type":"uint24"}],"internalType":"struct EclipseMinterBase.CollectionState[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint8","name":"","type":"uint8"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint24","name":"amount","type":"uint24"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint8","name":"index","type":"uint8"}],"name":"mintOne","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bool","name":"access","type":"bool"}],"name":"setAdminAccess","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"eclipse_","type":"address"}],"name":"setEclipse","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"setEclipseAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"setPricing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]