Skip to content

Instantly share code, notes, and snippets.

@KolevDarko
Created August 17, 2022 20:57
Show Gist options
  • Save KolevDarko/0f19844a0d25a76d448bc871357d2e7f to your computer and use it in GitHub Desktop.
Save KolevDarko/0f19844a0d25a76d448bc871357d2e7f to your computer and use it in GitHub Desktop.
event SubscriptionCreated(address indexed from, address indexed to, uint256 subscriptionId, Subscription subscription);
event SubscriptionCanceled(uint256 indexed subscriptionId);
event Payout(uint256 indexed subscriptionId, uint256 amount, address token);
function createSubscription(address receiver, uint256 amount, uint256 payoutPeriod, address token) external {
Subscription memory newSub = Subscription(
msg.sender,
receiver,
amount,
token,
payoutPeriod,
true,
0
);
subscriptions[subscriptionCounter] = newSub;
subscriptionCounter += 1;
emit SubscriptionCreated(newSub.payer, newSub.receiver, subscriptionCounter - 1, newSub);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment