Skip to content

Commit

Permalink
Doppelganger and Collectors Choice complete
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeyfuss committed Jan 5, 2024
1 parent e564074 commit d50740e
Show file tree
Hide file tree
Showing 14 changed files with 4,438 additions and 479 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ optimizer = true
optimizer_runs = 20000
verbosity = 3
wrap_comments = true
gas_reports = ["ERC721TL", "ERC1155TL", "Doppelganger", "CollectorsChoice", "OnChainArt", "Shatter", "TLCreator", "TLCreatorContractFactory", "TRACE", "ERC721TLM"]
gas_reports = ["ERC721TL", "ERC1155TL", "Doppelganger", "CollectorsChoice", "Shatter", "TRACE", "ERC7160TL"]
fs_permissions = [{ access = "read", path = "./"}]

[fuzz]
Expand Down
5 changes: 4 additions & 1 deletion src/erc-1155/ERC1155TL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ contract ERC1155TL is
}

/// @inheritdoc ICreatorBase
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE) {
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE)
{
_overrideTokenRoyaltyInfo(tokenId, newRecipient, newPercentage);
}

Expand Down
541 changes: 541 additions & 0 deletions src/erc-721/multi-metadata/CollectorsChoice.sol

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions src/erc-721/multi-metadata/Doppelganger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ contract Doppelganger is

/// @inheritdoc IERC721TL
/// @dev cannot mint unless at least one token uri has been added to the array
function mint(address recipient, string calldata /*uri*/) external onlyRoleOrOwner(ADMIN_ROLE) {
function mint(address recipient, string calldata /*uri*/ ) external onlyRoleOrOwner(ADMIN_ROLE) {
if (_tokenUris.length == 0) revert EmptyTokenURIs();
_counter++;
_mint(recipient, _counter);
}

/// @inheritdoc IERC721TL
/// @dev cannot mint unless at least one token uri has been added to the array
function mint(address recipient, string calldata /*uri*/, address royaltyAddress, uint256 royaltyPercent)
function mint(address recipient, string calldata, /*uri*/ address royaltyAddress, uint256 royaltyPercent)
external
onlyRoleOrOwner(ADMIN_ROLE)
{
Expand All @@ -207,7 +207,7 @@ contract Doppelganger is

/// @inheritdoc IERC721TL
/// @dev cannot mint unless at least one token uri has been added to the array
function batchMint(address recipient, uint128 numTokens, string calldata /*baseUri*/)
function batchMint(address recipient, uint128 numTokens, string calldata /*baseUri*/ )
external
onlyRoleOrOwner(ADMIN_ROLE)
{
Expand All @@ -228,7 +228,7 @@ contract Doppelganger is

/// @inheritdoc IERC721TL
/// @dev cannot mint unless at least one token uri has been added to the array
function airdrop(address[] calldata addresses, string calldata /*baseUri*/) external onlyRoleOrOwner(ADMIN_ROLE) {
function airdrop(address[] calldata addresses, string calldata /*baseUri*/ ) external onlyRoleOrOwner(ADMIN_ROLE) {
if (_tokenUris.length == 0) revert EmptyTokenURIs();
if (addresses.length < 2) revert AirdropTooFewAddresses();

Expand All @@ -241,7 +241,7 @@ contract Doppelganger is

/// @inheritdoc IERC721TL
/// @dev cannot mint unless at least one token uri has been added to the array
function externalMint(address recipient, string calldata /*uri*/) external onlyRole(APPROVED_MINT_CONTRACT) {
function externalMint(address recipient, string calldata /*uri*/ ) external onlyRole(APPROVED_MINT_CONTRACT) {
if (_tokenUris.length == 0) revert EmptyTokenURIs();
_counter++;
_mint(recipient, _counter);
Expand Down Expand Up @@ -269,7 +269,10 @@ contract Doppelganger is
}

/// @inheritdoc ICreatorBase
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE) {
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE)
{
_overrideTokenRoyaltyInfo(tokenId, newRecipient, newPercentage);
}

Expand All @@ -281,7 +284,9 @@ contract Doppelganger is
/// @dev Must be called by contract owner, admin, or approved mint contract
/// @param tokenUris Array of token uris to add
function addTokenUris(string[] calldata tokenUris) external {
if (msg.sender != owner() && !hasRole(ADMIN_ROLE, msg.sender) && !hasRole(APPROVED_MINT_CONTRACT, msg.sender)) revert NotOwnerAdminOrMintContract();
if (msg.sender != owner() && !hasRole(ADMIN_ROLE, msg.sender) && !hasRole(APPROVED_MINT_CONTRACT, msg.sender)) {
revert NotOwnerAdminOrMintContract();
}
if (tokenUris.length == 0) revert EmptyTokenURIs();
for (uint256 i = 0; i < tokenUris.length; i++) {
_tokenUris.push(tokenUris[i]);
Expand Down
9 changes: 7 additions & 2 deletions src/erc-721/multi-metadata/ERC7160TL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ contract ERC7160TL is
}

/// @inheritdoc ICreatorBase
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE) {
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE)
{
_overrideTokenRoyaltyInfo(tokenId, newRecipient, newPercentage);
}

Expand All @@ -296,7 +299,9 @@ contract ERC7160TL is
/// @param tokenIds Array of token ids that get metadata added to them
/// @param baseUri The base uri of a folder containing metadata - file names start at 0 and increase monotonically
function addTokenUris(uint256[] calldata tokenIds, string calldata baseUri) external {
if (msg.sender != owner() && !hasRole(ADMIN_ROLE, msg.sender) && !hasRole(APPROVED_MINT_CONTRACT, msg.sender)) revert NotOwnerAdminOrMintContract();
if (msg.sender != owner() && !hasRole(ADMIN_ROLE, msg.sender) && !hasRole(APPROVED_MINT_CONTRACT, msg.sender)) {
revert NotOwnerAdminOrMintContract();
}
if (bytes(baseUri).length == 0) revert EmptyTokenURI();
if (tokenIds.length == 0) revert NoTokensSpecified();
uint128 baseUriIndex = uint128(_multiMetadataBaseUris.length);
Expand Down
3 changes: 1 addition & 2 deletions src/erc-721/shatter/IShatter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ interface IShatter {
/// @param min The minimum number of shatters
/// @param max The maximum number of shatters
/// @param time Time after which shatter can occur
function mint(address recipient, string memory uri, uint128 min, uint128 max, uint256 time)
external;
function mint(address recipient, string memory uri, uint128 min, uint128 max, uint256 time) external;

/// @notice function to shatter the 1/1 token
/// @dev care should be taken to ensure that the following conditions are met
Expand Down
5 changes: 4 additions & 1 deletion src/erc-721/shatter/Shatter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ contract Shatter is
/// @param tokenId the token to override royalty for
/// @param newRecipient the new royalty payout address for the token id
/// @param newPercentage the new royalty percentage in basis (out of 10,000) for the token id
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE) {
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE)
{
_overrideTokenRoyaltyInfo(tokenId, newRecipient, newPercentage);
}

Expand Down
Loading

0 comments on commit d50740e

Please sign in to comment.