Automate recurring payments on Aave using GHO Stablecoin credit delegation and Chainlink Cron based Automation Upkeeps.
Gho Tunes introduces a novel payment model within the Aave Protocol ecosystem, built upon the GHO stablecoin. This system leverages GHO Credit delegation and Chainlink cron-based automation to establish robust recurring payments directly on the blockchain.
This app is an example of such recurring payments model in form of a simple music streaming service. Users can subscribe to a monthly plan and pay in GHO tokens. The subscription is automatically renewed every month.
GHO Tunes uses Audius, a decentralized music platform that curates and hosts independent artists' work.
Currently there are three Subscription Tiers:
GHO Tunes offers three distinct methods for subscribing, providing flexibility and catering to users' existing liquidity positions. Here's a detailed breakdown of the underlying process:
This is similar to the ETH flow, except that the user does not send ETH or any signatures. The GHO tokens are already approved for the Tunes contract and the user only needs to send the tier.
This method is similar to the ETH flow, except that the user does not send ETH or any signatures. The GHO tokens are already delegated to the Tunes contract and the user only needs to send the tier. Once the user calls the subscribe function, the Tunes contract will borrow the first month's GHO tokens from Aave based on the chosen tier and user's delegated permissions.
The subscription is based on a custom ERC-721 NFT. The NFT contains the following information:
Whenever a user subscribes, a new NFT is minted and the user is assigned a Custom ERC-6551 Token Bound Account (TBA).
The Upkeep is created for the TBA and it is responsible for paying the subscription amount every month.
Whenever the upkeep runs, the TBA calls the Tunes contract and the amount of GHO Tokens are borrowed on behalf of the user. The borrowed tokens are then used to pay the subscription amount.
If the upkeep fails, the user is dropped to the free tier and the upkeep is paused. The user can then subscribe again.
If the upkeep fails, the current subscription will be cancelled and the user will be dropped to the free tier. The user can then subscribe again. This also pauses the upkeep contract so that it does not trigger again.
No, the upkeep is only created when the user subscribes to a paid tier. if the user migrates from free to paid a upkeep is crated only once.
If the upkeep fails the user will be dropped to the free tier and upkeep will be paused. Whenever the user subscribes again, the upkeep will be updated. eg - If a user's upkeep is meant to run on 20th of each month but it fails and then the user resubscribes on 25th, the upkeep will be updated to run on 25th of each month.
Whenever the upkeep runs, whether it is successful or not, the NFT is updated with the new subscription date. This is done so that the user can always check the next payment date.
Yes, the user can change subscriptions at any time. If the user is on a paid tier and wants to migrate to a higher tier, he/she can call the contract and the subscription will be updated from the next Cron run.
And when the upkeep runs, the subscription amount is updated based on the new tier and NFT is updated with the new subscription date and tier.