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

Wrapper: hotfix isForwarder() check on apps #372

Merged
merged 2 commits into from
Sep 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion packages/aragon-wrapper/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,32 @@ export default class Aragon {
} catch (_) { }
}

// This is a hack to fix web3.js and ethers not being able to detect reverts on decoding
// `eth_call`s (apps that implement fallbacks may revert if they haven't defined
// `isForwarder()`)
// Ideally web3.js would throw an error if it receives a revert from an `eth_call`, but
// as of v1.2.1, it interprets reverts as `true` :(.
//
// We check if the app's ABI actually has `isForwarder()` declared, and if not, override
// the isForwarder setting to false.
let isForwarderOverride = {}
if (
app.isForwarder &&
appInfo &&
Array.isArray(appInfo.abi) &&
!appInfo.abi.some(({ type, name }) => type === 'function' && name === 'isForwarder')
) {
isForwarderOverride = {
isForwarder: false
}
}

return {
...appInfo,
// Override the fetched appInfo with the actual app proxy's values to avoid mismatches
...app
...app,
// isForwarder override (see above)
...isForwarderOverride
}
})
)
Expand Down