Skip to content

Commit

Permalink
Merge pull request #158 from thirdweb-dev/nkrishang/signature-drop
Browse files Browse the repository at this point in the history
SignatureDrop implementation using contracts sdk features
  • Loading branch information
nkrishang authored May 4, 2022
2 parents 22d18b0 + 0c6c762 commit b2733d7
Show file tree
Hide file tree
Showing 93 changed files with 13,156 additions and 664 deletions.
8 changes: 4 additions & 4 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 "./feature/interface/IThirdwebOwnable.sol";
import "./feature/interface/IThirdwebRoyalty.sol";
import "./feature/interface/IOwnable.sol";
import "./feature/interface/IRoyalty.sol";

// Randomness
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
Expand All @@ -28,8 +28,8 @@ import "./interfaces/ITWFee.sol";
contract Pack is
Initializable,
IThirdwebContract,
IThirdwebOwnable,
IThirdwebRoyalty,
IOwnable,
IRoyalty,
VRFConsumerBase,
ERC2771ContextUpgradeable,
MulticallUpgradeable,
Expand Down
24 changes: 19 additions & 5 deletions contracts/ThirdwebContract.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

contract ThirdwebContract {
/// @dev The publish metadata of the contract of which this contract is an instance.
string private publishMetadataUri;
/// @dev The metadata for this contract.
string public contractURI;
import "./feature/Ownable.sol";
import "./feature/Context.sol";
import "./feature/ContractMetadata.sol";

contract ThirdwebContract is Context, Ownable, ContractMetadata {
struct ThirdwebInfo {
string publishMetadataUri;
string contractURI;
address owner;
}

/// @dev The publish metadata of the contract of which this contract is an instance.
string private publishMetadataUri;

/// @dev Returns the publish metadata for this contract.
function getPublishMetadataUri() external view returns (string memory) {
return publishMetadataUri;
Expand All @@ -23,5 +26,16 @@ contract ThirdwebContract {

publishMetadataUri = _thirdwebInfo.publishMetadataUri;
contractURI = _thirdwebInfo.contractURI;
owner = _thirdwebInfo.owner;
}

/// @dev Returns whether owner can be set in the given execution context.
function _canSetOwner() internal virtual override returns (bool) {
return _msgSender() == owner;
}

/// @dev Returns whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal virtual override returns (bool) {
return _msgSender() == owner;
}
}
16 changes: 8 additions & 8 deletions contracts/drop/DropERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import "../interfaces/IThirdwebContract.sol";

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

import "../feature/interface/IThirdwebPlatformFee.sol";
import "../feature/interface/IThirdwebPrimarySale.sol";
import "../feature/interface/IThirdwebRoyalty.sol";
import "../feature/interface/IThirdwebOwnable.sol";
import "../feature/interface/IPlatformFee.sol";
import "../feature/interface/IPrimarySale.sol";
import "../feature/interface/IRoyalty.sol";
import "../feature/interface/IOwnable.sol";

import { IDropERC1155 } from "../interfaces/drop/IDropERC1155.sol";
import { ITWFee } from "../interfaces/ITWFee.sol";
Expand All @@ -37,10 +37,10 @@ import "../lib/MerkleProof.sol";
contract DropERC1155 is
Initializable,
IThirdwebContract,
IThirdwebOwnable,
IThirdwebRoyalty,
IThirdwebPrimarySale,
IThirdwebPlatformFee,
IOwnable,
IRoyalty,
IPrimarySale,
IPlatformFee,
ReentrancyGuardUpgradeable,
ERC2771ContextUpgradeable,
MulticallUpgradeable,
Expand Down
8 changes: 4 additions & 4 deletions contracts/drop/DropERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import "../interfaces/IThirdwebContract.sol";

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

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

import { IDropERC20 } from "../interfaces/drop/IDropERC20.sol";
import { ITWFee } from "../interfaces/ITWFee.sol";
Expand All @@ -34,8 +34,8 @@ import "../lib/FeeType.sol";
contract DropERC20 is
Initializable,
IThirdwebContract,
IThirdwebPrimarySale,
IThirdwebPlatformFee,
IPrimarySale,
IPlatformFee,
ReentrancyGuardUpgradeable,
ERC2771ContextUpgradeable,
MulticallUpgradeable,
Expand Down
16 changes: 8 additions & 8 deletions contracts/drop/DropERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import "../interfaces/IThirdwebContract.sol";

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

import "../feature/interface/IThirdwebPlatformFee.sol";
import "../feature/interface/IThirdwebPrimarySale.sol";
import "../feature/interface/IThirdwebRoyalty.sol";
import "../feature/interface/IThirdwebOwnable.sol";
import "../feature/interface/IPlatformFee.sol";
import "../feature/interface/IPrimarySale.sol";
import "../feature/interface/IRoyalty.sol";
import "../feature/interface/IOwnable.sol";

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

Expand All @@ -35,10 +35,10 @@ import "../lib/MerkleProof.sol";
contract DropERC721 is
Initializable,
IThirdwebContract,
IThirdwebOwnable,
IThirdwebRoyalty,
IThirdwebPrimarySale,
IThirdwebPlatformFee,
IOwnable,
IRoyalty,
IPrimarySale,
IPlatformFee,
ReentrancyGuardUpgradeable,
ERC2771ContextUpgradeable,
MulticallUpgradeable,
Expand Down
Loading

0 comments on commit b2733d7

Please sign in to comment.