Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: downsize contracts #101

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
10 changes: 5 additions & 5 deletions contracts/BucketAuction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ contract BucketAuction is IBucketAuction, ERC721M {
address cosigner,
uint256 minimumContributionInWei,
uint64 startTimeUnixSeconds,
uint64 endTimeUnixSeconds
uint64 endTimeUnixSeconds,
uint64 timestampExpirySeconds
)
ERC721M(
collectionName,
Expand All @@ -41,10 +42,9 @@ contract BucketAuction is IBucketAuction, ERC721M {
maxMintableSupply,
globalWalletLimit,
cosigner,
/* timestampExpirySeconds= */
300,
/* mintCurrency= */
address(0)
timestampExpirySeconds,
address(0), // mintCurrency
address(0) // crossMintAddress
)
{
_claimable = false;
Expand Down
6 changes: 4 additions & 2 deletions contracts/BucketAuctionOperatorFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ contract BucketAuctionOperatorFilterer is
address cosigner,
uint256 minimumContributionInWei,
uint64 startTimeUnixSeconds,
uint64 endTimeUnixSeconds
uint64 endTimeUnixSeconds,
uint64 timestampExpirySeconds
)
UpdatableOperatorFilterer(
CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS,
Expand All @@ -35,7 +36,8 @@ contract BucketAuctionOperatorFilterer is
cosigner,
minimumContributionInWei,
startTimeUnixSeconds,
endTimeUnixSeconds
endTimeUnixSeconds,
timestampExpirySeconds
)
{}

Expand Down
1 change: 1 addition & 0 deletions contracts/DutchAuction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ contract DutchAuction is IDutchAuction, ERC721M {
/* timestampExpirySeconds= */
300,
/* mintCurrency= */
address(0),
address(0)
)
{
Expand Down
102 changes: 7 additions & 95 deletions contracts/ERC721M.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
uint256 globalWalletLimit,
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency
address mintCurrency,
address crossMintAddress
) ERC721A(collectionName, collectionSymbol) {
if (globalWalletLimit > maxMintableSupply)
revert GlobalWalletLimitOverflow();
Expand All @@ -84,6 +85,7 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
_cosigner = cosigner; // ethers.constants.AddressZero for no cosigning
_timestampExpirySeconds = timestampExpirySeconds;
_mintCurrency = mintCurrency;
_crossmintAddress = crossMintAddress;
}

/**
Expand All @@ -109,30 +111,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
return _numberMinted(minter);
}

/**
* @dev Sets cosigner.
*/
function setCosigner(address cosigner) external onlyOwner {
_cosigner = cosigner;
emit SetCosigner(cosigner);
}

/**
* @dev Sets expiry in seconds. This timestamp specifies how long a signature from cosigner is valid for.
*/
function setTimestampExpirySeconds(uint64 expiry) external onlyOwner {
_timestampExpirySeconds = expiry;
emit SetTimestampExpirySeconds(expiry);
}

/**
* @dev Sets crossmint address if using crossmint. This allows the specified address to call `crossmint`.
*/
function setCrossmintAddress(address crossmintAddress) external onlyOwner {
_crossmintAddress = crossmintAddress;
emit SetCrossmintAddress(crossmintAddress);
}

/**
* @dev Sets stages in the format of an array of `MintStageInfo`.
*
Expand Down Expand Up @@ -251,19 +229,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
return _globalWalletLimit;
}

/**
* @dev Sets global wallet limit.
*/
function setGlobalWalletLimit(uint256 globalWalletLimit)
external
onlyOwner
{
if (globalWalletLimit > _maxMintableSupply)
revert GlobalWalletLimitOverflow();
_globalWalletLimit = globalWalletLimit;
emit SetGlobalWalletLimit(globalWalletLimit);
}

/**
* @dev Returns number of minted token for a given address.
*/
Expand Down Expand Up @@ -293,52 +258,10 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
if (index >= _mintStages.length) {
revert("InvalidStage");
}
uint32 walletMinted = _stageMintedCountsPerWallet[index][msg.sender];
uint256 stageMinted = _stageMintedCounts[index];
return (_mintStages[index], walletMinted, stageMinted);
}

/**
* @dev Updates info for one stage specified by index (starting from 0).
*/
function updateStage(
uint256 index,
uint80 price,
uint32 walletLimit,
bytes32 merkleRoot,
uint24 maxStageSupply,
uint64 startTimeUnixSeconds,
uint64 endTimeUnixSeconds
) external onlyOwner {
if (index >= _mintStages.length) revert InvalidStage();
if (index >= 1) {
if (
startTimeUnixSeconds <
_mintStages[index - 1].endTimeUnixSeconds +
_timestampExpirySeconds
) {
revert InsufficientStageTimeGap();
}
}
_assertValidStartAndEndTimestamp(
startTimeUnixSeconds,
endTimeUnixSeconds
);
_mintStages[index].price = price;
_mintStages[index].walletLimit = walletLimit;
_mintStages[index].merkleRoot = merkleRoot;
_mintStages[index].maxStageSupply = maxStageSupply;
_mintStages[index].startTimeUnixSeconds = startTimeUnixSeconds;
_mintStages[index].endTimeUnixSeconds = endTimeUnixSeconds;

emit UpdateStage(
index,
price,
walletLimit,
merkleRoot,
maxStageSupply,
startTimeUnixSeconds,
endTimeUnixSeconds
return (
_mintStages[index],
_stageMintedCountsPerWallet[index][msg.sender],
_stageMintedCounts[index]
);
}

Expand Down Expand Up @@ -474,9 +397,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
_safeMint(to, qty);
}

