From 48720ed1e5d8f504095bb3875a14de6388b0b18f Mon Sep 17 00:00:00 2001 From: "nicoacosta.eth" Date: Tue, 15 Oct 2024 01:37:41 -0300 Subject: [PATCH] stamps: view interface --- src/stamps/interfaces/IStamp.sol | 3 +- src/stamps/interfaces/IStampView.sol | 60 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/stamps/interfaces/IStampView.sol diff --git a/src/stamps/interfaces/IStamp.sol b/src/stamps/interfaces/IStamp.sol index 936bfef..211ccd9 100644 --- a/src/stamps/interfaces/IStamp.sol +++ b/src/stamps/interfaces/IStamp.sol @@ -2,11 +2,12 @@ pragma solidity ^0.8.20; import { IERC721Enumerable } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; +import { IStampView } from "./IStampView.sol"; /// @title IStamp Interface /// @notice This interface defines the contract for a non-transferable ERC721 token called "Stamp" /// @dev Inherits from IERC721Enumerable, adding custom functionality for minting and ownership -interface IStamp is IERC721Enumerable { +interface IStamp is IERC721Enumerable, IStampView { /// @notice Thrown when a user attempts to mint a stamp they already own /// @param user The address of the user /// @param stampId The ID of the existing stamp diff --git a/src/stamps/interfaces/IStampView.sol b/src/stamps/interfaces/IStampView.sol new file mode 100644 index 0000000..d655dcd --- /dev/null +++ b/src/stamps/interfaces/IStampView.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +interface IStampView { + enum StampType { + Null, + AccountOwnership, + FollowerSince + } + + struct StampData { + address contractAddress; + StampType stampType; + string name; + string symbol; + string platform; + uint256 totalSupply; + } + + struct StampUser { + bool owns; + uint256 stampId; + uint256 mintingTimestamp; + } + + struct Stamp { + StampData data; + StampUser user; + } + + struct FollowerSinceStampData { + StampData stampData; + address followedAccount; + string space; + } + + struct FollowerSinceStampUser { + StampUser stampUser; + uint256 followTimestamp; + uint256 timeSinceFollow; + } + + struct FollowerSinceStamp { + FollowerSinceStampData data; + FollowerSinceStampUser user; + } + + struct AccountOwnershipStamp { + Stamp stamp; + string userUsername; + } + + struct StampView { + Stamp[] stamps; + FollowerSinceStamp[] followerSinceStamps; + AccountOwnershipStamp[] accountOwnershipStamps; + } + + function getStampView(address user) external view returns (StampView memory); +}