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

New Drops + Tiered Drop #270

Merged
merged 111 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
d3b2708
max supply claimable per wallet
kumaryash90 Sep 5, 2022
a5df8ca
add tests
kumaryash90 Sep 5, 2022
df9754c
run prettier
kumaryash90 Sep 5, 2022
2e135f1
remove global maxWalletClaimCount and walletClaimCount
kumaryash90 Sep 8, 2022
f8642bc
apply the changes to extensions
kumaryash90 Sep 8, 2022
538b776
add tests
kumaryash90 Sep 8, 2022
f58cf06
remove BOT check; reduce sigdrop size
kumaryash90 Sep 8, 2022
29fd1be
run prettier
kumaryash90 Sep 8, 2022
7ce80bb
claim interface update
kumaryash90 Sep 13, 2022
69be560
Merge branch 'main' into update-max-claimable
kumaryash90 Sep 13, 2022
0de9e0e
fix multiphase Drop extension
kumaryash90 Sep 15, 2022
e98d044
add Drop1155 extension
kumaryash90 Sep 15, 2022
0dbbfe5
write DropERC721Temp with extensions
kumaryash90 Sep 15, 2022
c5157f8
write DropERC20Temp with extensions
kumaryash90 Sep 15, 2022
d40ee1e
write DropERC1155Temp with extensions; plus delayedReveal
kumaryash90 Sep 15, 2022
97425d7
run prettier
kumaryash90 Sep 15, 2022
931ce33
merge main
kumaryash90 Sep 15, 2022
c319c70
allowlist -> override list; update struct
kumaryash90 Sep 16, 2022
89084c7
update tests
kumaryash90 Sep 16, 2022
d503221
add tests
kumaryash90 Sep 16, 2022
ce919e8
saleRecipient mapping for DropERC1155
kumaryash90 Sep 16, 2022
873275a
tests for DropERC20 and 1155
kumaryash90 Sep 16, 2022
3f8a0f3
forge update
Sep 19, 2022
5b5ba77
DropERC20: remove unused import
Sep 19, 2022
5d6811d
DropERC20: delete commented supportsInterface
Sep 20, 2022
182bcb9
Sync versions of all DropERCxxx contracts
Sep 20, 2022
7d73e34
DropERC20: cleanup comments
Sep 20, 2022
6ac3bd5
DropERC721: cleanup comments
Sep 20, 2022
c3b501a
DropERC1155: cleanup commented code
Sep 20, 2022
45cd832
ERC721Drop: remove unused imports
Sep 20, 2022
a402a4e
ERC721Drop: remove BOT check
Sep 20, 2022
71df390
ERC1155Drop: re-organize contract code
Sep 20, 2022
932ddec
ERC1155Drop: remove BOT check
Sep 20, 2022
e18c750
DropSinglePhase: Remove bitmap
Sep 20, 2022
6ae56b5
DropSinglePhase1155: Remove bitmap
Sep 20, 2022
30a55e7
Drop: remove bitmap
Sep 20, 2022
bc0f822
Drop1155: remove bitmap
Sep 20, 2022
7cc7be3
run prettier
Sep 20, 2022
95a6e91
ERC721Drop: remove BOT check test
Sep 20, 2022
ba8f32b
docs update
Sep 20, 2022
2a24a3c
DropERC1155: remove burn, keep burnBatch
Sep 20, 2022
9e525bc
update Drop design doc
kumaryash90 Sep 22, 2022
74e0574
merge main into update-max-claimable
kumaryash90 Sep 22, 2022
340767b
update docs
kumaryash90 Sep 22, 2022
f44f2d3
v3.1.9-2
kumaryash90 Sep 22, 2022
6981a9e
update doc, cleanup
kumaryash90 Sep 22, 2022
c0298f7
forge updates
Oct 6, 2022
d903aee
metadata in ClaimCondition struct
kumaryash90 Oct 18, 2022
6a7afa2
pull from origin
Oct 18, 2022
c95379b
merge main -> this
Oct 18, 2022
6a419d1
Add SignatureAction
Oct 19, 2022
29dce07
Add LazyMintWithTier
Oct 19, 2022
acedc6d
Add SIgnatureActionUpgradeable
Oct 19, 2022
1559017
Add TieredDrop
Oct 19, 2022
0cd4033
Add inital TieredDrop tests
Oct 19, 2022
3174a92
docs update
Oct 19, 2022
3fb255b
pkg release
Oct 19, 2022
c05bf03
Merge branch 'main' into update-max-claimable
kumaryash90 Oct 19, 2022
048aef5
Merge main -> this
Oct 19, 2022
83da7b3
docs updat
Oct 19, 2022
6772443
pkg release
Oct 19, 2022
eba2781
legacy contracts
kumaryash90 Oct 19, 2022
cf169db
Add code comments to Drop related interfaces
Oct 20, 2022
665715f
Don't enforce camelCase contractName, for legacy contracts
Oct 20, 2022
857cd75
DropERC1155: remove delayed-reveal
kumaryash90 Oct 20, 2022
f2b3974
v3.2.0-0
kumaryash90 Oct 20, 2022
116a78b
cpy ERC721A
Oct 20, 2022
8e57942
getTokensInTier -> getMetadataInTier
Oct 25, 2022
a106ee9
Add getTokensInTier in top level contract
Oct 25, 2022
e20ecee
Add code comments for tier related state
Oct 25, 2022
fc93993
Add totalMintedForTier
Oct 25, 2022
acaa20b
turn endIdsAtMint from array to mapping + len
Oct 25, 2022
3f636b1
return value for verifyClaim
kumaryash90 Oct 25, 2022
7b66d36
docs
kumaryash90 Oct 25, 2022
220c288
v3.2.0-1
kumaryash90 Oct 25, 2022
de41d4d
docs update
nkrishang Oct 26, 2022
36775db
pkg release
nkrishang Oct 26, 2022
16424bb
fix return val for getMetadataInTier
nkrishang Oct 26, 2022
42d06ac
pkg release
nkrishang Oct 26, 2022
9326bc0
delete ERC721A copies
nkrishang Oct 26, 2022
aab0eed
Return correct startId in getTokensInTier ranges
nkrishang Oct 27, 2022
58f1a4a
pkg release
nkrishang Oct 27, 2022
6ce0b21
document limitations of override-list
kumaryash90 Oct 27, 2022
8f41f15
legacy SignatureDrop
kumaryash90 Oct 28, 2022
684beaa
docs
kumaryash90 Oct 28, 2022
478848a
v3.2.0-2
kumaryash90 Oct 28, 2022
d9376bd
Add code comments to top level TieredDrop
nkrishang Oct 31, 2022
efd832f
Add code comments to LazyMintWithTier
nkrishang Oct 31, 2022
fdb94e3
Update description for LazyMintWithTier
nkrishang Oct 31, 2022
cc32158
Update code comments and description for SignatureAction
nkrishang Oct 31, 2022
385cbb7
getMetadataId public -> internal function
nkrishang Oct 31, 2022
0402180
TieredDrop tests skeleton
nkrishang Oct 31, 2022
f9f8833
Fix role restrictions for lazy minting
nkrishang Oct 31, 2022
c0cbeb6
change default allowlist qty to 0
kumaryash90 Oct 31, 2022
879ae22
update tests
kumaryash90 Oct 31, 2022
69e272b
v3.2.0-3
kumaryash90 Oct 31, 2022
0e2a462
Add tests for tiered-drop
nkrishang Nov 1, 2022
fd5391d
Fix + cleanup TieredDrop from tests
nkrishang Nov 1, 2022
13259f8
merge main -> this
nkrishang Nov 1, 2022
63da8c7
pkg release
nkrishang Nov 1, 2022
d57c4c5
merge drop and tiered-drop branches
kumaryash90 Nov 1, 2022
213e55b
v3.2.0-4
kumaryash90 Nov 1, 2022
9ab1d42
add getTokensInTier benchmark
nkrishang Nov 2, 2022
b30099e
Change pricePerToken -> totalPrice
nkrishang Nov 3, 2022
c40aa6f
Add getMetadataForAllTiers getTierForToken getAllTiers
nkrishang Nov 3, 2022
5d23181
Add tier to TokensLazyMinted event
nkrishang Nov 3, 2022
f8b14a5
remove contract type and version to cut on size
nkrishang Nov 3, 2022
7927dc0
remove getAllTiers and turn getMetadataForTier private
nkrishang Nov 3, 2022
2b75f1f
comment out getMetadataForAllTiers tests due to compilation errors
nkrishang Nov 3, 2022
2632d3b
merge tiered-drop changes -> this
nkrishang Nov 3, 2022
11ea6d7
pkg release
nkrishang Nov 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"code-complexity": ["error", 9],
"compiler-version": ["error", "^0.8.0"],
"const-name-snakecase": "error",
"contract-name-camelcase": "error",
"event-name-camelcase": "error",
"constructor-syntax": "error",
"func-name-mixedcase": "off",
Expand Down
75 changes: 13 additions & 62 deletions contracts/base/ERC1155Drop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ contract ERC1155Drop is
_setupPrimarySaleRecipient(_primarySaleRecipient);
}