/**
* @dev Withdraws funds by owner.
*/
function withdraw() external onlyOwner {
uint256 value = address(this).balance;
(bool success, ) = msg.sender.call{value: value}("");
Expand All @@ -503,14 +423,6 @@ contract ERC721M is IERC721M, ERC721AQueryable, Ownable, ReentrancyGuard {
emit SetBaseURI(baseURI);
}

/**
* @dev Sets token base URI permanent. Cannot revert.
*/
function setBaseURIPermanent() external onlyOwner {
_baseURIPermanent = true;
emit PermanentBaseURI(_currentBaseURI);
}

/**
* @dev Sets token URI suffix. e.g. ".json".
*/
Expand Down
6 changes: 4 additions & 2 deletions contracts/ERC721MAutoApprover.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ contract ERC721MAutoApprover is ERC721M {
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency,
address autoApproveAddress
address autoApproveAddress,
address crossmintAddress
)
ERC721M(
collectionName,
Expand All @@ -28,7 +29,8 @@ contract ERC721MAutoApprover is ERC721M {
globalWalletLimit,
cosigner,
timestampExpirySeconds,
mintCurrency
mintCurrency,
crossmintAddress
)
{
_autoApproveAddress = autoApproveAddress;
Expand Down
6 changes: 4 additions & 2 deletions contracts/ERC721MIncreasableOperatorFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ contract ERC721MIncreasableOperatorFilterer is
uint256 globalWalletLimit,
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency
address mintCurrency,
address crossmintAddress
)
UpdatableOperatorFilterer(
CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS,
Expand All @@ -34,7 +35,8 @@ contract ERC721MIncreasableOperatorFilterer is
globalWalletLimit,
cosigner,
timestampExpirySeconds,
mintCurrency
mintCurrency,
crossmintAddress
)
{}

Expand Down
6 changes: 4 additions & 2 deletions contracts/ERC721MIncreasableSupply.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ contract ERC721MIncreasableSupply is ERC721M {
uint256 globalWalletLimit,
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency
address mintCurrency,
address crossMintAddress
)
ERC721M(
collectionName,
Expand All @@ -28,7 +29,8 @@ contract ERC721MIncreasableSupply is ERC721M {
globalWalletLimit,
cosigner,
timestampExpirySeconds,
mintCurrency
mintCurrency,
crossMintAddress
)
{
_canIncreaseMaxMintableSupply = true;
Expand Down
6 changes: 4 additions & 2 deletions contracts/ERC721MOperatorFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ contract ERC721MOperatorFilterer is ERC721M, UpdatableOperatorFilterer {
uint256 globalWalletLimit,
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency
address mintCurrency,
address crossmintAddress
)
UpdatableOperatorFilterer(
CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS,
Expand All @@ -30,7 +31,8 @@ contract ERC721MOperatorFilterer is ERC721M, UpdatableOperatorFilterer {
globalWalletLimit,
cosigner,
timestampExpirySeconds,
mintCurrency
mintCurrency,
crossmintAddress
)
{}

Expand Down
6 changes: 4 additions & 2 deletions contracts/ERC721MOperatorFiltererAutoApprover.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ contract ERC721MOperatorFiltererAutoApprover is ERC721MOperatorFilterer {
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency,
address autoApproveAddress
address autoApproveAddress,
address crossMintAddress
)
ERC721MOperatorFilterer(
collectionName,
Expand All @@ -28,7 +29,8 @@ contract ERC721MOperatorFiltererAutoApprover is ERC721MOperatorFilterer {
globalWalletLimit,
cosigner,
timestampExpirySeconds,
mintCurrency
mintCurrency,
crossMintAddress
)
{
_autoApproveAddress = autoApproveAddress;
Expand Down
6 changes: 4 additions & 2 deletions contracts/ERC721MPausable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ contract ERC721MPausable is ERC721M, Pausable {
uint256 globalWalletLimit,
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency
address mintCurrency,
address crossmintAddress
)
ERC721M(
collectionName,
Expand All @@ -24,7 +25,8 @@ contract ERC721MPausable is ERC721M, Pausable {
globalWalletLimit,
cosigner,
timestampExpirySeconds,
mintCurrency
mintCurrency,
crossmintAddress
)
{}

Expand Down
6 changes: 4 additions & 2 deletions contracts/ERC721MPausableOperatorFilterer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ contract ERC721MPausableOperatorFilterer is
uint256 globalWalletLimit,
address cosigner,
uint64 timestampExpirySeconds,
address mintCurrency
address mintCurrency,
address crossMintAddress
)
UpdatableOperatorFilterer(
CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS,
Expand All @@ -33,7 +34,8 @@ contract ERC721MPausableOperatorFilterer is
globalWalletLimit,
cosigner,
timestampExpirySeconds,
mintCurrency
mintCurrency,
crossMintAddress
)
{}

Expand Down
Loading
Loading