Skip to content
Verified contractExactMIT

Grails5SignatureGatedMintPassRedeemer

Address0x6fa6e4fbf76b84e478eeeede7e8b6273b1702c19
Balance

0 ETH

 

Transactions

176

 

Compiler

solc 0.8.21

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.21+commit.d9974bed
Language
solidity
Optimization
Yes, 9,999 runs
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
18,778,567
Creation transaction
0x25bdc4a01a…6568cc5853

90 files

The source code is large: one file is shown at a time. Choose a file in the list.

/home/dave/solidifylabs/solidifylabs/contracts/presets/src/MintPassRedeemer.sol

// SPDX-License-Identifier: MIT
// Copyright 2023 Proof Holdings Inc.
pragma solidity >=0.8.0 <0.9.0;

import {RedeemableTokenRedeemer, IRedeemableToken} from "solidifylabs/redemption/RedeemableTokenRedeemer.sol";

import {Seller} from "solidifylabs/sellers/base/Seller.sol";
import {InternallyPriced} from "solidifylabs/sellers/base/InternallyPriced.sol";
import {ImmutableSellableCallbacker, SellableCallbacker} from "solidifylabs/sellers/base/SellableCallbacker.sol";
import {ExactInternallyPriced, ExactFixedPrice} from "solidifylabs/sellers/base/InternallyPriced.sol";
import {ByProjectId} from "solidifylabs/sellers/base/ByProjectId.sol";

import {
    PurchaseByProjectIDLib,
    ISellableByProjectID
} from "solidifylabs/sellers/sellable/SellableERC721ACommonByProjectID.sol";

/**
 * @notice Seller that redeems a mint pass.
 */
abstract contract MintPassRedeemerBase is RedeemableTokenRedeemer {
    /**
     * @notice The regular Grails Exhibition pass.
     */
    IRedeemableToken public immutable pass;

    constructor(IRedeemableToken pass_) {
        pass = pass_;
    }

    /**
     * @notice Redeems the given passes and redemptions pieces in the Grails Exhibition.
     */
    function _redeem(uint256[] memory passIds) internal {
        uint256 num = passIds.length;
        for (uint256 i = 0; i < num; ++i) {
            _redeem(pass, passIds[i]);
        }
    }
}

/**
 * @notice Seller that redeems a mint pass.
 */
abstract contract MintPassRedeemer is MintPassRedeemerBase, Seller, ImmutableSellableCallbacker {
    constructor(ISellableByProjectID sellable_, IRedeemableToken pass_)
        MintPassRedeemerBase(pass_)
        ImmutableSellableCallbacker(sellable_)
    {}

    function _purchase(address to, uint256 externalCost, uint256[] memory passIds, bytes memory purchasePayload)
        internal
        virtual
    {
        _redeem(passIds);
        _purchase(to, uint64(passIds.length), externalCost, purchasePayload);
    }
}

/**
 * @notice Seller that redeems a mint pass for a certain project on the sellable.
 */
abstract contract MintPassForProjectIDRedeemer is MintPassRedeemerBase, ByProjectId, ImmutableSellableCallbacker {
    constructor(ISellableByProjectID sellable_, IRedeemableToken pass_)
        MintPassRedeemerBase(pass_)
        ImmutableSellableCallbacker(sellable_)
    {}

    /**
     * @notice The struct encoding a redemption.
     * @param passId The ID of the pass to redeem.
     * @param projectId The ID of the project to redeem the pass for.
     */
    struct Redemption {
        uint256 passId;
        uint128 projectId;
    }

    /**
     * @notice Redeems the given passes for the specified projects on the sellable.
     */
    function _purchase(address to, uint256 externalCost, Redemption[] calldata redemptions) internal {
        uint256[] memory passIds = new uint256[](redemptions.length);
        uint128[] memory projectIds = new uint128[](redemptions.length);

        for (uint256 i = 0; i < redemptions.length; ++i) {
            passIds[i] = redemptions[i].passId;
            projectIds[i] = redemptions[i].projectId;
        }

        _redeem(passIds);
        _purchase(to, externalCost, projectIds);
    }
}

/**
 * @notice Seller that redeems a mint pass for a certain project on the Sellable, otherwise free of charge.
 */
contract FreeMintPassForProjectIDRedeemer is MintPassForProjectIDRedeemer {
    constructor(ISellableByProjectID sellable_, IRedeemableToken pass_)
        MintPassForProjectIDRedeemer(sellable_, pass_)
    {}

    function purchase(Redemption[] calldata redemptions) external {
        MintPassForProjectIDRedeemer._purchase(msg.sender, 0, redemptions);
    }
}

/**
 * @notice Seller that redeems a mint pass and an additional fee for a certain project on the sellable.
 */
