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

erc1155 #165

Merged
merged 59 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
bcdd5be
new contracts
wolfy-nft Dec 5, 2024
6473f8f
lint
wolfy-nft Dec 5, 2024
4a672f0
forge install: ERC721A
wolfy-nft Dec 5, 2024
159ec2f
add cloneables
wolfy-nft Dec 5, 2024
5a6110f
fmt
wolfy-nft Dec 5, 2024
4ad4cdc
cloneable
wolfy-nft Dec 5, 2024
3df1b0a
move contract version to another branch
wolfy-nft Dec 6, 2024
61a9e14
add old version back
wolfy-nft Dec 6, 2024
6dd656b
fix
wolfy-nft Dec 6, 2024
b5e3f9f
add docs
wolfy-nft Dec 9, 2024
2eff675
stage logic
wolfy-nft Dec 9, 2024
8d9bd49
docs and tests
wolfy-nft Dec 10, 2024
2ed0306
cleanup
wolfy-nft Dec 10, 2024
1b7861c
enforce private before public, and transfer proceeds on mint
wolfy-nft Dec 10, 2024
010c3c3
1155
wolfy-nft Dec 12, 2024
5d373e7
fix build
wolfy-nft Dec 12, 2024
e98e6e4
remove test
wolfy-nft Dec 12, 2024
d6387cf
updates
wolfy-nft Dec 12, 2024
7a4aadc
Merge branch 'adam/feat/selfserve' of https://github.com/wolfy-nft/ma…
wolfy-nft Dec 12, 2024
2d8a8db
mint funcs
wolfy-nft Dec 13, 2024
62c20c9
fix
wolfy-nft Dec 16, 2024
99c0a83
comments
wolfy-nft Dec 17, 2024
3e06fd3
docs
wolfy-nft Dec 17, 2024
96e5a6b
updates
wolfy-nft Dec 17, 2024
be884be
Merge branch 'adam/feat/selfserve' of https://github.com/wolfy-nft/ma…
wolfy-nft Dec 17, 2024
c3c2f02
add file end newline
wolfy-nft Dec 17, 2024
3fd2a47
Merge branch 'adam/feat/selfserve' of https://github.com/wolfy-nft/ma…
wolfy-nft Dec 17, 2024
bf7f194
fix
wolfy-nft Dec 17, 2024
f85d80e
fix
wolfy-nft Dec 17, 2024
dedfe08
natspec
wolfy-nft Dec 17, 2024
c6202a0
docs
wolfy-nft Dec 17, 2024
27bbe29
1155 tests
wolfy-nft Dec 17, 2024
ac16d17
initial tests
wolfy-nft Dec 17, 2024
0dbc7b0
update tests
wolfy-nft Dec 17, 2024
2f4ddef
tests
wolfy-nft Dec 17, 2024
6a07d01
tests
wolfy-nft Dec 18, 2024
ae60719
test coverage
wolfy-nft Dec 18, 2024
46686fa
tests
wolfy-nft Dec 18, 2024
e5ac063
updates
wolfy-nft Dec 18, 2024
fd3fc3b
updates
wolfy-nft Dec 18, 2024
bf8448e
Merge branch 'adam/feat/selfserve' of https://github.com/wolfy-nft/ma…
wolfy-nft Dec 18, 2024
4574a2b
update
wolfy-nft Dec 18, 2024
fb00eab
fix
wolfy-nft Dec 18, 2024
38f956a
Merge branch 'adam/feat/selfserve' of https://github.com/wolfy-nft/ma…
wolfy-nft Dec 18, 2024
01483c2
cleanup
wolfy-nft Dec 18, 2024
a309ac7
cleanup
wolfy-nft Dec 18, 2024
fdcdcff
add royalties to setup config
wolfy-nft Dec 19, 2024
6a98ecd
add config function
wolfy-nft Jan 2, 2025
2d9c3f9
emit contract updated event
wolfy-nft Jan 6, 2025
12567c8
add header
wolfy-nft Jan 7, 2025
d9d911f
adjust fee config
wolfy-nft Jan 8, 2025
285b228
add missing event
wolfy-nft Jan 14, 2025
65af906
add mint event
wolfy-nft Jan 14, 2025
94a4bd0
change order of mint
wolfy-nft Jan 14, 2025
eb888e2
update allowlist
wolfy-nft Jan 16, 2025
e449030
fmt
wolfy-nft Jan 16, 2025
d69dfbe
fix burn function for 1155
wolfy-nft Jan 20, 2025
2638278
remove unused imports
wolfy-nft Jan 20, 2025
7dbd380
fix overpayment
wolfy-nft Jan 20, 2025
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
88 changes: 88 additions & 0 deletions contracts/common/interfaces/IMagicDropMetadata.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