/*//////////////////////////////////////////////////////////////
ERC165 Logic
//////////////////////////////////////////////////////////////*/

/// @notice Returns whether this contract supports the given interface.
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) {
return
interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI
interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981
}

/*///////////////////////////////////////////////////////////////
Overriden metadata logic
//////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -155,67 +168,6 @@ contract ERC1155Drop is
return nextTokenIdToLazyMint;
}

/*//////////////////////////////////////////////////////////////
Minting/burning logic
//////////////////////////////////////////////////////////////*/

/**
* @notice Lets an owner or approved operator burn NFTs of the given tokenId.
*
* @param _owner The owner of the NFT to burn.
* @param _tokenId The tokenId of the NFT to burn.
* @param _amount The amount of the NFT to burn.
*/
function burn(
address _owner,
uint256 _tokenId,
uint256 _amount
) external virtual {
address caller = msg.sender;

require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
require(balanceOf[_owner][_tokenId] >= _amount, "Not enough tokens owned");

_burn(_owner, _tokenId, _amount);
}

/**
* @notice Lets an owner or approved operator burn NFTs of the given tokenIds.
*
* @param _owner The owner of the NFTs to burn.
* @param _tokenIds The tokenIds of the NFTs to burn.
* @param _amounts The amounts of the NFTs to burn.
*/
function burnBatch(
address _owner,
uint256[] memory _tokenIds,
uint256[] memory _amounts
) external virtual {
address caller = msg.sender;

require(caller == _owner || isApprovedForAll[_owner][caller], "Unapproved caller");
require(_tokenIds.length == _amounts.length, "Length mismatch");

for (uint256 i = 0; i < _tokenIds.length; i += 1) {
require(balanceOf[_owner][_tokenIds[i]] >= _amounts[i], "Not enough tokens owned");
}

_burnBatch(_owner, _tokenIds, _amounts);
}

