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

feat: proxy contract support in ABI tab #978

Merged
merged 14 commits into from
Apr 19, 2024
Merged

Conversation

ericleponner
Copy link
Collaborator

Description:

Changes below add support for proxy contract to the ABI tab (in Contract Details page) and matching unit tests.

Explorer now reads contract state (as defined in IEP 1967) to determine if a contract is a proxy or not.
When contract is a proxy:

  • Contract Bytecode section displays two new fields:
    • Proxying to Logic Contract which displays logic contract id
    • Proxying with Admin Contract which displays admin contract id
  • ABI tab displays a new switch named Show logic contract ABI
  • when switch is on:
    • ABI of the logic contract is displayed in place of the proxy ABI
    • functions (from logic ABI) are called through the proxy contract
image

Related issue(s):

Fixes #964

Notes for reviewer:

Sample proxy contract on mainnet: 0.0.4544494

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

…ontract (proxy or logic).

Signed-off-by: Eric Le Ponner <[email protected]>
…menu and saves its state in local storage.

Signed-off-by: Eric Le Ponner <[email protected]>
@ericleponner ericleponner requested a review from svienot April 18, 2024 17:15
Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 82.96% 38365 / 46242
🔵 Statements 82.96% 38365 / 46242
🔵 Functions 62.75% 871 / 1388
🔵 Branches 84.15% 4011 / 4766
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/AppStorage.ts 75.61% 73.07% 50% 75.61% 51-52, 55-56, 70-71, 98-100, 103-105, 118-119, 133-134, 147-148, 161-162, 171-183, 186-188, 191-192, 219-220, 232-233, 246-247, 256-265, 268-282
src/components/SolidityCode.vue 100% 40% 100% 100%
src/components/contract/ABIController.ts 67.08% 100% 100% 67.08% 43-55, 59-71
src/components/contract/ContractByteCodeSection.vue 84.72% 61.53% 14.28% 84.72% 1, 32-33, 142-143, 166-167, 258-259, 271-273, 280-281, 284-285, 288-314, 320, 329-336, 340-348, 359, 364, 368
src/components/values/SourceCodeValue.vue 92.22% 100% 0% 92.22% 75-81
src/components/values/abi/ContractAbiEntry.vue 66.48% 100% 0% 66.48% 106-165
src/components/values/abi/ContractAbiValue.vue 52.72% 100% 0% 52.72% 165-320
src/components/values/abi/ContractCallBuilder.ts 16.66% 100% 0% 16.66% 30-159, 162-186
src/schemas/HederaSchemas.ts 96.31% 64.28% 87.5% 96.31% 111-125, 313-314, 712, 836-837, 839-840, 856-857, 859-866
src/utils/analyzer/ABIAnalyzer.ts 100% 100% 100% 100%
src/utils/cache/AdminContractCache.ts 100% 100% 100% 100%
src/utils/cache/CacheUtils.ts 100% 100% 100% 100%
src/utils/cache/LogicContractCache.ts 100% 87.5% 100% 100%
Generated in workflow #803

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
36.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Collaborator

@svienot svienot left a comment

Choose a reason for hiding this comment

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

Looks good !

@ericleponner ericleponner merged commit 7033246 into main Apr 19, 2024
6 of 7 checks passed
@ericleponner ericleponner deleted the 964_proxy_contract branch April 19, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable to call implementation contract from a proxy contract
2 participants