interface IMagicDropMetadata {
/*==============================================================
= EVENTS =
==============================================================*/

/// @notice Emitted when the contract URI is updated.
/// @param _contractURI The new contract URI.
event ContractURIUpdated(string _contractURI);

/// @notice Emitted when the royalty info is updated.
/// @param receiver The new royalty receiver.
/// @param bps The new royalty basis points.
event RoyaltyInfoUpdated(address receiver, uint256 bps);

/// @notice Emitted when the metadata is updated. (EIP-4906)
/// @param _fromTokenId The starting token ID.
/// @param _toTokenId The ending token ID.
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);

/// @notice Emitted once when the token contract is deployed and initialized.
event MagicDropTokenDeployed();

/*==============================================================
= ERRORS =
==============================================================*/

/// @notice Throw when the max supply is exceeded.
error CannotExceedMaxSupply();

/// @notice Throw when the max supply is less than the current supply.
error MaxSupplyCannotBeLessThanCurrentSupply();

/// @notice Throw when trying to increase the max supply.
error MaxSupplyCannotBeIncreased();

/// @notice Throw when the max supply is greater than 2^64.
error MaxSupplyCannotBeGreaterThan2ToThe64thPower();

/*==============================================================
= PUBLIC VIEW METHODS =
==============================================================*/

/// @notice Returns the base URI used to construct token URIs
/// @dev This is concatenated with the token ID to form the complete token URI
/// @return The base URI string that prefixes all token URIs
function baseURI() external view returns (string memory);

/// @notice Returns the contract-level metadata URI
/// @dev Used by marketplaces like MagicEden to display collection information
/// @return The URI string pointing to the contract's metadata JSON
function contractURI() external view returns (string memory);

/// @notice Returns the address that receives royalty payments
/// @dev Used in conjunction with royaltyBps for EIP-2981 royalty standard
/// @return The address designated to receive royalty payments
function royaltyAddress() external view returns (address);

/// @notice Returns the royalty percentage in basis points (1/100th of a percent)
/// @dev 100 basis points = 1%. Used in EIP-2981 royalty calculations
/// @return The royalty percentage in basis points (e.g., 250 = 2.5%)
function royaltyBps() external view returns (uint256);

/*==============================================================
= ADMIN OPERATIONS =
==============================================================*/

/// @notice Sets the base URI for all token metadata
/// @dev This is a critical function that determines where all token metadata is hosted
/// Changing this will update the metadata location for all tokens in the collection
/// @param baseURI The new base URI string that will prefix all token URIs
function setBaseURI(string calldata baseURI) external;

/// @notice Sets the contract-level metadata URI
/// @dev This metadata is used by marketplaces to display collection information
/// Should point to a JSON file following collection metadata standards
/// @param contractURI The new URI string pointing to the contract's metadata JSON
function setContractURI(string calldata contractURI) external;

/// @notice Updates the royalty configuration for the collection
/// @dev Implements EIP-2981 for NFT royalty standards
/// The bps (basis points) must be between 0 and 10000 (0% to 100%)
/// @param newReceiver The address that will receive future royalty payments
/// @param newBps The royalty percentage in basis points (e.g., 250 = 2.5%)
function setRoyaltyInfo(address newReceiver, uint96 newBps) external;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

import {ERC1155} from "solady/src/tokens/ERC1155.sol";

/// @title ERC1155ConduitPreapprovedCloneable
/// @notice ERC1155 token with the MagicEden conduit preapproved for seamless transactions.
abstract contract ERC1155ConduitPreapprovedCloneable is ERC1155 {
/// @dev The canonical MagicEden conduit address.
address internal constant _CONDUIT = 0x2052f8A2Ff46283B30084e5d84c89A2fdBE7f74b;

/// @notice Safely transfers `amount` tokens of type `id` from `from` to `to`.
/// @param from The address holding the tokens.
/// @param to The address to transfer the tokens to.
/// @param id The token type identifier.
/// @param amount The number of tokens to transfer.
/// @param data Additional data with no specified format.
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data)
public
virtual
override
{
_safeTransfer(_by(), from, to, id, amount, data);
}

/// @notice Safely transfers a batch of tokens from `from` to `to`.
/// @param from The address holding the tokens.
/// @param to The address to transfer the tokens to.
/// @param ids An array of token type identifiers.
/// @param amounts An array of amounts to transfer for each token type.
/// @param data Additional data with no specified format.
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) public virtual override {
_safeBatchTransfer(_by(), from, to, ids, amounts, data);
}

/// @notice Checks if `operator` is approved to manage all of `owner`'s tokens.
/// @param owner The address owning the tokens.
/// @param operator The address to query for approval.
/// @return True if `operator` is approved, otherwise false.
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
if (operator == _CONDUIT) return true;
return ERC1155.isApprovedForAll(owner, operator);
}

/// @dev Determines the address initiating the transfer.
/// If the caller is the predefined conduit, returns address(0), else returns the caller's address.
/// @return result The address initiating the transfer.
function _by() internal view virtual returns (address result) {
assembly {
// `msg.sender == _CONDUIT ? address(0) : msg.sender`.
result := mul(iszero(eq(caller(), _CONDUIT)), caller())
}
}
}
Loading
Loading