project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

GHO Tunes

Automate recurring payments on Aave using GHO Stablecoin credit delegation and Chainlink Cron based Automation Upkeeps.

GHO Tunes

Created At

LFGHO

Project Description

💳 GHO Tunes - Recurring Payments on Aave Protocol

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.

Core Technology:

  1. GHO Credit Delegation: Users allocate a specific amount of their GHO tokens to the GHO Tunes contract, enabling automatic recurring payments without manual intervention.
  2. Chainlink Cron Upkeeps: This decentralized oracle service triggers scheduled payments based on predefined intervals, ensuring timely deductions for chosen subscription tiers.

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:

  1. Free: 0 GHO Tokens per month
  2. Silver: 5 GHO Tokens per month
  3. Gold: 10 GHO Tokens per month

How it's Made

How it works 🛠️

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:

Pay with ETH

  1. User specifies the subscription tier and send ether equivalent to the GHO Borrow Value. Along with that the user also sends wETH and GHO delegation signatures.
  2. The provided ETH is converted to wETH through a designated gateway and the amount is delegated to the Aave Pool.
  3. The gateway supplies the wETH to the Aave Protocol on the user's behalf, creating a borrow position equivalent to the chosen subscription tier (0, 5, or 10 GHO tokens).
  4. Then the subscription amount (0,5,10 GHO Tokens) are credit delegated to the Tunes smart contract to initiate the subscription.
  5. The smart contract borrows the first month's GHO tokens from Aave based on the chosen tier and user's delegated permissions.
  6. A unique dynamic Subscription NFT is minted with, containing details about the tier, start date, and duration.
  7. An Custom ERC-6551 Token Bound Account (TBA) is created, linked to the NFT and responsible for handling subsequent monthly payments.
  8. A new CRON-based upkeep is created via Chainlink automation, triggering the TBA to pay the subscription amount every month.

Pay with GHO Tokens

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.

Pay with Credit Delegation (user has already delegated GHO Tokens)

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.


How Subscriptions Work? 📅

The subscription is based on a custom ERC-721 NFT. The NFT contains the following information:

  • Subscription Tier
  • Subscription Price
  • Valid Until (Timestamp)

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.


Deployed Contract Addresses (Sepolia Testnet) 📝

FAQs ❓

Q. What happens if the upkeep fails?

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.

Q. Is Upkeep created if user creates a free account?

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.

Q. What happens to cron scheduling if the Upkeep Fails?

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.

Q. What happens to Dynamic NFTs?

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.

Q. Can user change subscriptions?

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.


background image mobile

Join the mailing list

Get the latest news and updates