Skip to content

Commit

Permalink
add setMinter to ERC721RedemptionMintable, campaign methods to ERC749…
Browse files Browse the repository at this point in the history
…8NFTRedeemables
  • Loading branch information
stephankmin committed Sep 20, 2023
1 parent 072ffb7 commit d560764
Show file tree
Hide file tree
Showing 3 changed files with 342 additions and 253 deletions.
51 changes: 51 additions & 0 deletions src/redeemables/ERC721RedemptionMintable.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {ERC721} from "solady/tokens/ERC721.sol";
import {IERC721RedemptionMintable} from "./interfaces/IERC721RedemptionMintable.sol";
import {SpentItem} from "seaport-types/lib/ConsiderationStructs.sol";

contract ERC721RedemptionMintable is ERC721, IERC721RedemptionMintable {
address internal _MINTER;

/// @dev Revert if the sender of mintRedemption is not the redeemable contract offerer.
error InvalidSender();

/// @dev Revert if the redemption spent is not the required token.
error InvalidRedemption();

constructor(address minter) {
_MINTER = minter;
}

function mintRedemption(address to, uint256 tokenId) external returns (uint256) {
if (msg.sender != _MINTER) revert InvalidSender();

// Mint the same token ID redeemed.
_mint(to, tokenId);

return tokenId;
}

function name() public pure override returns (string memory) {
return "ERC721RedemptionMintable";
}

function symbol() public pure override returns (string memory) {
return "721RM";
}

function tokenURI(uint256 tokenId) public pure override returns (string memory) {
return string(abi.encodePacked("https://example.com/", tokenId));
}

function setMinter(address newMinter) external {
if (msg.sender != _MINTER) revert InvalidSender();

_setMinter(newMinter);
}

function _setMinter(address newMinter) internal {
_MINTER = newMinter;
}
}
253 changes: 0 additions & 253 deletions src/redeemables/ERC7498DynamicTraits.sol

This file was deleted.

Loading

0 comments on commit d560764

Please sign in to comment.