/*//////////////////////////////////////////////////////////////
ERC165 Logic
//////////////////////////////////////////////////////////////*/

/// @notice Returns whether this contract supports the given interface.
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) {
return
interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI
interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981
}

/*///////////////////////////////////////////////////////////////
Internal functions
//////////////////////////////////////////////////////////////*/
Expand All @@ -230,7 +182,6 @@ contract ERC1155Drop is
AllowlistProof calldata,
bytes memory
) internal view virtual override {
require(msg.sender == tx.origin, "BOT");
if (_tokenId >= nextTokenIdToLazyMint) {
revert("Not enough minted tokens");
}
Expand Down
2 changes: 0 additions & 2 deletions contracts/base/ERC721Drop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "../extension/Ownable.sol";
import "../extension/Royalty.sol";
import "../extension/BatchMintMetadata.sol";
import "../extension/PrimarySale.sol";
import "../extension/PermissionsEnumerable.sol";
import "../extension/DropSinglePhase.sol";
import "../extension/LazyMint.sol";
import "../extension/DelayedReveal.sol";
Expand Down Expand Up @@ -191,7 +190,6 @@ contract ERC721Drop is
AllowlistProof calldata,
bytes memory
) internal view virtual override {
require(msg.sender == tx.origin, "BOT");
if (_currentIndex + _quantity > nextTokenIdToLazyMint) {
revert("Not enough minted tokens");
}
Expand Down
Loading