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 22 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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ contract ERC1155LazyPayableClaim is IERC165, IERC1155LazyPayableClaim, ICreatorE
uint256 instanceId,
ClaimParameters calldata claimParameters
) external override creatorAdminRequired(creatorContractAddress) {
if (_paused) revert ILazyPayableClaim.Inactive();
// Revert if claim at instanceId already exists
require(_claims[creatorContractAddress][instanceId].storageProtocol == StorageProtocol.INVALID, "Claim already initialized");

Expand Down Expand Up @@ -356,4 +357,4 @@ contract ERC1155LazyPayableClaim is IERC165, IERC1155LazyPayableClaim, ICreatorE
}
uri = string(abi.encodePacked(prefix, claim.location));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol
import "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol";

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

import "./LazyPayableClaim.sol";
import "./IERC721LazyPayableClaim.sol";
import "./IERC721LazyPayableClaimMetadata.sol";
Expand Down Expand Up @@ -51,6 +50,7 @@ contract ERC721LazyPayableClaim is IERC165, IERC721LazyPayableClaim, ICreatorExt
uint256 instanceId,
ClaimParameters calldata claimParameters
) external override creatorAdminRequired(creatorContractAddress) {
if (_paused) revert ILazyPayableClaim.Inactive();
// Max uint56 for instanceId
if (instanceId == 0 || instanceId > MAX_UINT_56) revert ILazyPayableClaim.InvalidInstance();
// revert ILazyPayableClaim.if claim at instanceId already exists
Expand Down Expand Up @@ -419,4 +419,4 @@ contract ERC721LazyPayableClaim is IERC165, IERC721LazyPayableClaim, ICreatorExt
uri = string(abi.encodePacked(uri, "/", uint256(mintOrder).toString()));
}
}
}
}
13 changes: 12 additions & 1 deletion packages/manifold/contracts/lazyclaim/ILazyPayableClaim.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ interface ILazyPayableClaim {
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);
Expand All @@ -42,6 +43,16 @@ interface ILazyPayableClaim {
*/
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)
*
Expand Down
20 changes: 18 additions & 2 deletions packages/manifold/contracts/lazyclaim/LazyPayableClaim.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ abstract contract LazyPayableClaim is ILazyPayableClaim, AdminControl {
using EnumerableSet for EnumerableSet.AddressSet;
using ECDSA for bytes32;

bool internal _paused;

string internal constant ARWEAVE_PREFIX = "https://arweave.net/";
string internal constant IPFS_PREFIX = "ipfs://";

Expand All @@ -31,8 +33,10 @@ abstract contract LazyPayableClaim is ILazyPayableClaim, AdminControl {
// solhint-disable-next-line
address public immutable DELEGATION_REGISTRY_V2;

uint256 public constant MINT_FEE = 500000000000000;
uint256 public constant MINT_FEE_MERKLE = 690000000000000;
// solhint-disable-next-line
uint256 public MINT_FEE;
// solhint-disable-next-line
uint256 public MINT_FEE_MERKLE;
// solhint-disable-next-line
address public MEMBERSHIP_ADDRESS;

Expand Down Expand Up @@ -85,6 +89,18 @@ abstract contract LazyPayableClaim is ILazyPayableClaim, AdminControl {
MEMBERSHIP_ADDRESS = membershipAddress;
}

/**
* See {ILazyPayableClaim-setMintFees}.
*/
function setMintFees(uint256 mintFee, uint256 mintFeeMerkle) external override adminRequired {
MINT_FEE = mintFee;
MINT_FEE_MERKLE = mintFeeMerkle;
}

function setActive(bool active) external override adminRequired {
_paused = !active;
}

function _transferFunds(address erc20, uint256 cost, address payable recipient, uint16 mintCount, bool merkle, bool allowMembership) internal {
uint256 payableCost;
if (erc20 != ADDRESS_ZERO) {
Expand Down
2 changes: 1 addition & 1 deletion packages/manifold/script/ERC721LazyPayableClaim.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ contract DeployERC721LazyPayableClaim is Script {
new ERC721LazyPayableClaim{salt: 0x4552433732314c617a7950617961626c65436c61696d4552433732314c617a79}(initialOwner, DELEGATION_REGISTRY, DELEGATION_REGISTRY_V2);
vm.stopBroadcast();
}
}
}
Loading
Loading