aragon-apps
aragon-apps copied to clipboard
Agent, Finance: token balances module doesn't live update
I just did an ANT deposit into an org while Finance was open. As soon as the transaction was mined, the transfer appeared in the transfer ledger, but the balance on top didn't update until I forced a refresh
Before refreshing (as soon as the deposit was mined):
![Screen Shot 2020-01-07 at 11 31 36 AM](https://user-images.githubusercontent.com/447328/71888912-54966880-3141-11ea-8775-8d4336233f61.png)
After reloading the app:
![Screen Shot 2020-01-07 at 11 32 13 AM](https://user-images.githubusercontent.com/447328/71888931-6546de80-3141-11ea-97e8-945565ad564c.png)
Hmm, this is quite awkward and shouldn't be the case. Maybe there's something weird with how we're memoizing but the balances should definitely be updating.
Couldn't reproduce this one @sohkai @izqui , any particular way to test this?
@rperez89 Now I'm suspecting this may be due to race conditions with the underlying ETH node (e.g. we got the event first, but then when we did the balance update via an eth_call
, we didn't catch the update).
Here's what I would do to fix this:
- Send an API trigger from the frontend every 30s so the script can update all of its tokens' balances
This also has the nice side-effect of catching updates for any "hidden" transfers (e.g. directly sending tokens to the Agent / Vault).
Note that we should also apply this same trick to the Agent app.
ahh about that nice side effect that you are talking about, i did exactly that to test i sent eth directly to the vault.
This also happens if you deploy a token, mint, approve and deposit in the same transaction.
The tokens appear in the transfer ledger, but the withdraw is not possible.
This isn't fixed on a hard refresh.
@sohkai How should I send an API request to force a refresh? Currently testing on Rinkeby.