Skip to content

Commit

Permalink
docs: add custom base token config docs for worker
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk committed Jan 31, 2025
1 parent 683e998 commit a68d5d9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
30 changes: 30 additions & 0 deletions packages/worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a68d5d9

Please sign in to comment.