Skip to content

Contract ERC1155Drop.sol, setClaimConditions() is not override-able. Causing complexity in defining immutable conditions on demand #694

@Asharp19

Description

@Asharp19
/// @dev Lets a contract admin set claim conditions.
    function setClaimConditions(
        uint256 _tokenId,
        ClaimCondition calldata _condition,
        bool _resetClaimEligibility
    ) external override {
        if (!_canSetClaimConditions()) {
            revert("Not authorized");
        }

        ClaimCondition memory condition = claimCondition[_tokenId];
        bytes32 targetConditionId = conditionId[_tokenId];

        uint256 supplyClaimedAlready = condition.supplyClaimed;

        if (targetConditionId == bytes32(0) || _resetClaimEligibility) {
            supplyClaimedAlready = 0;
            targetConditionId = keccak256(abi.encodePacked(_dropMsgSender(), block.number, _tokenId));
        }

        if (supplyClaimedAlready > _condition.maxClaimableSupply) {
            revert("max supply claimed");
        }

        ClaimCondition memory updatedCondition = ClaimCondition({
            startTimestamp: _condition.startTimestamp,
            maxClaimableSupply: _condition.maxClaimableSupply,
            supplyClaimed: supplyClaimedAlready,
            quantityLimitPerWallet: _condition.quantityLimitPerWallet,
            merkleRoot: _condition.merkleRoot,
            pricePerToken: _condition.pricePerToken,
            currency: _condition.currency,
            metadata: _condition.metadata
        });

        claimCondition[_tokenId] = updatedCondition;
        conditionId[_tokenId] = targetConditionId;

        emit ClaimConditionUpdated(_tokenId, _condition, _resetClaimEligibility);
    }

This above function should have override ability. Having virtual should be an option incase someone wants to add immutability to some of claim conditions on lazy mint.
Having this option doesn't effect security if people just use the factory contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions