-
Notifications
You must be signed in to change notification settings - Fork 15
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
Claiming expenditure payout #925
Claiming expenditure payout #925
Conversation
88ce191
to
6f3afcf
Compare
7a24452
to
92d6eee
Compare
Marking as blocked by the bug in network - waiting for JoinColony/colonyNetwork#1154 to be merged and deployed |
92d6eee
to
b532bd0
Compare
8abb3d4
to
21dc18c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expected behaviour when the recipient is a colony? I am able to click claim on the expenditure (even though I'm not the recipient -- is that right?), but I don't see an incoming funds claim in the colony.
@willm30 The button is supposed to trigger the claim of all claimable payouts, even if you're not the recipient, so that sounds correct The issue with incoming funds not showing up is most likely due to the fact that we are not storing fund claims from expenditures in the DB yet - I'm about to speak to Raul about this but in the meantime you can verify that the funds have actually been transferred in truffle (after you claim the expenditure): // the recipient colony
c = await IColony.at()
ta = await c.getToken()
c.claimColonyFunds(ta) That should update the colony balance. Thanks for spotting this, it would've gone under the radar otherwise. Everything else should work now so ready for you to have another look 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I confirmed the tokens were appearing in the colony I was sending them to, but had to make a normal payment and claim it that way for the funds to be claimed and appear in the UI. Not sure why just doing it in ganache alone wasn't sufficient.
Everything else working as expected 👍 (although testing the claim delay had me scratching my head for a minute 😅 My fault for advancing block time by a few hours!)
((expenditure.finalizedAt ?? 0) + (slot.claimDelay ?? 0)) * 1000, | ||
).getTime(); | ||
|
||
if (Date.now() >= claimableFrom) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean about testing this being tricky. I suppose the solution is to only advance block time by a few seconds, so system time can catch up. I guess it's not a problem at all in production since block time can't be meddled with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can get the actual block time like we do in the fetchMotionTimeoutPeriods
lambda but it's an async call and I suppose an anti-pattern for us. And there shouldn't be a difference between block time and date.now() in production, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanna say it shouldn't make a difference (and the worst case is that the transaction will fail during a small time window) but we'll only know once it's deployed to a real chain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
Description
This PR adds claiming expenditure payout functionality.
After finalization, you should see a Claim funds button appear that lets you claim all the payouts for which the claim delay has elapsed (see below for more info on how claim delay works in dev).
Testing
Scenarios I recommend testing:
Note on claim delay in dev
Time works differently in dev blockchain. This makes testing a bit tricky, since the UI uses the real time, whereas the dev blockchain time is "frozen" until the next block is mined.
The consequence of this is that when you finalize an expenditure with non-zero claim delay, the UI should show the correct time at which you can claim the next payout, e.g.:

But you won't be able to claim it until another block is mined and the blockchain time updates. To force mining a block, run the following command in truffle:
You can also advance time by an arbitrary number of seconds:
Resolves #912