-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
460 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {ERC1155ShipyardContractMetadata} from "./lib/ERC1155ShipyardContractMetadata.sol"; | ||
import {Ownable} from "solady/src/auth/Ownable.sol"; | ||
import {ERC7498NFTRedeemables} from "./lib/ERC7498NFTRedeemables.sol"; | ||
import {CampaignParams} from "./lib/RedeemablesStructs.sol"; | ||
|
||
contract ERC1155ShipyardRedeemable is ERC1155ShipyardContractMetadata, ERC7498NFTRedeemables { | ||
constructor(string memory name_, string memory symbol_) ERC1155ShipyardContractMetadata(name_, symbol_) {} | ||
|
||
function createCampaign(CampaignParams calldata params, string calldata uri_) | ||
public | ||
override | ||
onlyOwner | ||
returns (uint256 campaignId) | ||
{ | ||
campaignId = ERC7498NFTRedeemables.createCampaign(params, uri_); | ||
} | ||
|
||
function _useInternalBurn() internal pure virtual override returns (bool) { | ||
return true; | ||
} | ||
|
||
function _internalBurn(address from, uint256 id, uint256 amount) internal virtual override { | ||
_burn(from, id, amount); | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) | ||
public | ||
view | ||
virtual | ||
override(ERC1155ShipyardContractMetadata, ERC7498NFTRedeemables) | ||
returns (bool) | ||
{ | ||
return ERC1155ShipyardContractMetadata.supportsInterface(interfaceId) | ||
|| ERC7498NFTRedeemables.supportsInterface(interfaceId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {ERC721ConduitPreapproved_Solady} from "shipyard-core/src/tokens/erc721/ERC721ConduitPreapproved_Solady.sol"; | ||
import {ConsiderationItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; | ||
import {Ownable} from "solady/src/auth/Ownable.sol"; | ||
import {ERC7498NFTRedeemables} from "../lib/ERC7498NFTRedeemables.sol"; | ||
import {CampaignParams} from "../lib/RedeemablesStructs.sol"; | ||
import {IRedemptionMintable} from "../interfaces/IRedemptionMintable.sol"; | ||
import {ERC1155ShipyardRedeemable} from "../ERC1155ShipyardRedeemable.sol"; | ||
import {IRedemptionMintable} from "../interfaces/IRedemptionMintable.sol"; | ||
import {TraitRedemption} from "../lib/RedeemablesStructs.sol"; | ||
|
||
contract ERC1155ShipyardRedeemableMintable is ERC1155ShipyardRedeemable, IRedemptionMintable { | ||
/// @dev Revert if the sender of mintRedemption is not this contract. | ||
error InvalidSender(); | ||
|
||
/// @dev The next token id to mint. Each token will have a supply of 1. | ||
uint256 _nextTokenId = 1; | ||
|
||
function mintRedemption( | ||
uint256, /* campaignId */ | ||
address recipient, | ||
ConsiderationItem[] calldata, /* consideration */ | ||
TraitRedemption[] calldata /* traitRedemptions */ | ||
) external { | ||
if (msg.sender != address(this)) { | ||
revert InvalidSender(); | ||
} | ||
|
||
// Increment nextTokenId first so more of the same token id cannot be minted through reentrancy. | ||
++_nextTokenId; | ||
|
||
_mint(recipient, _nextTokenId - 1, 1, ""); | ||
} | ||
|
||
constructor(string memory name_, string memory symbol_) ERC1155ShipyardRedeemable(name_, symbol_) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.