Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion contracts/Multiwrap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import "./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";
// Helpers
import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
import "./lib/CurrencyTransferLib.sol";
import "./lib/MultiTokenTransferLib.sol";

Expand Down Expand Up @@ -354,7 +355,7 @@ contract Multiwrap is
public
view
virtual
override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable, IERC165Upgradeable, ERC1155ReceiverUpgradeable)
override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable, ERC1155ReceiverUpgradeable)
returns (bool)
{
return
Expand Down
12 changes: 4 additions & 8 deletions contracts/Pack.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity ^0.8.11;
// Base
import "./openzeppelin-presets/ERC1155PresetUpgradeable.sol";
import "./interfaces/IThirdwebContract.sol";
import "./interfaces/IThirdwebOwnable.sol";
import "./interfaces/IThirdwebRoyalty.sol";
import "./feature/interface/IThirdwebOwnable.sol";
import "./feature/interface/IThirdwebRoyalty.sol";

// Randomness
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
Expand All @@ -20,6 +20,7 @@ import "./lib/FeeType.sol";

// Helper interfaces
import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";

// Thirdweb top-level
import "./interfaces/ITWFee.sol";
Expand Down Expand Up @@ -527,12 +528,7 @@ contract Pack is
**/

/// @dev See EIP 165
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155PresetUpgradeable, IERC165Upgradeable)
returns (bool)
{
function supportsInterface(bytes4 interfaceId) public view override(ERC1155PresetUpgradeable) returns (bool) {
return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId;
}

Expand Down
11 changes: 7 additions & 4 deletions contracts/drop/DropERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.
// ========== Internal imports ==========

import "../interfaces/IThirdwebContract.sol";
import "../interfaces/IThirdwebPlatformFee.sol";
import "../interfaces/IThirdwebPrimarySale.sol";
import "../interfaces/IThirdwebRoyalty.sol";
import "../interfaces/IThirdwebOwnable.sol";

// ========== Features ==========

import "../feature/interface/IThirdwebPlatformFee.sol";
import "../feature/interface/IThirdwebPrimarySale.sol";
import "../feature/interface/IThirdwebRoyalty.sol";
import "../feature/interface/IThirdwebOwnable.sol";

import { IDropERC1155 } from "../interfaces/drop/IDropERC1155.sol";
import { ITWFee } from "../interfaces/ITWFee.sol";
Expand Down
7 changes: 5 additions & 2 deletions contracts/drop/DropERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ import "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";
// ========== Internal imports ==========

import "../interfaces/IThirdwebContract.sol";
import "../interfaces/IThirdwebPlatformFee.sol";
import "../interfaces/IThirdwebPrimarySale.sol";

// ========== Features ==========

import "../feature/interface/IThirdwebPlatformFee.sol";
import "../feature/interface/IThirdwebPrimarySale.sol";

import { IDropERC20 } from "../interfaces/drop/IDropERC20.sol";
import { ITWFee } from "../interfaces/ITWFee.sol";
Expand Down
12 changes: 7 additions & 5 deletions contracts/drop/DropERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

import { IDropERC721 } from "../interfaces/drop/IDropERC721.sol";
import { ITWFee } from "../interfaces/ITWFee.sol";

import "../interfaces/IThirdwebContract.sol";
import "../interfaces/IThirdwebPlatformFee.sol";
import "../interfaces/IThirdwebPrimarySale.sol";
import "../interfaces/IThirdwebRoyalty.sol";
import "../interfaces/IThirdwebOwnable.sol";

// ========== Features ==========

import "../feature/interface/IThirdwebPlatformFee.sol";
import "../feature/interface/IThirdwebPrimarySale.sol";
import "../feature/interface/IThirdwebRoyalty.sol";
import "../feature/interface/IThirdwebOwnable.sol";

import "../openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";

Expand Down
30 changes: 16 additions & 14 deletions contracts/SignatureDrop.sol → contracts/drop/SignatureDrop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

// ========== Internal imports ==========

import "./interfaces/ITWFee.sol";
import "../interfaces/ITWFee.sol";
import "../interfaces/IThirdwebContract.sol";
import "../interfaces/drop/IDropClaimCondition.sol";

import "./interfaces/IThirdwebContract.sol";
import "./interfaces/IThirdwebPlatformFee.sol";
import "./interfaces/IThirdwebPrimarySale.sol";
import "./interfaces/IThirdwebRoyalty.sol";
import "./interfaces/IThirdwebOwnable.sol";
// ========== Features ==========

import "./interfaces/drop/IDropClaimCondition.sol";
import "./drop/DelayedReveal.sol";
import "./drop/LazyMint.sol";
import "./token/SignatureMintUpgradeable.sol";
import "../feature/interface/IThirdwebPlatformFee.sol";
import "../feature/interface/IThirdwebPrimarySale.sol";
import "../feature/interface/IThirdwebRoyalty.sol";
import "../feature/interface/IThirdwebOwnable.sol";
import "../feature/DelayedReveal.sol";
import "../feature/LazyMint.sol";
import "../feature/SignatureMintUpgradeable.sol";

import "./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";
import "../openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";

import "./lib/CurrencyTransferLib.sol";
import "./lib/FeeType.sol";
import "../lib/CurrencyTransferLib.sol";
import "../lib/FeeType.sol";

contract SignatureDrop is
Initializable,
Expand Down Expand Up @@ -206,7 +208,7 @@ contract SignatureDrop is
public
view
virtual
override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable, IERC165Upgradeable)
override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable)
returns (bool)
{
return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId;
Expand Down
138 changes: 138 additions & 0 deletions contracts/eip/ERC1155.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
@title ERC-1155 Multi Token Standard
@dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md
Note: The ERC-165 identifier for this interface is 0xd9b67a26.
*/
interface ERC1155 {
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_id` argument MUST be the token type being transferred.
The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _value
);

/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_ids` argument MUST be the list of tokens being transferred.
The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferBatch(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256[] _ids,
uint256[] _values
);

/**
@dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

/**
@dev MUST emit when the URI is updated for a token ID.
URIs are defined in RFC 3986.
The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);

/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _id,
uint256 _value,
bytes calldata _data
) external;

/**
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if length of `_ids` is not the same as length of `_values`.
MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
MUST revert on any other error.
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _ids IDs of each token type (order and length must match _values array)
@param _values Transfer amounts per token type (order and length must match _ids array)
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(
address _from,
address _to,
uint256[] calldata _ids,
uint256[] calldata _values,
bytes calldata _data
) external;

/**
@notice Get the balance of an account's Tokens.
@param _owner The address of the token holder
@param _id ID of the Token
@return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id) external view returns (uint256);

/**
@notice Get the balance of multiple account/token pairs
@param _owners The addresses of the token holders
@param _ids ID of the Tokens
@return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids)
external
view
returns (uint256[] memory);

/**
@notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
@dev MUST emit the ApprovalForAll event on success.
@param _operator Address to add to the set of authorized operators
@param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;

/**
@notice Queries the approval status of an operator for a given owner.
@param _owner The owner of the Tokens
@param _operator Address of authorized operator
@return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
16 changes: 16 additions & 0 deletions contracts/eip/ERC1155Enumerable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/// @title ERC1155Enumarable Non-Fungible Token Standard, optional enumeration extension
/// @dev See https://eips.ethereum.org/EIPS/eip-1155
interface ERC1155Enumerable {
/// @notice Count NFTs tracked by this contract
/// @return A count of valid NFTs tracked by this contract, where each one of
/// them has an assigned and queryable owner not equal to the zero address
function totalSupply(uint256 id) external view returns (uint256);

/// @notice Returns the next token ID available for minting
/// @return The token identifier for the `_index`th NFT,
/// (sort order not specified)
function nextTokenIdToMint() external view returns (uint256);
}
15 changes: 15 additions & 0 deletions contracts/eip/ERC1155Metadata.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
Note: The ERC-165 identifier for this interface is 0x0e89341c.
*/
interface ERC1155Metadata {
/**
@notice A distinct Uniform Resource Identifier (URI) for a given token.
@dev URIs are defined in RFC 3986.
The URI may point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
@return URI string
*/
function uri(uint256 _id) external view returns (string memory);
}
28 changes: 28 additions & 0 deletions contracts/eip/ERC20.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface ERC20 {
function totalSupply() external view returns (uint256);

function balanceOf(address who) external view returns (uint256);

function allowance(address owner, address spender) external view returns (uint256);

function transfer(address to, uint256 value) external returns (bool);

function approve(address spender, uint256 value) external returns (bool);

function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);

event Transfer(address indexed from, address indexed to, uint256 value);

event Approval(address indexed owner, address indexed spender, uint256 value);
}
14 changes: 14 additions & 0 deletions contracts/eip/ERC20Metadata.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

/**
* @title ERC20Metadata interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface ERC20Metadata {
function name() external view returns (string memory);

function symbol() external view returns (string memory);

function decimals() external view returns (uint8);
}
2 changes: 1 addition & 1 deletion contracts/eip/ERC721.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
pragma solidity ^0.8.0;

/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://eips.ethereum.org/EIPS/eip-721
Expand Down
2 changes: 1 addition & 1 deletion contracts/eip/ERC721Enumerable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
pragma solidity ^0.8.0;

/// @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
Expand Down
2 changes: 1 addition & 1 deletion contracts/eip/ERC721Metadata.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
pragma solidity ^0.8.0;

/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
/// @dev See https://eips.ethereum.org/EIPS/eip-721
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.11;
pragma solidity ^0.8.0;

import "../interfaces/drop/IDelayedReveal.sol";
import "./interface/IDelayedReveal.sol";

abstract contract DelayedReveal is IDelayedReveal {
/// @dev Mapping from id of a batch of tokens => to encrypted base URI for the respective batch of tokens.
Expand Down
Loading