Created
August 17, 2022 20:57
-
-
Save KolevDarko/0f19844a0d25a76d448bc871357d2e7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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