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.

src/Grails5SignatureGatedMintPassRedeemer.sol

// SPDX-License-Identifier: MIT
// Copyright 2023 PROOF Holdings Inc
pragma solidity ^0.8.15;

import {IDelegateRegistry} from "delegation-registry/IDelegateRegistry.sol";
import {IERC721} from "openzeppelin-contracts/token/ERC721/IERC721.sol";

import {IRedeemableToken} from "solidifylabs/redemption/interfaces/IRedeemableToken.sol";
import {
    Seller,
    SignatureGatedLib,
    AccessControlledSignatureGatedBase,
    AccessControlled
} from "solidifylabs/sellers/mechanics/SignatureGated.sol";
import {ExactPaymentCheck} from "solidifylabs/sellers/base/ExactPaymentCheck.sol";
import {MintPassForProjectIDRedeemer, ISellableByProjectID} from "solidifylabs/presets/MintPassRedeemer.sol";

import {Grails5} from "./Grails5.sol";
import {Grails5MintPass} from "./Grails5MintPass.sol";

contract DelegatedSignatureGatedMintPassRedeemer is
    MintPassForProjectIDRedeemer,
    AccessControlledSignatureGatedBase,
    ExactPaymentCheck
{
    /**
     * @notice Thrown if the tx sender is not allowed to spend the allowance.
     */
    error NotAllowedToSpendAllowance(address spender, SignatureGatedLib.Allowance allowance);

    /**
     * @notice The delegate.cash delegation registry.
     */
    IDelegateRegistry internal immutable _delegateRegistry;

    /**
     * @notice The contract address for which delegation is being checked.
     */
    address internal immutable _delegationForContract;

    constructor(
        address admin,
        address steerer,
        ISellableByProjectID sellable_,
        IRedeemableToken pass_,
        IDelegateRegistry registry,
        address delegationForContract
    ) AccessControlled(admin, steerer) MintPassForProjectIDRedeemer(sellable_, pass_) {
        _delegationForContract = delegationForContract;
        _delegateRegistry = registry;
    }

    function _checkAndModifyPurchase(address to, uint64 num, uint256 cost_, bytes memory data)
        internal
        view
        virtual
        override(Seller, ExactPaymentCheck)
        returns (address, uint64, uint256)
    {
        return ExactPaymentCheck._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`, the price on the
     * signed allowance is ignored).
     */
    function purchase(SignatureGatedLib.SignedAllowance calldata signedAllowance, Redemption[] calldata redemptions)
        external
        payable
    {
        bytes32 dig = digest(signedAllowance.allowance);
        uint256 num = redemptions.length;
        _checkSignedAllowance(dig, signedAllowance, num);
        _trackAllowanceUsage(dig, num);

        if (!_isAllowedToSpendAllowance(msg.sender, signedAllowance.allowance)) {
            revert NotAllowedToSpendAllowance(msg.sender, signedAllowance.allowance);
        }

        _purchase({to: msg.sender, externalCost: signedAllowance.allowance.price * num, redemptions: redemptions});
    }

    function _isAllowedToSpendAllowance(address spender, SignatureGatedLib.Allowance calldata allowance)
        internal
        view
        virtual
        returns (bool)
    {
        return spender == allowance.receiver
            || _delegateRegistry.checkDelegateForContract(
                spender, allowance.receiver, _delegationForContract, allowanceSpendRights()
            );
    }

    /**
     * @notice The delegate.cash subdelegation right to spend signed allowances on behalf of the actual receiver.
     */
    function allowanceSpendRights() public view virtual returns (bytes32) {
        return "spendAllowance";
    }
}

/**
 * @title Grails V: Signature gated Mint Pass Redeemer
 * @notice The mint pass redeemer for phase 1
 */
contract Grails5SignatureGatedMintPassRedeemer is DelegatedSignatureGatedMintPassRedeemer {
    constructor(
        address admin,
        address steerer,
        Grails5 grails,
        Grails5MintPass pass_,
        IDelegateRegistry registry,
        IERC721 proofCollective
    ) DelegatedSignatureGatedMintPassRedeemer(admin, steerer, grails, pass_, registry, address(proofCollective)) {}

    function allowanceSpendRights() public view virtual override returns (bytes32) {
        return "grails-claim";
    }
}
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.