Skip to content

Commit 2f6a68d

Browse files
reorganize exports for public consumption
1 parent 0666559 commit 2f6a68d

39 files changed

+339
-278
lines changed

contracts/Multiwrap.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import "./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";
2222
// Helpers
2323
import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol";
2424
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
25+
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
2526
import "./lib/CurrencyTransferLib.sol";
2627
import "./lib/MultiTokenTransferLib.sol";
2728

@@ -354,7 +355,7 @@ contract Multiwrap is
354355
public
355356
view
356357
virtual
357-
override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable, IERC165Upgradeable, ERC1155ReceiverUpgradeable)
358+
override(AccessControlEnumerableUpgradeable, ERC1155Upgradeable, ERC1155ReceiverUpgradeable)
358359
returns (bool)
359360
{
360361
return

contracts/Pack.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ pragma solidity ^0.8.11;
44
// Base
55
import "./openzeppelin-presets/ERC1155PresetUpgradeable.sol";
66
import "./interfaces/IThirdwebContract.sol";
7-
import "./interfaces/IThirdwebOwnable.sol";
8-
import "./interfaces/IThirdwebRoyalty.sol";
7+
import "./feature/interface/IThirdwebOwnable.sol";
8+
import "./feature/interface/IThirdwebRoyalty.sol";
99

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

2121
// Helper interfaces
2222
import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";
23+
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
2324

2425
// Thirdweb top-level
2526
import "./interfaces/ITWFee.sol";
@@ -530,7 +531,7 @@ contract Pack is
530531
function supportsInterface(bytes4 interfaceId)
531532
public
532533
view
533-
override(ERC1155PresetUpgradeable, IERC165Upgradeable)
534+
override(ERC1155PresetUpgradeable)
534535
returns (bool)
535536
{
536537
return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId;

contracts/drop/DropERC1155.sol

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.
1717
// ========== Internal imports ==========
1818

1919
import "../interfaces/IThirdwebContract.sol";
20-
import "../interfaces/IThirdwebPlatformFee.sol";
21-
import "../interfaces/IThirdwebPrimarySale.sol";
22-
import "../interfaces/IThirdwebRoyalty.sol";
23-
import "../interfaces/IThirdwebOwnable.sol";
20+
21+
// ========== Features ==========
22+
23+
import "../feature/interface/IThirdwebPlatformFee.sol";
24+
import "../feature/interface/IThirdwebPrimarySale.sol";
25+
import "../feature/interface/IThirdwebRoyalty.sol";
26+
import "../feature/interface/IThirdwebOwnable.sol";
2427

2528
import { IDropERC1155 } from "../interfaces/drop/IDropERC1155.sol";
2629
import { ITWFee } from "../interfaces/ITWFee.sol";

contracts/drop/DropERC20.sol

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ import "@openzeppelin/contracts-upgradeable/utils/MulticallUpgradeable.sol";
1616
// ========== Internal imports ==========
1717

1818
import "../interfaces/IThirdwebContract.sol";
19-
import "../interfaces/IThirdwebPlatformFee.sol";
20-
import "../interfaces/IThirdwebPrimarySale.sol";
19+
20+
// ========== Features ==========
21+
22+
import "../feature/interface/IThirdwebPlatformFee.sol";
23+
import "../feature/interface/IThirdwebPrimarySale.sol";
2124

2225
import { IDropERC20 } from "../interfaces/drop/IDropERC20.sol";
2326
import { ITWFee } from "../interfaces/ITWFee.sol";

contracts/drop/DropERC721.sol

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
1717

1818
import { IDropERC721 } from "../interfaces/drop/IDropERC721.sol";
1919
import { ITWFee } from "../interfaces/ITWFee.sol";
20-
2120
import "../interfaces/IThirdwebContract.sol";
22-
import "../interfaces/IThirdwebPlatformFee.sol";
23-
import "../interfaces/IThirdwebPrimarySale.sol";
24-
import "../interfaces/IThirdwebRoyalty.sol";
25-
import "../interfaces/IThirdwebOwnable.sol";
21+
22+
// ========== Features ==========
23+
24+
import "../feature/interface/IThirdwebPlatformFee.sol";
25+
import "../feature/interface/IThirdwebPrimarySale.sol";
26+
import "../feature/interface/IThirdwebRoyalty.sol";
27+
import "../feature/interface/IThirdwebOwnable.sol";
2628

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

contracts/SignatureDrop.sol renamed to contracts/drop/SignatureDrop.sol

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,25 @@ import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
1111

1212
// ========== Internal imports ==========
1313

14-
import "./interfaces/ITWFee.sol";
14+
import "../interfaces/ITWFee.sol";
15+
import "../interfaces/IThirdwebContract.sol";
16+
import "../interfaces/drop/IDropClaimCondition.sol";
1517

16-
import "./interfaces/IThirdwebContract.sol";
17-
import "./interfaces/IThirdwebPlatformFee.sol";
18-
import "./interfaces/IThirdwebPrimarySale.sol";
19-
import "./interfaces/IThirdwebRoyalty.sol";
20-
import "./interfaces/IThirdwebOwnable.sol";
18+
// ========== Features ==========
2119

22-
import "./interfaces/drop/IDropClaimCondition.sol";
23-
import "./drop/DelayedReveal.sol";
24-
import "./drop/LazyMint.sol";
25-
import "./token/SignatureMintUpgradeable.sol";
20+
import "../feature/interface/IThirdwebPlatformFee.sol";
21+
import "../feature/interface/IThirdwebPrimarySale.sol";
22+
import "../feature/interface/IThirdwebRoyalty.sol";
23+
import "../feature/interface/IThirdwebOwnable.sol";
24+
import "../feature/DelayedReveal.sol";
25+
import "../feature/LazyMint.sol";
26+
import "../feature/SignatureMintUpgradeable.sol";
2627

27-
import "./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";
28+
import "../openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol";
29+
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
2830

29-
import "./lib/CurrencyTransferLib.sol";
30-
import "./lib/FeeType.sol";
31+
import "../lib/CurrencyTransferLib.sol";
32+
import "../lib/FeeType.sol";
3133

3234
contract SignatureDrop is
3335
Initializable,
@@ -206,7 +208,7 @@ contract SignatureDrop is
206208
public
207209
view
208210
virtual
209-
override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable, IERC165Upgradeable)
211+
override(ERC721EnumerableUpgradeable, AccessControlEnumerableUpgradeable)
210212
returns (bool)
211213
{
212214
return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId;

contracts/eip/ERC1155.sol

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity ^0.8.0;
3+
4+
/**
5+
@title ERC-1155 Multi Token Standard
6+
@dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md
7+
Note: The ERC-165 identifier for this interface is 0xd9b67a26.
8+
*/
9+
/* is ERC165 */
10+
interface IERC1155 {
11+
/**
12+
@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).
13+
The `_operator` argument MUST be msg.sender.
14+
The `_from` argument MUST be the address of the holder whose balance is decreased.
15+
The `_to` argument MUST be the address of the recipient whose balance is increased.
16+
The `_id` argument MUST be the token type being transferred.
17+
The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
18+
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
19+
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
20+
*/
21+
event TransferSingle(
22+
address indexed _operator,
23+
address indexed _from,
24+
address indexed _to,
25+
uint256 _id,
26+
uint256 _value
27+
);
28+
29+
/**
30+
@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).
31+
The `_operator` argument MUST be msg.sender.
32+
The `_from` argument MUST be the address of the holder whose balance is decreased.
33+
The `_to` argument MUST be the address of the recipient whose balance is increased.
34+
The `_ids` argument MUST be the list of tokens being transferred.
35+
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.
36+
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
37+
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
38+
*/
39+
event TransferBatch(
40+
address indexed _operator,
41+
address indexed _from,
42+
address indexed _to,
43+
uint256[] _ids,
44+
uint256[] _values
45+
);
46+
47+
/**
48+
@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).
49+
*/
50+
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
51+
52+
/**
53+
@dev MUST emit when the URI is updated for a token ID.
54+
URIs are defined in RFC 3986.
55+
The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
56+
*/
57+
event URI(string _value, uint256 indexed _id);
58+
59+
/**
60+
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
61+
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
62+
MUST revert if `_to` is the zero address.
63+
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
64+
MUST revert on any other error.
65+
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
66+
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).
67+
@param _from Source address
68+
@param _to Target address
69+
@param _id ID of the token type
70+
@param _value Transfer amount
71+
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
72+
*/
73+
function safeTransferFrom(
74+
address _from,
75+
address _to,
76+
uint256 _id,
77+
uint256 _value,
78+
bytes calldata _data
79+
) external;
80+
81+
/**
82+
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
83+
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
84+
MUST revert if `_to` is the zero address.
85+
MUST revert if length of `_ids` is not the same as length of `_values`.
86+
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.
87+
MUST revert on any other error.
88+
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
89+
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
90+
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).
91+
@param _from Source address
92+
@param _to Target address
93+
@param _ids IDs of each token type (order and length must match _values array)
94+
@param _values Transfer amounts per token type (order and length must match _ids array)
95+
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
96+
*/
97+
function safeBatchTransferFrom(
98+
address _from,
99+
address _to,
100+
uint256[] calldata _ids,
101+
uint256[] calldata _values,
102+
bytes calldata _data
103+
) external;
104+
105+
/**
106+
@notice Get the balance of an account's Tokens.
107+
@param _owner The address of the token holder
108+
@param _id ID of the Token
109+
@return The _owner's balance of the Token type requested
110+
*/
111+
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
112+
113+
/**
114+
@notice Get the balance of multiple account/token pairs
115+
@param _owners The addresses of the token holders
116+
@param _ids ID of the Tokens
117+
@return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
118+
*/
119+
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids)
120+
external
121+
view
122+
returns (uint256[] memory);
123+
124+
/**
125+
@notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
126+
@dev MUST emit the ApprovalForAll event on success.
127+
@param _operator Address to add to the set of authorized operators
128+
@param _approved True if the operator is approved, false to revoke approval
129+
*/
130+
function setApprovalForAll(address _operator, bool _approved) external;
131+
132+
/**
133+
@notice Queries the approval status of an operator for a given owner.
134+
@param _owner The owner of the Tokens
135+
@param _operator Address of authorized operator
136+
@return True if the operator is approved, false if not
137+
*/
138+
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
139+
}

contracts/eip/ERC20.sol

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity ^0.8.0;
3+
4+
/**
5+
* @title ERC20 interface
6+
* @dev see https://github.com/ethereum/EIPs/issues/20
7+
*/
8+
interface IERC20 {
9+
function totalSupply() external view returns (uint256);
10+
11+
function balanceOf(address who) external view returns (uint256);
12+
13+
function allowance(address owner, address spender) external view returns (uint256);
14+
15+
function transfer(address to, uint256 value) external returns (bool);
16+
17+
function approve(address spender, uint256 value) external returns (bool);
18+
19+
function transferFrom(
20+
address from,
21+
address to,
22+
uint256 value
23+
) external returns (bool);
24+
25+
event Transfer(address indexed from, address indexed to, uint256 value);
26+
27+
event Approval(address indexed owner, address indexed spender, uint256 value);
28+
}

contracts/drop/DelayedReveal.sol renamed to contracts/feature/DelayedReveal.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
pragma solidity ^0.8.11;
2+
pragma solidity ^0.8.0;
33

4-
import "../interfaces/drop/IDelayedReveal.sol";
4+
import "./interface/IDelayedReveal.sol";
55

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

contracts/drop/LazyMint.sol renamed to contracts/feature/LazyMint.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
pragma solidity ^0.8.11;
2+
pragma solidity ^0.8.0;
33

4-
import "../interfaces/drop/ILazyMint.sol";
4+
import "./interface/ILazyMint.sol";
55

66
abstract contract LazyMint is ILazyMint {
77
/// @dev Largest tokenId of each batch of tokens with the same baseURI.

0 commit comments

Comments
 (0)