Skip to content

Commit

Permalink
followerSince: save timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoAcosta committed Oct 11, 2024
1 parent 1cd70b4 commit c5abd36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/stamps/FollowerSinceStamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ contract FollowerSinceStamp is Stamp, IFollowerSinceStamp {
/// @inheritdoc IFollowerSinceStamp
string public override FOLLOWED;

/// @notice Mapping to store the "since" timestamp for each follower
mapping(address => uint256) public followerSince;

/// @notice Initializes the FollowerSinceStamp contract
/// @param _signer The address authorized to sign mint requests
/// @param _platform The platform where the following relationship exists
Expand Down Expand Up @@ -52,6 +55,9 @@ contract FollowerSinceStamp is Stamp, IFollowerSinceStamp {

uint256 tokenId = _mintStamp(msg.sender, encodedData, signature, deadline);

// Store the "since" timestamp for the follower
followerSince[msg.sender] = since;

emit FollowerSince(PLATFORM, FOLLOWED, follower, since, tokenId, msg.sender);

return tokenId;
Expand Down
9 changes: 6 additions & 3 deletions src/stamps/interfaces/IFollowerSinceStamp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@ interface IFollowerSinceStamp is IStamp {
/// @notice The identifier of the followed account on the platform
function FOLLOWED() external view returns (string memory);

/// @notice Mapping to store the "since" timestamp for each follower
function followerSince(address follower) external view returns (uint256);

/// @notice Mints a new follower since stamp
/// @dev This function should verify the signature and mint a new stamp
/// @param follower The identifier of the follower on the platform
/// @param since The timestamp since when the user has been following
/// @param deadline The timestamp after which the signature is no longer valid
/// @param signature The signature authorizing the minting, likely signed by a trusted authority
/// @return The ID of the newly minted stamp
/// @param signature The signature authorizing the minting, signed by a trusted authority
/// @return stampId The ID of the newly minted stamp
function mintStamp(
string calldata follower,
uint256 since,
uint256 deadline,
bytes calldata signature
) external returns (uint256);
) external returns (uint256 stampId);

/// @notice Emitted when a new follower since stamp is minted
/// @param platform The platform identifier
Expand Down

0 comments on commit c5abd36

Please sign in to comment.