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 · 40 comments
Open

Add a claimable balance feature #16

ElliotFriend opened this issue Sep 25, 2024 · 40 comments
Labels
ODHack9 Issues eligible for the OnlyDust hackathon

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 hackathon 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
Contributor

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
Contributor

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

@ElliotFriend
Copy link
Contributor Author

Hi, @PabloVillaplana! Thanks for the interest in this issue. Since I haven't seen a PR yet for this issue, I'm going to un-assign it and make it available for ODHack9. You should definitely feel free to apply again, though!

Thanks again!

@ElliotFriend ElliotFriend added ODHack9 Issues eligible for the OnlyDust hackathon and removed ODHack8 Issues eligible for the OnlyDust hackathon labels Oct 24, 2024
@caxtonacollins
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am applying to this issue via https://app.onlydust.com/hackathons/odhack-90.

I am Collins Cxaton, a fullstark developer with a strong background in integrating APIs and designing responsive UI components based on Figma designs. I have experience in working with cryptocurrency wallets and displaying real-time wallet balances by integrating financial APIs. My skills in React and JavaScript allow me to effectively manage currency conversions and data handling.

How I plan on tackling this issue

First, when a user attempts a payment, check if the recipient has a trustline for the asset. This can be done by querying the user’s account and assets.

Integrate a conditional check before initiating the payment operation.
If the recipient lacks a trustline, prevent the payment and display an appropriate message to the sender; if If the recipient lacks a trustline, offer the sender the option to create a claimable balance for the recipient. And Implement a function that allows the sender to create a claimable balance, using an appropriate API or smart contract method.

lLasty, notify the sender when a claimable balance is created; also i will create a test case and update the documentation

@suhas-sensei
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

would love to work on this

@aniruddhaaps
Copy link

I’d like to resolve this.

@Eka1210
Copy link

Eka1210 commented Oct 24, 2024

My background and how it can be leveraged:

I'm a Computer Science student with experience in JavaScript, and I’m eager to apply my skills to web3 projects. While this is my first time working with decentralized systems, I have a solid foundation in software development and problem-solving. My experience with JavaScript will be especially useful when working with payment flows and handling the detection logic required for this issue.

How I plan on tackling this issue:

1.I will review how payments are currently processed and identify where the transaction fails when the contact lacks a trustline for the asset.
2. Using JavaScript, I’ll add logic to detect if the contact doesn’t have a trustline for the asset before attempting the payment operation.
3. If the trustline is missing, I will provide an option to create a claimable balance for the user instead of letting the transaction fail.
4. I will test the new functionality to ensure the flow works smoothly and no other parts of the payment system are affected.
5. Lastly, I will submit a pull request explaining the changes, ensuring the payment process is more resilient.

@blessingbytes
Copy link

Would love to tackle this!

@Benjtalkshow
Copy link

I am a Full Stack Developer specializing in Next.js, TypeScript, Node.js, Cairo and Rust . With over 31 contributions across projects in the OnlyDust ecosystem, I’ve developed strong proficiency in delivering high-quality solutions and resolving complex issues within tight deadlines. My experience spans frontend, backend, smart contracts, and the optimization and maintenance of scalable codebases.

To implement the claimable balance feature, I would approach it with the following steps:

  1. The first step in the process would be checking if the recipient has an active trustline for the asset being sent. This can be done by querying the blockchain to see if a trustline exists between the recipient's account and the asset in question. If the trustline exists, the payment proceeds as usual. If it doesn't, the system would trigger the creation of a claimable balance.

  2. If no trustline is detected, the system would present the sender with an option to create a claimable balance instead of immediately failing the transaction. This can be handled at the user interface level, where the user will be informed that the recipient lacks a trustline and offered the ability to send the payment as a claimable balance.

  3. If the user chooses to proceed, the system will generate a claimable balance operation. This involves creating a transaction that specifies the recipient as the claimant, with the condition that they must establish a trustline to claim the asset. In Stellar, the CreateClaimableBalance operation can be used to hold the asset in a special balance until the recipient meets the claim conditions.

  4. Once the claimable balance is created, the recipient should be notified that there is a pending balance waiting for them. This notification can be triggered through the platform's notification system or by a more direct message like email. The recipient will be instructed to set up a trustline for the specified asset to claim the balance.

  5. To implement this, the user interface will need to be adjusted to account for both the detection of the missing trustline and the offer to create a claimable balance. Also, the user should be able to view pending claimable balances and manage the process from the app, giving full visibility into the status of the transaction.

Finally, thorough testing will be essential to ensure that this feature works across different assets and account types. Special care should be taken to handle edge cases, such as when the recipient establishes a trustline but does not claim the balance promptly or when a recipient fails to set up the trustline altogether.

@deeseeker
Copy link

Is it okay if I tackle this?

@kelvinparmar
Copy link

Can I start working on this?

@shubha-me
Copy link

Can I take this from here?

@Emmanex01
Copy link

Can I contribute to this one?

@deeseeker
Copy link

Could I take a shot at this?

@OWK50GA
Copy link

OWK50GA commented Oct 26, 2024

Can I handle this task?

@bruhhgnik
Copy link

I’d like to work on this, im pretty sure it will be over in a day

@jedstroke
Copy link

Can I contribute to this one?

@martinvibes
Copy link

hey @fricoben Can I contribute to this one? Let me handle this issue!

@mimisavage
Copy link

Mind if I try this one?

@Aditya-040
Copy link

I'd like to take this issue.

@MrRoudyk
Copy link

May I try my hand at this?

About me:
Software Engineer with 10 years of experience. For the past 5 years, I’ve specialized in HR Tech solutions. I’m passionate about exploring new technologies and currently looking to deepen my expertise in blockchain, smart contracts, and decentralized applications. I have also contributed to open source development at OnlyDust (My OnlyDust Profile).

How I plan on tackling this issue:
Before sending a payment, I'll check if the recipient has a trustline for the asset. If not, I'll prompt the user to create a claimable balance instead of the regular payment. Upon the user's confirmation, I'll automatically create the claimable balance, ensuring the transaction doesn't fail. I'll also provide clear feedback to the user, explaining why the direct payment couldn't be completed and offering the claimable balance as an alternative

@Akshola00
Copy link

Can I start working on this?

@sonimwangi
Copy link

I'd like to take this issue.

@Kaminar-i
Copy link

Can I take this issue?

@Kaminar-i
Copy link

Please can I work on this, haven't gotten issues to contribute to yet

@0xdevcollins
Copy link

Can I be assigned to this?

@sigmadawg
Copy link

im a newbie contributor, i'd be grateful if you'd give me the opportunity to work in this.

@Michaelkingsdev
Copy link

Can I try solving this issue?

@KoxyG
Copy link

KoxyG commented Nov 1, 2024

I @ElliotFriend I am koxy, a stellar ecosystem contributor, can you pls assign this task to me?. I would work on this by implementing the change trust operation on stellar's SDK.

@saimeunt
Copy link
Contributor

saimeunt commented Nov 1, 2024

I'm a returning contributor and I'd like to try this one.
I will carefully study the structure of the project and provide a solution based on the description of the issue.

@SoarinSkySagar
Copy link
Contributor

Could I take on this issue? I've worked on this repository in the previous ODHack and I'm confident that I'll be able to resolve this issue.
ETA: 1 Day

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

No branches or pull requests