-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
able to set mintFees for lazyClaim (#101)
* able to set mintFees for lazyClaim * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * add comments about mint fees * remove mintfee settings in constructor * use one setMintFees function to set mintFee and mintMerkleFee * lint-fix * add kill switch for claim initialization and tests * use Pausable library from openzepplin * fix wordings * add more tests for pausing logic * fix up tests to separate between owner of claim contract vs creator contract * add comments * dont use openzepplin lib * rename to active * separate out updatable mint fee lazyClam vs normal lazyClaim * remove redundant artifacts * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * lint-fix * ad comments
- Loading branch information
Showing
20 changed files
with
5,243 additions
and
4 deletions.
There are no files selected for viewing
360 changes: 360 additions & 0 deletions
360
packages/manifold/contracts/lazyUpdatableFeeClaim/ERC1155LazyPayableClaimV2.sol
Large diffs are not rendered by default.
Oops, something went wrong.
422 changes: 422 additions & 0 deletions
422
packages/manifold/contracts/lazyUpdatableFeeClaim/ERC721LazyPayableClaimV2.sol
Large diffs are not rendered by default.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
packages/manifold/contracts/lazyUpdatableFeeClaim/IERC1155LazyPayableClaimMetadataV2.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,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/// @author: manifold.xyz | ||
|
||
/** | ||
* ERC1155 Lazy Payable Claim External Metadata interface | ||
*/ | ||
interface IERC1155LazyPayableClaimMetadataV2 { | ||
/** | ||
* @notice Get the token URI for a claim instance | ||
*/ | ||
function tokenURI(address creatorContract, uint256 tokenId, uint256 instanceId) external view returns (string memory); | ||
} |
101 changes: 101 additions & 0 deletions
101
packages/manifold/contracts/lazyUpdatableFeeClaim/IERC1155LazyPayableClaimV2.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,101 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/// @author: manifold.xyz | ||
|
||
import "./ILazyPayableClaimV2.sol"; | ||
|
||
/** | ||
* Lazy Claim interface | ||
*/ | ||
interface IERC1155LazyPayableClaimV2 is ILazyPayableClaimV2 { | ||
|
||
struct ClaimParameters { | ||
uint32 totalMax; | ||
uint32 walletMax; | ||
uint48 startDate; | ||
uint48 endDate; | ||
StorageProtocol storageProtocol; | ||
bytes32 merkleRoot; | ||
string location; | ||
uint256 cost; | ||
address payable paymentReceiver; | ||
address erc20; | ||
address signingAddress; | ||
} | ||
|
||
struct Claim { | ||
uint32 total; | ||
uint32 totalMax; | ||
uint32 walletMax; | ||
uint48 startDate; | ||
uint48 endDate; | ||
StorageProtocol storageProtocol; | ||
bytes32 merkleRoot; | ||
string location; | ||
uint256 tokenId; | ||
uint256 cost; | ||
address payable paymentReceiver; | ||
address erc20; | ||
address signingAddress; | ||
} | ||
|
||
/** | ||
* @notice initialize a new claim, emit initialize event | ||
* @param creatorContractAddress the creator contract the claim will mint tokens for | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param claimParameters the parameters which will affect the minting behavior of the claim | ||
*/ | ||
function initializeClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external; | ||
|
||
/** | ||
* @notice update an existing claim at instanceId | ||
* @param creatorContractAddress the creator contract corresponding to the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param claimParameters the parameters which will affect the minting behavior of the claim | ||
*/ | ||
function updateClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external; | ||
|
||
/** | ||
* @notice update tokenURI parameters for an existing claim at instanceId | ||
* @param creatorContractAddress the creator contract corresponding to the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param storageProtocol the new storage protocol | ||
* @param location the new location | ||
*/ | ||
function updateTokenURIParams(address creatorContractAddress, uint256 instanceId, StorageProtocol storageProtocol, string calldata location) external; | ||
|
||
/** | ||
* @notice extend tokenURI parameters for an existing claim at instanceId. Must have NONE StorageProtocol | ||
* @param creatorContractAddress the creator contract corresponding to the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param locationChunk the additional location chunk | ||
*/ | ||
function extendTokenURI(address creatorContractAddress, uint256 instanceId, string calldata locationChunk) external; | ||
|
||
/** | ||
* @notice get a claim corresponding to a creator contract and instanceId | ||
* @param creatorContractAddress the address of the creator contract | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @return the claim object | ||
*/ | ||
function getClaim(address creatorContractAddress, uint256 instanceId) external view returns(Claim memory); | ||
|
||
/** | ||
* @notice get a claim corresponding to a token | ||
* @param creatorContractAddress the address of the creator contract | ||
* @param tokenId the tokenId of the claim | ||
* @return the claim instanceId and claim object | ||
*/ | ||
function getClaimForToken(address creatorContractAddress, uint256 tokenId) external view returns(uint256, Claim memory); | ||
|
||
/** | ||
* @notice allow admin to airdrop arbitrary tokens | ||
* @param creatorContractAddress the creator contract the claim will mint tokens for | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param recipients addresses to airdrop to | ||
* @param amounts number of tokens to airdrop to each address in addresses | ||
*/ | ||
function airdrop(address creatorContractAddress, uint256 instanceId, address[] calldata recipients, uint256[] calldata amounts) external; | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/manifold/contracts/lazyUpdatableFeeClaim/IERC721LazyPayableClaimMetadataV2.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,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/// @author: manifold.xyz | ||
|
||
/** | ||
* ERC721 Lazy Claim External Metadata interface | ||
*/ | ||
interface IERC721LazyPayableClaimMetadataV2 { | ||
/** | ||
* @notice Get the token URI for a claim instance | ||
*/ | ||
function tokenURI(address creatorContract, uint256 tokenId, uint256 instanceId, uint24 mintOrder) external view returns (string memory); | ||
} |
103 changes: 103 additions & 0 deletions
103
packages/manifold/contracts/lazyUpdatableFeeClaim/IERC721LazyPayableClaimV2.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,103 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/// @author: manifold.xyz | ||
|
||
import "./ILazyPayableClaimV2.sol"; | ||
|
||
/** | ||
* Lazy Payable Claim interface | ||
*/ | ||
interface IERC721LazyPayableClaimV2 is ILazyPayableClaimV2 { | ||
struct ClaimParameters { | ||
uint32 totalMax; | ||
uint32 walletMax; | ||
uint48 startDate; | ||
uint48 endDate; | ||
StorageProtocol storageProtocol; | ||
bool identical; | ||
bytes32 merkleRoot; | ||
string location; | ||
uint256 cost; | ||
address payable paymentReceiver; | ||
address erc20; | ||
address signingAddress; | ||
} | ||
|
||
struct Claim { | ||
uint32 total; | ||
uint32 totalMax; | ||
uint32 walletMax; | ||
uint48 startDate; | ||
uint48 endDate; | ||
StorageProtocol storageProtocol; | ||
uint8 contractVersion; | ||
bool identical; | ||
bytes32 merkleRoot; | ||
string location; | ||
uint256 cost; | ||
address payable paymentReceiver; | ||
address erc20; | ||
address signingAddress; | ||
} | ||
|
||
/** | ||
* @notice initialize a new claim, emit initialize event | ||
* @param creatorContractAddress the creator contract the claim will mint tokens for | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param claimParameters the parameters which will affect the minting behavior of the claim | ||
*/ | ||
function initializeClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external; | ||
|
||
/** | ||
* @notice update an existing claim at instanceId | ||
* @param creatorContractAddress the creator contract corresponding to the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param claimParameters the parameters which will affect the minting behavior of the claim | ||
*/ | ||
function updateClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external; | ||
|
||
/** | ||
* @notice update tokenURI parameters for an existing claim at instanceId | ||
* @param creatorContractAddress the creator contract corresponding to the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param storageProtocol the new storage protocol | ||
* @param identical the new value of identical | ||
* @param location the new location | ||
*/ | ||
function updateTokenURIParams(address creatorContractAddress, uint256 instanceId, StorageProtocol storageProtocol, bool identical, string calldata location) external; | ||
|
||
/** | ||
* @notice extend tokenURI parameters for an existing claim at instanceId. Must have NONE StorageProtocol | ||
* @param creatorContractAddress the creator contract corresponding to the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param locationChunk the additional location chunk | ||
*/ | ||
function extendTokenURI(address creatorContractAddress, uint256 instanceId, string calldata locationChunk) external; | ||
|
||
/** | ||
* @notice get a claim corresponding to a creator contract and instanceId | ||
* @param creatorContractAddress the address of the creator contract | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @return the claim object | ||
*/ | ||
function getClaim(address creatorContractAddress, uint256 instanceId) external view returns(Claim memory); | ||
|
||
/** | ||
* @notice get a claim corresponding to a token | ||
* @param creatorContractAddress the address of the creator contract | ||
* @param tokenId the tokenId of the claim | ||
* @return the claim instanceId and claim object | ||
*/ | ||
function getClaimForToken(address creatorContractAddress, uint256 tokenId) external view returns(uint256, Claim memory); | ||
|
||
/** | ||
* @notice allow admin to airdrop arbitrary tokens | ||
* @param creatorContractAddress the creator contract the claim will mint tokens for | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param recipients addresses to airdrop to | ||
* @param amounts number of tokens to airdrop to each address in addresses | ||
*/ | ||
function airdrop(address creatorContractAddress, uint256 instanceId, address[] calldata recipients, uint16[] calldata amounts) external; | ||
} |
130 changes: 130 additions & 0 deletions
130
packages/manifold/contracts/lazyUpdatableFeeClaim/ILazyPayableClaimV2.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,130 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/// @author: manifold.xyz | ||
|
||
/** | ||
* Lazy Payable Claim interface | ||
*/ | ||
interface ILazyPayableClaimV2 { | ||
error InvalidStorageProtocol(); | ||
error ClaimNotInitialized(); | ||
error InvalidStartDate(); | ||
error InvalidAirdrop(); | ||
error TokenDNE(); | ||
error InvalidInstance(); | ||
error InvalidInput(); | ||
error ClaimInactive(); | ||
error TooManyRequested(); | ||
error MustUseSignatureMinting(); | ||
error FailedToTransfer(); | ||
error InvalidSignature(); | ||
error ExpiredSignature(); | ||
error CannotChangePaymentToken(); | ||
error Inactive(); | ||
|
||
enum StorageProtocol { INVALID, NONE, ARWEAVE, IPFS, ADDRESS } | ||
|
||
event ClaimInitialized(address indexed creatorContract, uint256 indexed instanceId, address initializer); | ||
event ClaimUpdated(address indexed creatorContract, uint256 indexed instanceId); | ||
event ClaimMint(address indexed creatorContract, uint256 indexed instanceId); | ||
event ClaimMintBatch(address indexed creatorContract, uint256 indexed instanceId, uint16 mintCount); | ||
event ClaimMintProxy(address indexed creatorContract, uint256 indexed instanceId, uint16 mintCount, address proxy, address mintFor); | ||
event ClaimMintSignature(address indexed creatorContract, uint256 indexed instanceId, uint16 mintCount, address proxy, address mintFor, bytes32 nonce); | ||
|
||
/** | ||
* @notice Withdraw funds | ||
*/ | ||
function withdraw(address payable receiver, uint256 amount) external; | ||
|
||
/** | ||
* @notice Set the Manifold Membership address | ||
*/ | ||
function setMembershipAddress(address membershipAddress) external; | ||
|
||
/** | ||
* @notice Set the mint fees for claims | ||
*/ | ||
function setMintFees(uint256 mintFee, uint256 mintFeeMerkle) external; | ||
|
||
/** | ||
* @notice Set the active state of the claim, whether to allow new claims to be initialized | ||
*/ | ||
function setActive(bool active) external; | ||
|
||
/** | ||
* @notice check if a mint index has been consumed or not (only for merkle claims) | ||
* | ||
* @param creatorContractAddress the address of the creator contract for the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param mintIndex the mint claim instance | ||
* @return whether or not the mint index was consumed | ||
*/ | ||
function checkMintIndex(address creatorContractAddress, uint256 instanceId, uint32 mintIndex) external view returns(bool); | ||
|
||
/** | ||
* @notice check if multiple mint indices has been consumed or not (only for merkle claims) | ||
* | ||
* @param creatorContractAddress the address of the creator contract for the claim | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param mintIndices the mint claim instance | ||
* @return whether or not the mint index was consumed | ||
*/ | ||
function checkMintIndices(address creatorContractAddress, uint256 instanceId, uint32[] calldata mintIndices) external view returns(bool[] memory); | ||
|
||
/** | ||
* @notice get mints made for a wallet (only for non-merkle claims with walletMax) | ||
* | ||
* @param minter the address of the minting address | ||
* @param creatorContractAddress the address of the creator contract for the claim | ||
* @param instanceId the claim instance for the creator contract | ||
* @return how many mints the minter has made | ||
*/ | ||
function getTotalMints(address minter, address creatorContractAddress, uint256 instanceId) external view returns(uint32); | ||
|
||
/** | ||
* @notice allow a wallet to lazily claim a token according to parameters | ||
* @param creatorContractAddress the creator contract address | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param mintIndex the mint index (only needed for merkle claims) | ||
* @param merkleProof if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims) | ||
* @param mintFor mintFor must be the msg.sender or a delegate wallet address (in the case of merkle based mints) | ||
*/ | ||
function mint(address creatorContractAddress, uint256 instanceId, uint32 mintIndex, bytes32[] calldata merkleProof, address mintFor) external payable; | ||
|
||
/** | ||
* @notice allow a wallet to lazily claim a token according to parameters | ||
* @param creatorContractAddress the creator contract address | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param mintCount the number of claims to mint | ||
* @param mintIndices the mint index (only needed for merkle claims) | ||
* @param merkleProofs if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims) | ||
* @param mintFor mintFor must be the msg.sender or a delegate wallet address (in the case of merkle based mints) | ||
*/ | ||
function mintBatch(address creatorContractAddress, uint256 instanceId, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable; | ||
|
||
/** | ||
* @notice allow a proxy to mint a token for another address | ||
* @param creatorContractAddress the creator contract address | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param mintCount the number of claims to mint | ||
* @param mintIndices the mint index (only needed for merkle claims) | ||
* @param merkleProofs if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims) | ||
* @param mintFor the address to mint for | ||
*/ | ||
function mintProxy(address creatorContractAddress, uint256 instanceId, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable; | ||
|
||
/** | ||
* @notice allowlist minting based on signatures | ||
* @param creatorContractAddress the creator contract address | ||
* @param instanceId the claim instanceId for the creator contract | ||
* @param mintCount the number of claims to mint | ||
* @param signature if the claim has a signerAddress, verifying signatures were signed by it | ||
* @param message the message that was signed | ||
* @param nonce the nonce that was signed | ||
* @param mintFor the address to mint for | ||
*/ | ||
function mintSignature(address creatorContractAddress, uint256 instanceId, uint16 mintCount, bytes calldata signature, bytes32 message, bytes32 nonce, address mintFor, uint256 expiration) external payable; | ||
|
||
} |
Oops, something went wrong.