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

Finance: ask token directly for vault balance #1049

Merged
merged 1 commit into from
Nov 23, 2019

Conversation

sohkai
Copy link
Contributor

@sohkai sohkai commented Nov 23, 2019

Fixes an issue with vault.balance() returning reverts.

Web3.js does not yet handle revert strings (see web3/web3.js#1707), so when vault.balance() reverts with something like SAFE_ERC_20_BALANCE_REVERTED 1, it currently gets reported as a very large number.

This avoids asking the Vault for token balances and goes to the token directly. One could argue this is better, since the token should be the true source of information anyway.

1 Error string in bytes:

0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001c534146455f4552435f32305f42414c414e43455f524556455254454400000000

@auto-assign auto-assign bot requested a review from bpierre November 23, 2019 11:36
@sohkai sohkai merged commit bed2a02 into master Nov 23, 2019
@sohkai sohkai deleted the finance-fix-balance-revert branch November 23, 2019 12:00
Copy link
Contributor

@bpierre bpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

ramilexe pushed a commit to ConsiderItDone/aragon-apps that referenced this pull request Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants