-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Con215 - Update to Delayed Reveal functionality (#204)
* Update DelayedReveal extension * reduce optimizer runs by 10 * bump Sigdrop version 2 -> 3 * updated delayed reveal for DropERC721 * Bump DropERC721 version 2 -> 3 * fix lazy mint logic * fix encryptedBaseURI -> data * docs update * correct comments * run prettier * fix tests * fix pkg version * docs update * pkg release * update encryptedData check in lazy mint * do not check for data length * check if is empty in lazyMint() * fix tests for regular lazy mint * generated docs update * pkg release * Add IDelayedRevealDeprecated * pkg release * move MockContractPublisher to expose it to the SDK * fix test * fix lint Co-authored-by: Krishang Nadgauda <[email protected]> Co-authored-by: Joaquim Verges <[email protected]>
- Loading branch information
1 parent
97d7628
commit 0532c04
Showing
28 changed files
with
644 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
contracts/extension/interface/IDelayedRevealDeprecated.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
// [ DEPRECATED CONTRACT: use `contracts/extension/interface/IDelayedReveal.sol` instead ] | ||
|
||
/** | ||
* Thirdweb's `DelayedReveal` is a contract extension for base NFT contracts. It lets you create batches of | ||
* 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts | ||
*/ | ||
|
||
interface IDelayedRevealDeprecated { | ||
/// @dev Emitted when tokens are revealed. | ||
event TokenURIRevealed(uint256 indexed index, string revealedURI); | ||
|
||
/// @dev Returns the encrypted base URI associated with the given identifier. | ||
function encryptedBaseURI(uint256 identifier) external view returns (bytes memory); | ||
|
||
/** | ||
* @notice Reveals a batch of delayed reveal NFTs. | ||
* | ||
* @param identifier The ID for the batch of delayed-reveal NFTs to reveal. | ||
* | ||
* @param key The key with which the base URI for the relevant batch of NFTs was encrypted. | ||
*/ | ||
function reveal(uint256 identifier, bytes calldata key) external returns (string memory revealedURI); | ||
|
||
/** | ||
* @notice Performs XOR encryption/decryption. | ||
* | ||
* @param data The data to encrypt. In the case of delayed-reveal NFTs, this is the "revealed" state | ||
* base URI of the relevant batch of NFTs. | ||
* | ||
* @param key The key with which to encrypt data | ||
*/ | ||
function encryptDecrypt(bytes memory data, bytes calldata key) external pure returns (bytes memory result); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.11; | ||
|
||
import "../interfaces/IContractPublisher.sol"; | ||
|
||
// solhint-disable const-name-snakecase | ||
contract MockContractPublisher is IContractPublisher { | ||
function getAllPublishedContracts(address) | ||
external | ||
pure | ||
override | ||
returns (CustomContractInstance[] memory published) | ||
{ | ||
CustomContractInstance[] memory mocks = new CustomContractInstance[](1); | ||
mocks[0] = CustomContractInstance( | ||
"MockContract", | ||
123, | ||
"ipfs://mock", | ||
0x0000000000000000000000000000000000000000000000000000000000000001, | ||
address(0x0000000000000000000000000000000000000000) | ||
); | ||
return mocks; | ||
} | ||
|
||
function getPublishedContractVersions(address, string memory) | ||
external | ||
pure | ||
returns (CustomContractInstance[] memory published) | ||
{ | ||
return new CustomContractInstance[](0); | ||
} | ||
|
||
function getPublishedContract(address, string memory) | ||
external | ||
pure | ||
returns (CustomContractInstance memory published) | ||
{ | ||
return CustomContractInstance("", 0, "", "", address(0)); | ||
} | ||
|
||
function publishContract( | ||
address publisher, | ||
string memory contractId, | ||
string memory publishMetadataUri, | ||
string memory compilerMetadataUri, | ||
bytes32 bytecodeHash, | ||
address implementation | ||
) external {} | ||
|
||
function unpublishContract(address publisher, string memory contractId) external {} | ||
|
||
function setPublisherProfileUri(address, string memory) external {} | ||
|
||
function getPublisherProfileUri(address) external pure returns (string memory uri) { | ||
return ""; | ||
} | ||
|
||
function getPublishedUriFromCompilerUri(string memory) | ||
external | ||
pure | ||
returns (string[] memory publishedMetadataUris) | ||
{ | ||
return new string[](0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.