Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/StoryFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,23 @@ contract StoryFactory {
emit PlotChained(storylineId, plotIndex, msg.sender, contentCID, contentHash);
}

// -----------------------------------------------------------------------
// donate
// -----------------------------------------------------------------------

/// @notice Donate $PLOT directly to a storyline's writer
/// @param storylineId The storyline whose writer receives the donation
/// @param amount Amount of $PLOT to donate (in wei)
function donate(uint256 storylineId, uint256 amount) external {
require(amount > 0, "Zero amount");
Storyline storage s = storylines[storylineId];
require(s.writer != address(0), "Storyline does not exist");

require(PLOT_TOKEN.transferFrom(msg.sender, s.writer, amount), "Transfer failed");

emit Donation(storylineId, msg.sender, amount);
}

// -----------------------------------------------------------------------
// Internal helpers
// -----------------------------------------------------------------------
Expand Down