From 6b6cab86c2f03384745ae668f1950bc69d5b6798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Tue, 10 Oct 2023 23:46:08 +0200 Subject: [PATCH 1/4] Hide alternative import methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Viénot --- ui/src/pages/Verifier/FileUpload.tsx | 116 +++++++++++++-------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/ui/src/pages/Verifier/FileUpload.tsx b/ui/src/pages/Verifier/FileUpload.tsx index 3fd9749f..c935acea 100644 --- a/ui/src/pages/Verifier/FileUpload.tsx +++ b/ui/src/pages/Verifier/FileUpload.tsx @@ -75,64 +75,64 @@ const FileUpload: React.FC = ({ to verify.

-
- - - - -
+ {/*
*/} + {/* selectImportMethod(ImportMethods.REMOTE)}*/} + {/* className="text-sm"*/} + {/* >*/} + {/* <>*/} + {/* */} + {/* Import from remote*/} + {/* */} + {/* */} + {/* selectImportMethod(ImportMethods.GITHUB)}*/} + {/* className="text-sm"*/} + {/* >*/} + {/* <>*/} + {/* */} + {/* Import from GitHub*/} + {/* */} + {/* */} + {/* selectImportMethod(ImportMethods.CONTRACT)}*/} + {/* className="text-sm"*/} + {/* >*/} + {/* <>*/} + {/* */} + {/* Import from Contract*/} + {/* */} + {/* */} + {/* selectImportMethod(ImportMethods.SOLIDITY_JSON)}*/} + {/* className="text-sm"*/} + {/* >*/} + {/* <>*/} + {/* */} + {/* Import from Solidity JSON*/} + {/* */} + {/* */} + {/*
*/}
{importMethodSelected === ImportMethods.REMOTE && (
From 3b251b2ff6c8b3259ae18e2ac80d1d6dc14fd072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Tue, 10 Oct 2023 23:52:02 +0200 Subject: [PATCH 2/4] Hide "View in Remix" action. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Viénot --- ui/src/pages/Lookup/Result.tsx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ui/src/pages/Lookup/Result.tsx b/ui/src/pages/Lookup/Result.tsx index 398d5f5f..47494796 100644 --- a/ui/src/pages/Lookup/Result.tsx +++ b/ui/src/pages/Lookup/Result.tsx @@ -156,14 +156,14 @@ const NetworkRow = ({ address, chainId, status }: NetworkRowProp) => { View in Sourcify Repository - - - View in Remix - - + {/**/} + {/* */} + {/* View in Remix*/} + {/* */} + {/**/} ) : (
@@ -181,14 +181,14 @@ const NetworkRow = ({ address, chainId, status }: NetworkRowProp) => { View in Sourcify Repository
- + {/*
*/} + {/* */} + {/* View in Remix*/} + {/* */} + {/*
*/}
)} From 9ae471637cbbf35e04bf7ef20c0eba5e0e5bed2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Wed, 11 Oct 2023 14:54:27 +0200 Subject: [PATCH 3/4] Inclusion of import methods and open-in-remix action is now configured in config.json. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Viénot --- ui/public/config.json | 7 +- ui/src/pages/Lookup/Result.tsx | 40 ++++---- ui/src/pages/Verifier/FileUpload.tsx | 133 +++++++++++++++------------ ui/src/utils/Configuration.ts | 25 +++++ 4 files changed, 130 insertions(+), 75 deletions(-) diff --git a/ui/public/config.json b/ui/public/config.json index 7f54574e..6e14f9d0 100644 --- a/ui/public/config.json +++ b/ui/public/config.json @@ -1,5 +1,10 @@ { "SERVER_URL": "http://localhost:5002", "REPOSITORY_SERVER_URL": "http://localhost:10000", - "HASHSCAN_URL": "https://hashscan-latest.hedera-devops.com" + "HASHSCAN_URL": "https://hashscan-latest.hedera-devops.com", + "REMOTE_IMPORT": false, + "GITHUB_IMPORT": false, + "CONTRACT_IMPORT": false, + "JSON_IMPORT": false, + "OPEN_IN_REMIX": false } \ No newline at end of file diff --git a/ui/src/pages/Lookup/Result.tsx b/ui/src/pages/Lookup/Result.tsx index 47494796..a42a20a7 100644 --- a/ui/src/pages/Lookup/Result.tsx +++ b/ui/src/pages/Lookup/Result.tsx @@ -156,14 +156,18 @@ const NetworkRow = ({ address, chainId, status }: NetworkRowProp) => { View in Sourcify Repository - {/**/} - {/* */} - {/* View in Remix*/} - {/* */} - {/**/} + {configuration.openInRemix ? ( + + + View in Remix + + + ) : ( + + )} ) : (
@@ -181,14 +185,18 @@ const NetworkRow = ({ address, chainId, status }: NetworkRowProp) => { View in Sourcify Repository
- {/*
*/} - {/* */} - {/* View in Remix*/} - {/* */} - {/*
*/} + {configuration.openInRemix ? ( + + ) : ( +
+ )}
)} diff --git a/ui/src/pages/Verifier/FileUpload.tsx b/ui/src/pages/Verifier/FileUpload.tsx index c935acea..66786f32 100644 --- a/ui/src/pages/Verifier/FileUpload.tsx +++ b/ui/src/pages/Verifier/FileUpload.tsx @@ -11,6 +11,7 @@ import RemoteInput from "./RemoteInput"; import GitHubInput from "./GitHubInput"; import ContractInput from "./ContractInput"; import SolcJsonInput from "./SolcJsonInput"; +import {configuration} from "../../utils/Configuration"; enum ImportMethods { UPLOAD, @@ -75,64 +76,80 @@ const FileUpload: React.FC = ({ to verify.

- {/*
*/} - {/* selectImportMethod(ImportMethods.REMOTE)}*/} - {/* className="text-sm"*/} - {/* >*/} - {/* <>*/} - {/* */} - {/* Import from remote*/} - {/* */} - {/* */} - {/* selectImportMethod(ImportMethods.GITHUB)}*/} - {/* className="text-sm"*/} - {/* >*/} - {/* <>*/} - {/* */} - {/* Import from GitHub*/} - {/* */} - {/* */} - {/* selectImportMethod(ImportMethods.CONTRACT)}*/} - {/* className="text-sm"*/} - {/* >*/} - {/* <>*/} - {/* */} - {/* Import from Contract*/} - {/* */} - {/* */} - {/* selectImportMethod(ImportMethods.SOLIDITY_JSON)}*/} - {/* className="text-sm"*/} - {/* >*/} - {/* <>*/} - {/* */} - {/* Import from Solidity JSON*/} - {/* */} - {/* */} - {/*
*/} +
+ {configuration.remoteImport ? ( + + ) : ( +
+ )} + {configuration.githubImport ? ( + + ) : ( +
+ )} + {configuration.contractImport ? ( + + ) : ( +
+ )} + {configuration.jsonImport ? ( + + ) : ( +
+ )} +
{importMethodSelected === ImportMethods.REMOTE && (
diff --git a/ui/src/utils/Configuration.ts b/ui/src/utils/Configuration.ts index 1a4e4178..96d1a0f3 100644 --- a/ui/src/utils/Configuration.ts +++ b/ui/src/utils/Configuration.ts @@ -8,6 +8,11 @@ export class Configuration { private _repositoryServerUrl: string | undefined; private _repositoryServerUrlFullMatch: string | undefined; private _hashScanUrl: string | undefined; + private _remoteImport: boolean | undefined; + private _githubImport: boolean | undefined; + private _contractImport: boolean | undefined; + private _jsonImport: boolean | undefined; + private _openInRemix: boolean | undefined; private _repositoryServerUrlPartialMatch: string | undefined; private _ipfsIpnsGatewayUrl: string | undefined; private _sessionDataUrl: string | undefined; @@ -66,6 +71,21 @@ export class Configuration { get serverUrl(): string { return this._serverUrl ?? "" } + get remoteImport(): boolean { + return this._remoteImport ?? false + } + get githubImport(): boolean { + return this._githubImport ?? false + } + get contractImport(): boolean { + return this._contractImport ?? false + } + get jsonImport(): boolean { + return this._jsonImport ?? false + } + get openInRemix(): boolean { + return this._openInRemix ?? false + } public readConfig = async (): Promise => { @@ -82,6 +102,11 @@ export class Configuration { this._serverUrl = configData.SERVER_URL this._repositoryServerUrl = configData.REPOSITORY_SERVER_URL this._hashScanUrl = configData.HASHSCAN_URL + this._remoteImport = configData.REMOTE_IMPORT + this._githubImport = configData.GITHUB_IMPORT + this._contractImport = configData.CONTRACT_IMPORT + this._jsonImport = configData.JSON_IMPORT + this._openInRemix = configData.OPEN_IN_REMIX this._repositoryServerUrlFullMatch = `${this._repositoryServerUrl}/contracts/full_match` this._repositoryServerUrlPartialMatch = `${this._repositoryServerUrl}/contracts/partial_match` From 4d09f04efba8d791fa710e7d47146ead28c9d9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Wed, 11 Oct 2023 15:47:08 +0200 Subject: [PATCH 4/4] Update configuration section in README. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Viénot --- README.md | 60 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 02351483..8d1c6fbf 100644 --- a/README.md +++ b/README.md @@ -109,26 +109,44 @@ Example contents for `config.json`: { "SERVER_URL": "https://server.sourcify-integration.hedera-devops.com", "REPOSITORY_SERVER_URL": "https://repository.sourcify-integration.hedera-devops.com", - "HASHSCAN_URL": "https://hashscan.io" + "HASHSCAN_URL": "https://hashscan.io", + "REMOTE_IMPORT": false, + "GITHUB_IMPORT": false, + "CONTRACT_IMPORT": false, + "JSON_IMPORT": false, + "OPEN_IN_REMIX": false } ``` +The following properties can be provided in config.json + +| Name | Description | +|-------------------------|------------------------------------------------------------------------------| +| `SERVER_URL` | URL of the server (from outside the cluster). | +| `REPOSITORY_SERVER_URL` | HTTP port exposed by container | +| `HASHSCAN_URL` | URL of HashScan | +| `REMOTE_IMPORT` | Flag to activate mode "Import from remote" | +| `GITHUB_IMPORT` | Flag to activate mode "Import from GitHub" | +| `CONTRACT_IMPORT` | Flag to activate mode "Import from contract's metadata" | +| `JSON_IMPORT` | Flag to activate mode "Import contracts from Solidity's Standard JSON Input" | +| `OPEN_IN_REMIX` | Flag to activate link "Open in Remix" | + ### _server_ module The following environment variables are needed by the _server_ at runtime: -| Name | Example value | Description | -|-------------------------|-----------------------------------------------------------|-----------------------------------------------------------------------------------------------------| -| `REPOSITORY_PATH` | ../../data/repository | DO NOT CHANGE - Path of the contract repository, both inside container and mount point on the host. | -| `SOLC_REPO` | /home/data/solc-bin/linux-amd64 | Path where Solidity compiler binaries will be saved (inside container) | -| `SOLJSON_REPO` | /home/data/solc-bin/soljson | Path where Solidity JS compilers will be saved (inside container) | -| `SOLC_REPO_HOST` | ../../data/solc-bin/linux-amd64 | Mount point for the Solidity compiler binaries downloaded (on host machine) | -| `SOLJSON_REPO_HOST` | ../../data/solc-bin/soljson | Mount point for the Solidity JS compilers downloaded (on host machine) | -| `SERVER_PORT` | 80 | HTTP port used inside container | -| `SERVER_EXTERNAL_PORT` | 5002 | HTTP port exposed by container | -| `UI_DOMAIN_NAME` | sourcify-integration.hedera-devops.com | Fully qualified domain name of the host running the ui | -| `REPOSITORY_SERVER_URL` | https://repository.sourcify-integration.hedera-devops.com | URL of repository server (from outside the cluster) | -| `TESTING` | false | DO NOT CHANGE | -| `TAG` | latest | DO NOT CHANGE | +| Name | Example value | Description | +|-------------------------|-----------------------------------------------------------|-----------------------------------------------------------------------------------------| +| `REPOSITORY_PATH` | ../../data/repository | DO NOT CHANGE - Path of the contract repository, both inside container and on the host. | +| `SOLC_REPO` | /home/data/solc-bin/linux-amd64 | Path where Solidity compiler binaries will be saved (inside container) | +| `SOLJSON_REPO` | /home/data/solc-bin/soljson | Path where Solidity JS compilers will be saved (inside container) | +| `SOLC_REPO_HOST` | ../../data/solc-bin/linux-amd64 | Path for the Solidity compiler binaries downloaded (on host machine) | +| `SOLJSON_REPO_HOST` | ../../data/solc-bin/soljson | Path for the Solidity JS compilers downloaded (on host machine) | +| `SERVER_PORT` | 80 | HTTP port used inside container | +| `SERVER_EXTERNAL_PORT` | 5002 | HTTP port exposed by container | +| `UI_DOMAIN_NAME` | sourcify-integration.hedera-devops.com | Fully qualified domain name of the host running the ui | +| `REPOSITORY_SERVER_URL` | https://repository.sourcify-integration.hedera-devops.com | URL of repository server (from outside the cluster) | +| `TESTING` | false | DO NOT CHANGE | +| `TAG` | latest | DO NOT CHANGE | ### _repository_ module @@ -141,13 +159,13 @@ even though the only useful item for the _repository_ is the following: - The web server part needs the following environment variables at runtime: -| Name | Example value | Description | -|-----------------------------------|----------------------------------------|----------------------------------------------------------| -| `REPOSITORY_PATH` | ../../data/repository | Path of the contract repository mount point on the host. | -| `REPOSITORY_SERVER_EXTERNAL_PORT` | 10000 | HTTP port exposed by container | -| `UI_DOMAIN_NAME` | sourcify-integration.hedera-devops.com | Fully qualified domain name of the host running the ui | -| `TESTING` | false | DO NOT CHANGE | -| `TAG` | latest | DO NOT CHANGE | +| Name | Example value | Description | +|-----------------------------------|----------------------------------------|--------------------------------------------------------| +| `REPOSITORY_PATH` | ../../data/repository | Path of the contract repository on the host. | +| `REPOSITORY_SERVER_EXTERNAL_PORT` | 10000 | HTTP port exposed by container | +| `UI_DOMAIN_NAME` | sourcify-integration.hedera-devops.com | Fully qualified domain name of the host running the ui | +| `TESTING` | false | DO NOT CHANGE | +| `TAG` | latest | DO NOT CHANGE | ## Support