From da21838347f760b2258ec7fc9b56a4ce5ecc11b3 Mon Sep 17 00:00:00 2001 From: Yaroslav Markovski Date: Thu, 21 Mar 2024 13:33:12 +0200 Subject: [PATCH] feat: Add support for smart contract verification Signed-off-by: Yaroslav Markovski --- .env | 12 ++++++ docker-compose.yml | 72 ++++++++++++++++++++++++++++++++-- networks-config.json | 54 +++++++++++++++++++++++++ sourcify-ui-docker-config.json | 13 ++++++ 4 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 networks-config.json create mode 100644 sourcify-ui-docker-config.json diff --git a/.env b/.env index 9a51fdab..5fcd4d2a 100644 --- a/.env +++ b/.env @@ -101,3 +101,15 @@ PROMETHEUS_IMAGE_TAG=v2.41.0 ### Grafana #### GRAFANA_IMAGE_NAME=grafana/grafana GRAFANA_IMAGE_TAG=8.5.16 + +### Sourcify #### +#Sourcify Common +SOURCIFY_TESTING=false +SOURCIFY_TAG=main +SOURCIFY_UI_DOMAIN_NAME=localhost +SOURCIFY_SERVER_REPOSITORY_PATH=/data +#Sourcify Server +SOURCIFY_SERVER_SOLC_REPO=/data/solc-bin/linux-amd64 +SOURCIFY_SERVER_SOLJSON_REPO=/data/solc-bin/soljson +SOURCIFY_SERVER_CREATE2_VERIFICATION=false +SOURCIFY_USE_LOCAL_NODE=true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 128492b4..81602175 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -284,9 +284,11 @@ services: restart: "unless-stopped" ports: - "8080:8080" - environment: - DOCKER_LOCAL_MIRROR_NODE_MENU_NAME: ${DOCKER_LOCAL_MIRROR_NODE_MENU_NAME} - DOCKER_LOCAL_MIRROR_NODE_URL: ${DOCKER_LOCAL_MIRROR_NODE_URL} + volumes: + - ./networks-config.json:/app/networks-config.json #workaround to https://github.com/hashgraph/hedera-mirror-node-explorer/issues/933 + # environment: + # DOCKER_LOCAL_MIRROR_NODE_MENU_NAME: ${DOCKER_LOCAL_MIRROR_NODE_MENU_NAME} + # DOCKER_LOCAL_MIRROR_NODE_URL: ${DOCKER_LOCAL_MIRROR_NODE_URL} web3: image: "${MIRROR_IMAGE_PREFIX}hedera-mirror-web3:${MIRROR_IMAGE_TAG}" @@ -492,6 +494,68 @@ services: network-node-bridge: ipv4_address: 172.27.0.50 + sourcify-repository: + image: ghcr.io/hashgraph/hedera-sourcify:repository-${SOURCIFY_TAG} + restart: unless-stopped + container_name: sourcify-repository-${SOURCIFY_TAG} + ports: + - "10000:80" + volumes: + - sourcify-repository:/data:ro + networks: + - mirror-node + environment: + REPOSITORY_PATH: "${SOURCIFY_SERVER_REPOSITORY_PATH}" + REPOSITORY_SERVER_EXTERNAL_PORT: 10000 + UI_DOMAIN_NAME: "${SOURCIFY_UI_DOMAIN_NAME}" + TESTING: "${SOURCIFY_TESTING}" + TAG: "${SOURCIFY_TAG}" + + sourcify-server: + image: ghcr.io/hashgraph/hedera-sourcify:server-${SOURCIFY_TAG} + restart: unless-stopped + container_name: sourcify-server-${SOURCIFY_TAG} + ports: + - "5002:5002" + volumes: + - sourcify-repository:/data + networks: + - mirror-node + environment: + SERVER_PORT: "5002" + UI_DOMAIN_NAME: "${SOURCIFY_UI_DOMAIN_NAME}" + SERVER_CREATE2_VERIFICATION: "${SOURCIFY_SERVER_CREATE2_VERIFICATION}" + TESTING: "${SOURCIFY_TESTING}" + TAG: "${SOURCIFY_TAG}" + SOLC_REPO: "${SOURCIFY_SERVER_SOLC_REPO}" + SOLJSON_REPO: "${SOURCIFY_SERVER_SOLJSON_REPO}" + REPOSITORY_PATH: "${SOURCIFY_SERVER_REPOSITORY_PATH}" + REPOSITORY_SERVER_URL: "http://sourcify-repository-${SOURCIFY_TAG}" + USE_LOCAL_NODE: "${SOURCIFY_USE_LOCAL_NODE}" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:5002/health"] + interval: 30s + timeout: 10s + retries: 10 + + sourcify-ui: + image: ghcr.io/hashgraph/hedera-sourcify:ui-${SOURCIFY_TAG} + restart: unless-stopped + container_name: sourcify-ui-${SOURCIFY_TAG} + ports: + - "1234:80" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost"] + interval: 30s + timeout: 10s + retries: 10 + volumes: + - type: bind + source: ./sourcify-ui-docker-config.json + target: /usr/share/nginx/html/config.json + networks: + - mirror-node + networks: network-node-bridge: name: network-node-bridge @@ -518,3 +582,5 @@ volumes: name: prometheus-data grafana-data: name: grafana-data + sourcify-repository: + name: sourcify-repository \ No newline at end of file diff --git a/networks-config.json b/networks-config.json new file mode 100644 index 00000000..760fb05a --- /dev/null +++ b/networks-config.json @@ -0,0 +1,54 @@ +[ + { + "name": "mainnet", + "displayName": "MAINNET", + "url": "https://mainnet-public.mirrornode.hedera.com/", + "ledgerID": "00", + "sourcifySetup": { + "activate": true, + "repoURL": "https://repository.local/contracts/", + "serverURL": "https://localhost/server/", + "verifierURL": "https://localhost/#/", + "chainID": 295 + } + }, + { + "name": "testnet", + "displayName": "TESTNET", + "url": "https://testnet.mirrornode.hedera.com/", + "ledgerID": "01", + "sourcifySetup": { + "activate": true, + "repoURL": "https://repository.local/contracts/", + "serverURL": "https://localhost/server/", + "verifierURL": "https://localhost/#/", + "chainID": 296 + } + }, + { + "name": "previewnet", + "displayName": "PREVIEWNET", + "url": "https://previewnet.mirrornode.hedera.com/", + "ledgerID": "02", + "sourcifySetup": { + "activate": true, + "repoURL": "https://repository.local/contracts/", + "serverURL": "https://localhost/server/", + "verifierURL": "https://localhost/#/", + "chainID": 297 + } + }, + { + "name": "local", + "displayName": "LOCALNET", + "url": "http://localhost:5551/", + "ledgerID": "03", + "sourcifySetup": { + "activate": true, + "repoURL": "http://localhost:10000/", + "serverURL": "http://localhost:5002/", + "verifierURL": "http://localhost:1234/#/", + "chainID": 298 + } + } + ] \ No newline at end of file diff --git a/sourcify-ui-docker-config.json b/sourcify-ui-docker-config.json new file mode 100644 index 00000000..c2853343 --- /dev/null +++ b/sourcify-ui-docker-config.json @@ -0,0 +1,13 @@ + { + "SERVER_URL": "http://localhost:5002", + "REPOSITORY_SERVER_URL": "http://localhost:10000", + "EXPLORER_URL": "http://localhost:8080", + "BRAND_PRODUCT_LOGO_URL": "", + "TERMS_OF_SERVICE_URL": "", + "REMOTE_IMPORT": false, + "GITHUB_IMPORT": false, + "CONTRACT_IMPORT": false, + "JSON_IMPORT": false, + "OPEN_IN_REMIX": false, + "CREATE2_VERIFICATION": false + } \ No newline at end of file