Skip to content

Commit cf4ec35

Browse files
authored
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
1 parent e2be17d commit cf4ec35

20 files changed

+5243
-4
lines changed

packages/manifold/contracts/lazyUpdatableFeeClaim/ERC1155LazyPayableClaimV2.sol

+360
Large diffs are not rendered by default.

packages/manifold/contracts/lazyUpdatableFeeClaim/ERC721LazyPayableClaimV2.sol

+422
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
/// @author: manifold.xyz
6+
7+
/**
8+
* ERC1155 Lazy Payable Claim External Metadata interface
9+
*/
10+
interface IERC1155LazyPayableClaimMetadataV2 {
11+
/**
12+
* @notice Get the token URI for a claim instance
13+
*/
14+
function tokenURI(address creatorContract, uint256 tokenId, uint256 instanceId) external view returns (string memory);
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
/// @author: manifold.xyz
6+
7+
import "./ILazyPayableClaimV2.sol";
8+
9+
/**
10+
* Lazy Claim interface
11+
*/
12+
interface IERC1155LazyPayableClaimV2 is ILazyPayableClaimV2 {
13+
14+
struct ClaimParameters {
15+
uint32 totalMax;
16+
uint32 walletMax;
17+
uint48 startDate;
18+
uint48 endDate;
19+
StorageProtocol storageProtocol;
20+
bytes32 merkleRoot;
21+
string location;
22+
uint256 cost;
23+
address payable paymentReceiver;
24+
address erc20;
25+
address signingAddress;
26+
}
27+
28+
struct Claim {
29+
uint32 total;
30+
uint32 totalMax;
31+
uint32 walletMax;
32+
uint48 startDate;
33+
uint48 endDate;
34+
StorageProtocol storageProtocol;
35+
bytes32 merkleRoot;
36+
string location;
37+
uint256 tokenId;
38+
uint256 cost;
39+
address payable paymentReceiver;
40+
address erc20;
41+
address signingAddress;
42+
}
43+
44+
/**
45+
* @notice initialize a new claim, emit initialize event
46+
* @param creatorContractAddress the creator contract the claim will mint tokens for
47+
* @param instanceId the claim instanceId for the creator contract
48+
* @param claimParameters the parameters which will affect the minting behavior of the claim
49+
*/
50+
function initializeClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external;
51+
52+
/**
53+
* @notice update an existing claim at instanceId
54+
* @param creatorContractAddress the creator contract corresponding to the claim
55+
* @param instanceId the claim instanceId for the creator contract
56+
* @param claimParameters the parameters which will affect the minting behavior of the claim
57+
*/
58+
function updateClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external;
59+
60+
/**
61+
* @notice update tokenURI parameters for an existing claim at instanceId
62+
* @param creatorContractAddress the creator contract corresponding to the claim
63+
* @param instanceId the claim instanceId for the creator contract
64+
* @param storageProtocol the new storage protocol
65+
* @param location the new location
66+
*/
67+
function updateTokenURIParams(address creatorContractAddress, uint256 instanceId, StorageProtocol storageProtocol, string calldata location) external;
68+
69+
/**
70+
* @notice extend tokenURI parameters for an existing claim at instanceId. Must have NONE StorageProtocol
71+
* @param creatorContractAddress the creator contract corresponding to the claim
72+
* @param instanceId the claim instanceId for the creator contract
73+
* @param locationChunk the additional location chunk
74+
*/
75+
function extendTokenURI(address creatorContractAddress, uint256 instanceId, string calldata locationChunk) external;
76+
77+
/**
78+
* @notice get a claim corresponding to a creator contract and instanceId
79+
* @param creatorContractAddress the address of the creator contract
80+
* @param instanceId the claim instanceId for the creator contract
81+
* @return the claim object
82+
*/
83+
function getClaim(address creatorContractAddress, uint256 instanceId) external view returns(Claim memory);
84+
85+
/**
86+
* @notice get a claim corresponding to a token
87+
* @param creatorContractAddress the address of the creator contract
88+
* @param tokenId the tokenId of the claim
89+
* @return the claim instanceId and claim object
90+
*/
91+
function getClaimForToken(address creatorContractAddress, uint256 tokenId) external view returns(uint256, Claim memory);
92+
93+
/**
94+
* @notice allow admin to airdrop arbitrary tokens
95+
* @param creatorContractAddress the creator contract the claim will mint tokens for
96+
* @param instanceId the claim instanceId for the creator contract
97+
* @param recipients addresses to airdrop to
98+
* @param amounts number of tokens to airdrop to each address in addresses
99+
*/
100+
function airdrop(address creatorContractAddress, uint256 instanceId, address[] calldata recipients, uint256[] calldata amounts) external;
101+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
/// @author: manifold.xyz
6+
7+
/**
8+
* ERC721 Lazy Claim External Metadata interface
9+
*/
10+
interface IERC721LazyPayableClaimMetadataV2 {
11+
/**
12+
* @notice Get the token URI for a claim instance
13+
*/
14+
function tokenURI(address creatorContract, uint256 tokenId, uint256 instanceId, uint24 mintOrder) external view returns (string memory);
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
/// @author: manifold.xyz
6+
7+
import "./ILazyPayableClaimV2.sol";
8+
9+
/**
10+
* Lazy Payable Claim interface
11+
*/
12+
interface IERC721LazyPayableClaimV2 is ILazyPayableClaimV2 {
13+
struct ClaimParameters {
14+
uint32 totalMax;
15+
uint32 walletMax;
16+
uint48 startDate;
17+
uint48 endDate;
18+
StorageProtocol storageProtocol;
19+
bool identical;
20+
bytes32 merkleRoot;
21+
string location;
22+
uint256 cost;
23+
address payable paymentReceiver;
24+
address erc20;
25+
address signingAddress;
26+
}
27+
28+
struct Claim {
29+
uint32 total;
30+
uint32 totalMax;
31+
uint32 walletMax;
32+
uint48 startDate;
33+
uint48 endDate;
34+
StorageProtocol storageProtocol;
35+
uint8 contractVersion;
36+
bool identical;
37+
bytes32 merkleRoot;
38+
string location;
39+
uint256 cost;
40+
address payable paymentReceiver;
41+
address erc20;
42+
address signingAddress;
43+
}
44+
45+
/**
46+
* @notice initialize a new claim, emit initialize event
47+
* @param creatorContractAddress the creator contract the claim will mint tokens for
48+
* @param instanceId the claim instanceId for the creator contract
49+
* @param claimParameters the parameters which will affect the minting behavior of the claim
50+
*/
51+
function initializeClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external;
52+
53+
/**
54+
* @notice update an existing claim at instanceId
55+
* @param creatorContractAddress the creator contract corresponding to the claim
56+
* @param instanceId the claim instanceId for the creator contract
57+
* @param claimParameters the parameters which will affect the minting behavior of the claim
58+
*/
59+
function updateClaim(address creatorContractAddress, uint256 instanceId, ClaimParameters calldata claimParameters) external;
60+
61+
/**
62+
* @notice update tokenURI parameters for an existing claim at instanceId
63+
* @param creatorContractAddress the creator contract corresponding to the claim
64+
* @param instanceId the claim instanceId for the creator contract
65+
* @param storageProtocol the new storage protocol
66+
* @param identical the new value of identical
67+
* @param location the new location
68+
*/
69+
function updateTokenURIParams(address creatorContractAddress, uint256 instanceId, StorageProtocol storageProtocol, bool identical, string calldata location) external;
70+
71+
/**
72+
* @notice extend tokenURI parameters for an existing claim at instanceId. Must have NONE StorageProtocol
73+
* @param creatorContractAddress the creator contract corresponding to the claim
74+
* @param instanceId the claim instanceId for the creator contract
75+
* @param locationChunk the additional location chunk
76+
*/
77+
function extendTokenURI(address creatorContractAddress, uint256 instanceId, string calldata locationChunk) external;
78+
79+
/**
80+
* @notice get a claim corresponding to a creator contract and instanceId
81+
* @param creatorContractAddress the address of the creator contract
82+
* @param instanceId the claim instanceId for the creator contract
83+
* @return the claim object
84+
*/
85+
function getClaim(address creatorContractAddress, uint256 instanceId) external view returns(Claim memory);
86+
87+
/**
88+
* @notice get a claim corresponding to a token
89+
* @param creatorContractAddress the address of the creator contract
90+
* @param tokenId the tokenId of the claim
91+
* @return the claim instanceId and claim object
92+
*/
93+
function getClaimForToken(address creatorContractAddress, uint256 tokenId) external view returns(uint256, Claim memory);
94+
95+
/**
96+
* @notice allow admin to airdrop arbitrary tokens
97+
* @param creatorContractAddress the creator contract the claim will mint tokens for
98+
* @param instanceId the claim instanceId for the creator contract
99+
* @param recipients addresses to airdrop to
100+
* @param amounts number of tokens to airdrop to each address in addresses
101+
*/
102+
function airdrop(address creatorContractAddress, uint256 instanceId, address[] calldata recipients, uint16[] calldata amounts) external;
103+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// SPDX-License-Identifier: MIT
2+
3+
pragma solidity ^0.8.0;
4+
5+
/// @author: manifold.xyz
6+
7+
/**
8+
* Lazy Payable Claim interface
9+
*/
10+
interface ILazyPayableClaimV2 {
11+
error InvalidStorageProtocol();
12+
error ClaimNotInitialized();
13+
error InvalidStartDate();
14+
error InvalidAirdrop();
15+
error TokenDNE();
16+
error InvalidInstance();
17+
error InvalidInput();
18+
error ClaimInactive();
19+
error TooManyRequested();
20+
error MustUseSignatureMinting();
21+
error FailedToTransfer();
22+
error InvalidSignature();
23+
error ExpiredSignature();
24+
error CannotChangePaymentToken();
25+
error Inactive();
26+
27+
enum StorageProtocol { INVALID, NONE, ARWEAVE, IPFS, ADDRESS }
28+
29+
event ClaimInitialized(address indexed creatorContract, uint256 indexed instanceId, address initializer);
30+
event ClaimUpdated(address indexed creatorContract, uint256 indexed instanceId);
31+
event ClaimMint(address indexed creatorContract, uint256 indexed instanceId);
32+
event ClaimMintBatch(address indexed creatorContract, uint256 indexed instanceId, uint16 mintCount);
33+
event ClaimMintProxy(address indexed creatorContract, uint256 indexed instanceId, uint16 mintCount, address proxy, address mintFor);
34+
event ClaimMintSignature(address indexed creatorContract, uint256 indexed instanceId, uint16 mintCount, address proxy, address mintFor, bytes32 nonce);
35+
36+
/**
37+
* @notice Withdraw funds
38+
*/
39+
function withdraw(address payable receiver, uint256 amount) external;
40+
41+
/**
42+
* @notice Set the Manifold Membership address
43+
*/
44+
function setMembershipAddress(address membershipAddress) external;
45+
46+
/**
47+
* @notice Set the mint fees for claims
48+
*/
49+
function setMintFees(uint256 mintFee, uint256 mintFeeMerkle) external;
50+
51+
/**
52+
* @notice Set the active state of the claim, whether to allow new claims to be initialized
53+
*/
54+
function setActive(bool active) external;
55+
56+
/**
57+
* @notice check if a mint index has been consumed or not (only for merkle claims)
58+
*
59+
* @param creatorContractAddress the address of the creator contract for the claim
60+
* @param instanceId the claim instanceId for the creator contract
61+
* @param mintIndex the mint claim instance
62+
* @return whether or not the mint index was consumed
63+
*/
64+
function checkMintIndex(address creatorContractAddress, uint256 instanceId, uint32 mintIndex) external view returns(bool);
65+
66+
/**
67+
* @notice check if multiple mint indices has been consumed or not (only for merkle claims)
68+
*
69+
* @param creatorContractAddress the address of the creator contract for the claim
70+
* @param instanceId the claim instanceId for the creator contract
71+
* @param mintIndices the mint claim instance
72+
* @return whether or not the mint index was consumed
73+
*/
74+
function checkMintIndices(address creatorContractAddress, uint256 instanceId, uint32[] calldata mintIndices) external view returns(bool[] memory);
75+
76+
/**
77+
* @notice get mints made for a wallet (only for non-merkle claims with walletMax)
78+
*
79+
* @param minter the address of the minting address
80+
* @param creatorContractAddress the address of the creator contract for the claim
81+
* @param instanceId the claim instance for the creator contract
82+
* @return how many mints the minter has made
83+
*/
84+
function getTotalMints(address minter, address creatorContractAddress, uint256 instanceId) external view returns(uint32);
85+
86+
/**
87+
* @notice allow a wallet to lazily claim a token according to parameters
88+
* @param creatorContractAddress the creator contract address
89+
* @param instanceId the claim instanceId for the creator contract
90+
* @param mintIndex the mint index (only needed for merkle claims)
91+
* @param merkleProof if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims)
92+
* @param mintFor mintFor must be the msg.sender or a delegate wallet address (in the case of merkle based mints)
93+
*/
94+
function mint(address creatorContractAddress, uint256 instanceId, uint32 mintIndex, bytes32[] calldata merkleProof, address mintFor) external payable;
95+
96+
/**
97+
* @notice allow a wallet to lazily claim a token according to parameters
98+
* @param creatorContractAddress the creator contract address
99+
* @param instanceId the claim instanceId for the creator contract
100+
* @param mintCount the number of claims to mint
101+
* @param mintIndices the mint index (only needed for merkle claims)
102+
* @param merkleProofs if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims)
103+
* @param mintFor mintFor must be the msg.sender or a delegate wallet address (in the case of merkle based mints)
104+
*/
105+
function mintBatch(address creatorContractAddress, uint256 instanceId, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable;
106+
107+
/**
108+
* @notice allow a proxy to mint a token for another address
109+
* @param creatorContractAddress the creator contract address
110+
* @param instanceId the claim instanceId for the creator contract
111+
* @param mintCount the number of claims to mint
112+
* @param mintIndices the mint index (only needed for merkle claims)
113+
* @param merkleProofs if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims)
114+
* @param mintFor the address to mint for
115+
*/
116+
function mintProxy(address creatorContractAddress, uint256 instanceId, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable;
117+
118+
/**
119+
* @notice allowlist minting based on signatures
120+
* @param creatorContractAddress the creator contract address
121+
* @param instanceId the claim instanceId for the creator contract
122+
* @param mintCount the number of claims to mint
123+
* @param signature if the claim has a signerAddress, verifying signatures were signed by it
124+
* @param message the message that was signed
125+
* @param nonce the nonce that was signed
126+
* @param mintFor the address to mint for
127+
*/
128+
function mintSignature(address creatorContractAddress, uint256 instanceId, uint16 mintCount, bytes calldata signature, bytes32 message, bytes32 nonce, address mintFor, uint256 expiration) external payable;
129+
130+
}

0 commit comments

Comments
 (0)