Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

able to set mintFees for lazyClaim #101

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d505916
able to set mintFees for lazyClaim
donpdang Jan 2, 2025
cd653de
lint-fix
donpdang Jan 2, 2025
f3d8312
lint-fix
donpdang Jan 2, 2025
f5aaf8f
lint-fix
donpdang Jan 2, 2025
970a1aa
lint-fix
donpdang Jan 2, 2025
3359a67
lint-fix
donpdang Jan 2, 2025
cc71578
lint-fix
donpdang Jan 2, 2025
1acd89c
lint-fix
donpdang Jan 2, 2025
9f2335f
lint-fix
donpdang Jan 2, 2025
739a049
lint-fix
donpdang Jan 2, 2025
954d88a
lint-fix
donpdang Jan 2, 2025
86648a4
add comments about mint fees
donpdang Jan 3, 2025
df25102
remove mintfee settings in constructor
donpdang Jan 6, 2025
9681b88
use one setMintFees function to set mintFee and mintMerkleFee
donpdang Jan 7, 2025
337b86c
lint-fix
donpdang Jan 7, 2025
9b39b8f
add kill switch for claim initialization and tests
donpdang Jan 7, 2025
b07d098
use Pausable library from openzepplin
donpdang Jan 7, 2025
3a7752e
fix wordings
donpdang Jan 7, 2025
3bab629
add more tests for pausing logic
donpdang Jan 7, 2025
a41f360
fix up tests to separate between owner of claim contract vs creator c…
donpdang Jan 7, 2025
06d94ba
add comments
donpdang Jan 7, 2025
2246c28
dont use openzepplin lib
donpdang Jan 7, 2025
a2fff71
rename to active
donpdang Jan 7, 2025
8630501
separate out updatable mint fee lazyClam vs normal lazyClaim
donpdang Jan 9, 2025
14e9ccd
remove redundant artifacts
donpdang Jan 9, 2025
5ce66b0
lint-fix
donpdang Jan 9, 2025
cecebac
lint-fix
donpdang Jan 9, 2025
beadbf5
lint-fix
donpdang Jan 9, 2025
53a5996
lint-fix
donpdang Jan 9, 2025
061511e
lint-fix
donpdang Jan 9, 2025
8d7d736
lint-fix
donpdang Jan 9, 2025
5fcf8c1
lint-fix
donpdang Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

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);
}
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;
}
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);
}
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;
}
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;

}
Loading
Loading