0

I am writing a web app that shows current info about bounties and child bounties. From what i understand if there is a bounty with a value of 5 DOT, I can create N child bounties which values sum up to 5 DOT (assuming curators fee 0). Now let's say that I create a child bounty of value 0.5 DOT and this child bounty was already paid to some beneficiary.

How can check how much DOTs is left to spend for next child bounties? (4.5 DOT in my example)

Thank you! :)

1 Answer 1

2

When a child bounty is created, the amount is already deducted for it from the parent bounty's balance. At any time, the parent bounty's balance would show only the remaining amount for any new child bounties. You only need to query the balance of the parent bounty account.

This would be different from the value of the parent bounty, just to be clear. The value is the initial amount, and the balance of the bounty account is the remaining amount.

Here is where we deduct the balance from parent bounty - https://github.com/paritytech/substrate/blob/master/frame/child-bounties/src/lib.rs#L282

And this is how we get the AccountId for a BountyIndex - https://github.com/paritytech/substrate/blob/master/frame/bounties/src/lib.rs#L806

You'll probably need to do this BountyIndex to AccountId conversion at the client side. And then just query the balance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.