contract FixedPricedMintPassForProjectIDRedeemerBase is ExactFixedPrice, MintPassForProjectIDRedeemer {
    constructor(ISellableByProjectID sellable_, IRedeemableToken pass_, uint256 price)
        MintPassForProjectIDRedeemer(sellable_, pass_)
        ExactFixedPrice(price)
    {}

    /**
     * @dev Inheritance resoultion ensuring that the seller requires the correct `cost`.
     */
    function _checkAndModifyPurchase(address to, uint64 num, uint256 cost_, bytes memory data)
        internal
        view
        virtual
        override(Seller, ExactInternallyPriced)
        returns (address, uint64, uint256)
    {
        return ExactInternallyPriced._checkAndModifyPurchase(to, num, cost_, data);
    }

    /**
     * @notice Redeems the given passes and an additional fee for the specified projects on the sellable.
     * @dev Reverts if the value sent is not equal to the `cost` (i.e. `price * redemptions.length`).
     */
    function _purchase(Redemption[] calldata redemptions) internal {
        MintPassForProjectIDRedeemer._purchase(msg.sender, type(uint256).max, redemptions);
    }
}

/**
 * @notice Seller that redeems a mint pass and an additional fee for a certain project on the sellable.
 */
contract FixedPricedMintPassForProjectIDRedeemer is FixedPricedMintPassForProjectIDRedeemerBase {
    constructor(ISellableByProjectID sellable_, IRedeemableToken pass_, uint256 price)
        FixedPricedMintPassForProjectIDRedeemerBase(sellable_, pass_, price)
    {}

    /**
     * @notice Redeems the given passes and an additional fee for the specified projects on the sellable.
     * @dev Reverts if the value sent is not equal to the `cost` (i.e. `price * redemptions.length`).
     */
    function purchase(Redemption[] calldata redemptions) external payable {
        _purchase(redemptions);
    }
}
Compiler settingsShow
{
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 9999,
    "enabled": true
  },
  "evmVersion": "paris",
  "remappings": [
    "solidifylabs/presets/=/home/dave/solidifylabs/solidifylabs/contracts/presets/src/",
    "solidifylabs/artblocks/=/home/dave/solidifylabs/solidifylabs/contracts/artblocks/src/",
    "artblocks-contracts/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/artblocks-contracts_7f0af677/packages/contracts/contracts/",
    "artblocks-contracts_root/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/artblocks-contracts_7f0af677/",
    "openzeppelin-contracts-4-7-0/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/openzeppelin-contracts_4-7-0_exact_remap/contracts/",
    "openzeppelin-contracts_root-4-7-0/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/openzeppelin-contracts_4-7-0_exact_remap/",
    "@openzeppelin-4-7-0/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/openzeppelin-contracts_4-7-0_exact_remap/",
    "@openzeppelin-4.7/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/openzeppelin-contracts_4-7-0_exact_remap/",
    "solidifylabs/ethier/=/home/dave/solidifylabs/solidifylabs/contracts/ethier/src/",
    "ERC721A/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ERC721A_4-2-3/contracts/",
    "ERC721A_root/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ERC721A_4-2-3/",
    "erc721a/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ERC721A_4-2-3/",
    "ethier/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ethier_0-55-0/contracts/",
    "ethier_root/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ethier_0-55-0/",
    "@divergencetech/ethier/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ethier_0-55-0/",
    "openzeppelin-contracts/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/openzeppelin-contracts_4-8-1/contracts/",
    "openzeppelin-contracts_root/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/openzeppelin-contracts_4-8-1/",
    "@openzeppelin/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/openzeppelin-contracts_4-8-1/",
    "operator-filter-registry/src/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/operator-filter-registry_1-4-1/src/",
    "operator-filter-registry_root/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/operator-filter-registry_1-4-1/",
    "solidifylabs/redemption/=/home/dave/solidifylabs/solidifylabs/contracts/redemption/src/",
    "solidifylabs/sellers/=/home/dave/solidifylabs/solidifylabs/contracts/sellers/src/",
    "delegation-registry/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/delegation-registry_40d367d7/src/",
    "delegation-registry_root/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/delegation-registry_40d367d7/",
    "solidifylabs/artblocks_test/=/home/dave/solidifylabs/solidifylabs/contracts/artblocks/test/",
    "solidifylabs/constants/=/home/dave/solidifylabs/solidifylabs/contracts/constants/src/",
    "ds-test/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ds-test_013e6c64/src/",
    "ds-test_root/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/ds-test_013e6c64/",
    "forge-std/=/home/dave/.cache/bazel/_bazel_dave/1a5ef124e5847560f6bb614f5401924c/external/forge-std_1-7-3/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.