|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +pragma solidity 0.8.26; |
| 3 | + |
| 4 | +import { IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; |
| 5 | + |
| 6 | +import { IERC5192 } from "./IERC5192.sol"; |
| 7 | + |
| 8 | +/// @title Story Badge Interface |
| 9 | +/// @dev A Story Badge is a soulbound NFT that has a unified token URI for all badges. |
| 10 | +interface IStoryBadge is IERC5192, IERC721Metadata { |
| 11 | + //////////////////////////////////////////////////////////////////////////// |
| 12 | + // Errors // |
| 13 | + //////////////////////////////////////////////////////////////////////////// |
| 14 | + |
| 15 | + /// @notice Zero address provided as a param to StoryBadge functions. |
| 16 | + error StoryBadge__ZeroAddressParam(); |
| 17 | + |
| 18 | + /// @notice Badges are soulbound, cannot be transferred. |
| 19 | + error StoryBadge__TransferLocked(); |
| 20 | + |
| 21 | + /// @notice Invalid whitelist signature. |
| 22 | + error StoryBadge__InvalidSignature(); |
| 23 | + |
| 24 | + /// @notice The provided whitelist signature is already used. |
| 25 | + error StoryBadge__SignatureAlreadyUsed(); |
| 26 | + |
| 27 | + //////////////////////////////////////////////////////////////////////////// |
| 28 | + // Structs // |
| 29 | + //////////////////////////////////////////////////////////////////////////// |
| 30 | + |
| 31 | + /// @notice Struct for initializing the StoryBadge contract. |
| 32 | + /// @param name The name of the collection. |
| 33 | + /// @param symbol The symbol of the collection. |
| 34 | + /// @param contractURI The contract URI of the collection (follows OpenSea contract-level metadata standard). |
| 35 | + /// @param tokenURI The token URI for all the badges (follows OpenSea metadata standard). |
| 36 | + /// @param signer The signer of the whitelist signatures. |
| 37 | + /// @param ipAssetRegistry Story Proof-of-Creativity IP Asset Registry address. |
| 38 | + /// @param licensingModule Story Proof-of-Creativity Licensing Module address. |
| 39 | + /// @param piLicenseTemplate Story Proot-of-Creativity Programmable IP License Template address. |
| 40 | + /// @param defaultLicenseTermsId Story Proot-of-Creativity default license terms ID. |
| 41 | + struct InitParams { |
| 42 | + string name; |
| 43 | + string symbol; |
| 44 | + string contractURI; |
| 45 | + string tokenURI; |
| 46 | + address signer; |
| 47 | + address ipAssetRegistry; |
| 48 | + address licensingModule; |
| 49 | + address piLicenseTemplate; |
| 50 | + uint256 defaultLicenseTermsId; |
| 51 | + } |
| 52 | + |
| 53 | + //////////////////////////////////////////////////////////////////////////// |
| 54 | + // Events // |
| 55 | + //////////////////////////////////////////////////////////////////////////// |
| 56 | + |
| 57 | + /// @notice Emitted when a badge is minted. |
| 58 | + /// @param recipient The address of the recipient of the badge. |
| 59 | + /// @param tokenId The token ID of the minted badge. |
| 60 | + /// @param ipId The ID of the badge IP. |
| 61 | + event StoryBadgeMinted(address recipient, uint256 tokenId, address ipId); |
| 62 | + |
| 63 | + /// @notice Emitted when the signer is updated. |
| 64 | + /// @param signer The new signer address. |
| 65 | + event StoryBadgeSingerUpdated(address signer); |
| 66 | + |
| 67 | + /// @notice Emitted when the token URI is updated. |
| 68 | + /// @param tokenURI The new token URI. |
| 69 | + event StoryBadgeTokenURIUpdated(string tokenURI); |
| 70 | + |
| 71 | + //////////////////////////////////////////////////////////////////////////// |
| 72 | + // Functions // |
| 73 | + //////////////////////////////////////////////////////////////////////////// |
| 74 | + |
| 75 | + /// @notice Mints a badge for the given recipient. |
| 76 | + /// @param to The address of the recipient of the badge. |
| 77 | + /// @param signature The signature from the whitelist signer. |
| 78 | + /// @return tokenId The token ID of the minted badge. |
| 79 | + /// @return ipId The ID of the badge IP. |
| 80 | + function mint(address to, bytes calldata signature) external returns (uint256 tokenId, address ipId); |
| 81 | + |
| 82 | + /// @notice Updates the whitelist signer. |
| 83 | + /// @param signer_ The new whitelist signer address. |
| 84 | + function setSigner(address signer_) external; |
| 85 | + |
| 86 | + /// @notice Updates the unified token URI for all badges. |
| 87 | + /// @param tokenURI_ The new token URI. |
| 88 | + function setTokenURI(string memory tokenURI_) external; |
| 89 | +} |
0 commit comments