Skip to content

Commit b2733d7

Browse files
authored
Merge pull request #158 from thirdweb-dev/nkrishang/signature-drop
SignatureDrop implementation using contracts sdk features
2 parents 22d18b0 + 0c6c762 commit b2733d7

File tree

93 files changed

+13156
-664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+13156
-664
lines changed

contracts/Pack.sol

Lines changed: 4 additions & 4 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 "./feature/interface/IThirdwebOwnable.sol";
8-
import "./feature/interface/IThirdwebRoyalty.sol";
7+
import "./feature/interface/IOwnable.sol";
8+
import "./feature/interface/IRoyalty.sol";
99

1010
// Randomness
1111
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
@@ -28,8 +28,8 @@ import "./interfaces/ITWFee.sol";
2828
contract Pack is
2929
Initializable,
3030
IThirdwebContract,
31-
IThirdwebOwnable,
32-
IThirdwebRoyalty,
31+
IOwnable,
32+
IRoyalty,
3333
VRFConsumerBase,
3434
ERC2771ContextUpgradeable,
3535
MulticallUpgradeable,

contracts/ThirdwebContract.sol

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
// SPDX-License-Identifier: Apache-2.0
22
pragma solidity ^0.8.0;
33

4-
contract ThirdwebContract {
5-
/// @dev The publish metadata of the contract of which this contract is an instance.
6-
string private publishMetadataUri;
7-
/// @dev The metadata for this contract.
8-
string public contractURI;
4+
import "./feature/Ownable.sol";
5+
import "./feature/Context.sol";
6+
import "./feature/ContractMetadata.sol";
97

8+
contract ThirdwebContract is Context, Ownable, ContractMetadata {
109
struct ThirdwebInfo {
1110
string publishMetadataUri;
1211
string contractURI;
12+
address owner;
1313
}
1414

15+
/// @dev The publish metadata of the contract of which this contract is an instance.
16+
string private publishMetadataUri;
17+
1518
/// @dev Returns the publish metadata for this contract.
1619
function getPublishMetadataUri() external view returns (string memory) {
1720
return publishMetadataUri;
@@ -23,5 +26,16 @@ contract ThirdwebContract {
2326

2427
publishMetadataUri = _thirdwebInfo.publishMetadataUri;
2528
contractURI = _thirdwebInfo.contractURI;
29+
owner = _thirdwebInfo.owner;
30+
}
31+
32+
/// @dev Returns whether owner can be set in the given execution context.
33+
function _canSetOwner() internal virtual override returns (bool) {
34+
return _msgSender() == owner;
35+
}
36+
37+
/// @dev Returns whether contract metadata can be set in the given execution context.
38+
function _canSetContractURI() internal virtual override returns (bool) {
39+
return _msgSender() == owner;
2640
}
2741
}

contracts/drop/DropERC1155.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import "../interfaces/IThirdwebContract.sol";
2020

2121
// ========== Features ==========
2222

23-
import "../feature/interface/IThirdwebPlatformFee.sol";
24-
import "../feature/interface/IThirdwebPrimarySale.sol";
25-
import "../feature/interface/IThirdwebRoyalty.sol";
26-
import "../feature/interface/IThirdwebOwnable.sol";
23+
import "../feature/interface/IPlatformFee.sol";
24+
import "../feature/interface/IPrimarySale.sol";
25+
import "../feature/interface/IRoyalty.sol";
26+
import "../feature/interface/IOwnable.sol";
2727

2828
import { IDropERC1155 } from "../interfaces/drop/IDropERC1155.sol";
2929
import { ITWFee } from "../interfaces/ITWFee.sol";
@@ -37,10 +37,10 @@ import "../lib/MerkleProof.sol";
3737
contract DropERC1155 is
3838
Initializable,
3939
IThirdwebContract,
40-
IThirdwebOwnable,
41-
IThirdwebRoyalty,
42-
IThirdwebPrimarySale,
43-
IThirdwebPlatformFee,
40+
IOwnable,
41+
IRoyalty,
42+
IPrimarySale,
43+
IPlatformFee,
4444
ReentrancyGuardUpgradeable,
4545
ERC2771ContextUpgradeable,
4646
MulticallUpgradeable,

contracts/drop/DropERC20.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import "../interfaces/IThirdwebContract.sol";
1919

2020
// ========== Features ==========
2121

22-
import "../feature/interface/IThirdwebPlatformFee.sol";
23-
import "../feature/interface/IThirdwebPrimarySale.sol";
22+
import "../feature/interface/IPlatformFee.sol";
23+
import "../feature/interface/IPrimarySale.sol";
2424

2525
import { IDropERC20 } from "../interfaces/drop/IDropERC20.sol";
2626
import { ITWFee } from "../interfaces/ITWFee.sol";
@@ -34,8 +34,8 @@ import "../lib/FeeType.sol";
3434
contract DropERC20 is
3535
Initializable,
3636
IThirdwebContract,
37-
IThirdwebPrimarySale,
38-
IThirdwebPlatformFee,
37+
IPrimarySale,
38+
IPlatformFee,
3939
ReentrancyGuardUpgradeable,
4040
ERC2771ContextUpgradeable,
4141
MulticallUpgradeable,

contracts/drop/DropERC721.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import "../interfaces/IThirdwebContract.sol";
2121

2222
// ========== Features ==========
2323

24-
import "../feature/interface/IThirdwebPlatformFee.sol";
25-
import "../feature/interface/IThirdwebPrimarySale.sol";
26-
import "../feature/interface/IThirdwebRoyalty.sol";
27-
import "../feature/interface/IThirdwebOwnable.sol";
24+
import "../feature/interface/IPlatformFee.sol";
25+
import "../feature/interface/IPrimarySale.sol";
26+
import "../feature/interface/IRoyalty.sol";
27+
import "../feature/interface/IOwnable.sol";
2828

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

@@ -35,10 +35,10 @@ import "../lib/MerkleProof.sol";
3535
contract DropERC721 is
3636
Initializable,
3737
IThirdwebContract,
38-
IThirdwebOwnable,
39-
IThirdwebRoyalty,
40-
IThirdwebPrimarySale,
41-
IThirdwebPlatformFee,
38+
IOwnable,
39+
IRoyalty,
40+
IPrimarySale,
41+
IPlatformFee,
4242
ReentrancyGuardUpgradeable,
4343
ERC2771ContextUpgradeable,
4444
MulticallUpgradeable,

0 commit comments

Comments
 (0)