Skip to content

feat: detect diamond proxy contract and display it in diamond proxy tab#365

Open
tx-nikola wants to merge 7 commits into
mainfrom
tx-nikola-txfusion-detect-diamond-proxy
Open

feat: detect diamond proxy contract and display it in diamond proxy tab#365
tx-nikola wants to merge 7 commits into
mainfrom
tx-nikola-txfusion-detect-diamond-proxy

Conversation

@tx-nikola
Copy link
Copy Markdown
Contributor

@tx-nikola tx-nikola commented Dec 20, 2024

What ❔

Creade additional tab called "Diamond Proxy" in the Contract view, and show all write functions of the DiamondProxy contract.

Why ❔

Add additional functionality to the contract

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.

This PR fixes #328

@tx-nikola tx-nikola added the frontend Task requires changes to the frontend implementation label Dec 20, 2024
@tx-nikola tx-nikola self-assigned this Dec 20, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 20, 2024

API E2E Test Results

207 tests   207 ✅  19s ⏱️
 14 suites    0 💤
  1 files      0 ❌

Results for commit be4e596.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 20, 2024

Unit Test Results

    4 files    264 suites   11m 59s ⏱️
2 148 tests 2 147 ✅ 1 💤 0 ❌
2 362 runs  2 361 ✅ 1 💤 0 ❌

Results for commit be4e596.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 23, 2024

Visit the preview URL for this PR:
https://staging-scan-v2--pr-365-428ghk9f.web.app

@tx-nikola tx-nikola requested a review from popzxc December 23, 2024 12:16
@tx-nikola tx-nikola requested review from Romsters and removed request for popzxc February 4, 2025 12:09
const isVerified = !!props.contract?.verificationInfo;
const isProxy = !!props.contract?.proxyInfo;
const isDiamondProxy = !!props.contract?.diamondProxyInfo;
if (isVerified || isProxy) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

isDiamondProxy has to be added to the if condition. Otherwise the line added below is unreachable.

@@ -270,23 +278,5 @@ const tabs = computed(() => {
<style lang="scss" scoped>
.functions-contract-container {
@apply mt-4;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why have the styles below been moved? Existing tabs are broken (most probably because of this change):
Current version on prod
image

This version locally
image


const { t } = useI18n();

const writeProxyFunctions = computed(() => {
Copy link
Copy Markdown
Collaborator

@vasyl-ivanchuk vasyl-ivanchuk Mar 25, 2025

Choose a reason for hiding this comment

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

Why does Diamond Proxy tab support only write functions?


const eip2535Diamond = await provider.getStorage(address, EIP2535_DIAMOND_IMPLEMENTATION_SLOT);

if (eip2535Diamond) {
Copy link
Copy Markdown
Collaborator

@vasyl-ivanchuk vasyl-ivanchuk Mar 25, 2025

Choose a reason for hiding this comment

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

This condition seems to always be true, as it returns 0x0000000000000000000000000000000000000000000000000000000000000000 even for a random slot. I think the check for the slot can be omitted, AFAIU the Diamond Proxy spec doesn't define a particular storage slot, so it can differ. Considering this, checking for facetAddresses is probably enough.

@vasyl-ivanchuk
Copy link
Copy Markdown
Collaborator

Nit: It would be very helpful if, in such a PR, you provide a contract address on the testnet that you tested this functionality on. Otherwise, it takes some time to deploy everything before checking the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Task requires changes to the frontend implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect Diamond Proxies

3 participants