Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a claimable balance feature #16

Open
ElliotFriend opened this issue Sep 25, 2024 · 11 comments
Open

Add a claimable balance feature #16

ElliotFriend opened this issue Sep 25, 2024 · 11 comments
Assignees
Labels
ODHack8 Issues eligible for the OnlyDust hackaton

Comments

@ElliotFriend
Copy link
Contributor

When sending a payment to a user's contact, if the contact doesn't have a trustline for that asset the transaction will fail. That's because we're only using the payment operation. We should detect this case, and offer to create a claimable balance for the user.

@ElliotFriend ElliotFriend added the ODHack8 Issues eligible for the OnlyDust hackaton label Sep 25, 2024
@CollinsC1O
Copy link

@ElliotFriend can I work on this

Copy link

onlydustapp bot commented Sep 25, 2024

Hi @CollinsC1O!
Maintainers during the ODHack # 8.0 will be tracking applications via OnlyDust.
Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

@PabloVillaplana
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Full Stack developer with 6 years of experience in the industry, I am super excited to be able to contribute to Web 3 projects, this to continue paving my way as an Open Source Contributor. I am from Dojo Coding Community

How I plan on tackling this issue

Detect Missing Trustline Before Payment:
Before sending a payment, check if the recipient has an established trustline for the asset. If the trustline is missing, proceed to the next step.

Offer to Create Claimable Balance:
If the recipient does not have a trustline, prompt the user with an option to create a claimable balance. This would allow the recipient to claim the payment once they establish the necessary trustline.

Fallback to Claimable Balance Creation:
Upon user confirmation, automatically create a claimable balance instead of proceeding with the regular payment operation. This ensures that the transaction won't fail, and the recipient can claim the asset later.

Provide Clear User Feedback:
Communicate clearly with the user, explaining why the payment could not be completed directly and offering the claimable balance as an alternative solution.

@Jayse007
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I would like to take this task, and it will be delivered within (26, September, 2024-30, September, 2024). I am a programmer who has intensive knowledge in Python and Javascript. I have worked on a lot of problems which has given me insights in detecting problems and coming up with optimized solutions.

How I plan on tackling this issue

I would use an if statement to check if the user's contact doesn't have a trustline and if this is the case; the if block would handle it by creating a claimable for the user.

@josephchimebuka
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello @ElliotFriend I am Joseph I am a Software developer and blockchain developer and I am also an active contributor here on only dust here is my profile https://app.onlydust.com/u/josephchimebuka. This is my first time to contribute to this repo ill appreciate the opportunity to contribute.

How I plan on tackling this issue

I will ensure the issue is solved by adding a claimable balance feature I will complete this in 2-3 days

@ShantelPeters
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a blockchain developer and technical writer with vast experiences with languages like css, react, typescript and javascript.

How I plan on tackling this issue

I will implement a check before processing the payment to verify if the contact has a trustline for the asset; if not, prompt the user with an option to create a claimable balance for the contact, ensuring a smoother transaction experience and preventing payment failures.

@estherbreath
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a smart blockchain developer.

I can leverage on my background to solve this issue by implementing an automated trustline check and Claimable Balance creation system.

Design a smart contract that verifies the recipient's trustline status before initiating a payment, and if absent, automatically generate a Claimable Balance.

This approach combines your knowledge of state management and conditional execution from smart contract development with the Stellar network's Claimable Balance feature, providing a seamless and efficient solution to the trustline problem

How I plan on tackling this issue

I will take the following steps;

1. Implement a smart contract that checks if the recipient has a trustline for the asset being sent. 
2. If the trustline exists, proceed with the normal payment operation. 
3. If the trustline doesn't exist, automatically create a Claimable Balance instead. 
4. implement periodic cleanup of unclaimed balances to manage network efficiency. 

@od-hunter
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Please can I be assigned this issue? I'll love to contribute to this project please. I am a blockchain Developer, and my experience includes html, css, react, JavaScript,TypeScript and solidity, python and Cairo.

How I plan on tackling this issue

To solve this issue, I'd take the following steps:

  1. I'll detect trustline error when the payment fails.
  2. I'll prompt the sender to create a claimable balance if the recipient lacks a trustline.
  3. I'll create the claimable balance using Stellar SDK, allowing the recipient to claim the asset once they add a trustline.
  4. I'll notify the recipient to add a trustline to claim the balance.

Please assign me.

@Joewizy
Copy link

Joewizy commented Sep 27, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi my name is Joseph Gimba a computer engineer graduate that has passion for web3 and blockchain development, I have experience in writing smart contracts as well as using Javascript to a create Frontend for my projects built.

How I plan on tackling this issue

Using try & catch if the user does not have a Trustline then the catch block prompts the user to create a claimable balance to be able to receive payment. another approach would be asking the user if he wants us to automatically create a trustline for him automatically to receive the funds.

@PabloVillaplana
Copy link

@ElliotFriend Hi, can you give me more details about this issue? Steps to reproduce the use case?

@ElliotFriend
Copy link
Contributor Author

Hi, there @PabloVillaplana! Thanks for taking the issue on! Hope all this info helps, and if not feel free to reach out and ask more questions!

The current state of BasicPay allows sending a regular payment operation of any asset that your account holds. That will work as long as the receiving account has a trustline for that particular asset. But, in the case where the recipient account does not have a trustline, the regular payment operation will fail.

So, we should do something like the following:

  1. We're already checking if the account exists when we select it for a payment in /src/routes/dashboard/send/+page.svelte, so we should hook into that logic to get the recipient account's balances array.
  2. When selecting the asset to send, see if the recipient holds the asset we're trying to send
  3. If not, give the user an opportunity to select "create a Claimable Balance instead"
  4. If they choose this option, we should add both the recipient account and the user's account as claimants on the CB (in case the user needs to claim it at some point in the future).
  5. I'm fine using unconditional claim predicates for both of these, just for simplicity's sake.

Helpful Docs and Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ODHack8 Issues eligible for the OnlyDust hackaton
Projects
None yet
Development

No branches or pull requests

9 participants