From de4fda45b309e98f8be6dd89618ae5db23b094df Mon Sep 17 00:00:00 2001 From: Vasyl Ivanchuk Date: Fri, 31 Jan 2025 16:50:03 +0200 Subject: [PATCH] docs: add custom base token config docs for worker (#380) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What ❔ Add docs for custom base token configuration for the worker service. ## Why ❔ Base token configuration has been recently added to the worker service and it should be reflected in the docs. ## Checklist - [X] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [X] Documentation comments have been added / updated. --- .github/workflows/app-e2e.yml | 8 ++++---- README.md | 3 +++ packages/worker/README.md | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/app-e2e.yml b/.github/workflows/app-e2e.yml index 92cf6fed1..a1099ac20 100644 --- a/.github/workflows/app-e2e.yml +++ b/.github/workflows/app-e2e.yml @@ -118,9 +118,9 @@ jobs: - name: Save artifacts to Git if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: allure-results + name: ${{ matrix.tags }}-allure-results path: packages/app/allure-results # - name: Upload test results to Allure reporter @@ -134,9 +134,9 @@ jobs: - if: failure() name: Save artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: portal_e2e_${{ github.run_number }}_artifacts + name: portal_e2e_${{ github.run_number }}_${{ matrix.tags }}_artifacts path: packages/app/tests/e2e/artifacts/* # publish: diff --git a/README.md b/README.md index be71b00db..edd53b24c 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,9 @@ npm install ### Manually set up env variables Make sure you have set up all the necessary env variables. Follow setting up env variables instructions for [Worker](./packages/worker#setting-up-env-variables), [Data Fetcher](./packages/data-fetcher#setting-up-env-variables) and [API](./packages/api#setting-up-env-variables). For the [App](./packages/app) package you might want to edit environment config, see [Environment configs](./packages/app#environment-configs). +### Configure custom base token +For networks with a custom base token, make sure to configure the base token for both Worker and API services by following the corresponding instructions [here](./packages/worker/README.md#custom-base-token-configuration) and [here](./packages/api/README.md#custom-base-token-configuration). + ### Build env variables based on your [zksync-era](https://github.com/matter-labs/zksync-era) local repo setup Make sure you have [zksync-era](https://github.com/matter-labs/zksync-era) repo set up locally. You must have your environment variables files present in the [zksync-era](https://github.com/matter-labs/zksync-era) repo at `/etc/env/*.env` for the build envs script to work. diff --git a/packages/worker/README.md b/packages/worker/README.md index d27bba8f2..c418cf25f 100644 --- a/packages/worker/README.md +++ b/packages/worker/README.md @@ -31,6 +31,36 @@ The service doesn't create database automatically, you can create database by ru $ npm run db:create ``` +## Custom base token configuration +For networks with a custom base token, there are a number of environment variables used to configure custom base token: +- `BASE_TOKEN_L1_ADDRESS` - example: `0xB44A106F271944fEc1c27cd60b8D6C8792df86d8`. Base token L1 address can be fetched using the RPC call: + ``` + curl http://localhost:3050 \ + -X POST \ + -H "Content-Type: application/json" \ + --data '{"method":"zks_getBaseTokenL1Address","params":[],"id":1,"jsonrpc":"2.0"}' + ``` + or SDK: + ``` + import { Provider } from "zksync-ethers"; + + async function main() { + const l2provider = new Provider("http://localhost:3050"); + const baseTokenAddress = await l2provider.getBaseTokenContractAddress(); + console.log('baseTokenAddress', baseTokenAddress); + } + main() + .then() + .catch((error) => { + console.error(error); + process.exitCode = 1; + }); + ``` +- `BASE_TOKEN_SYMBOL` - base token symbol, e.g.: `ZK` +- `BASE_TOKEN_NAME` - base token name, e.g.: `ZK` +- `BASE_TOKEN_DECIMALS` - base token decimals, e.g.: `18` +- `BASE_TOKEN_ICON_URL` - base token icon url, e.g.: `https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266` + ## Running the app ```bash