diff --git a/packages/api/.env.example b/packages/api/.env.example index 447d6362a4..b995bb711b 100644 --- a/packages/api/.env.example +++ b/packages/api/.env.example @@ -15,6 +15,7 @@ DISABLE_EXTERNAL_API=false DATABASE_STATEMENT_TIMEOUT_MS=90000 CONTRACT_VERIFICATION_API_URL=http://127.0.0.1:3070 NETWORK_NAME=testnet-sepolia + BASE_TOKEN_SYMBOL=ETH BASE_TOKEN_DECIMALS=18 BASE_TOKEN_L1_ADDRESS=0x0000000000000000000000000000000000000000 diff --git a/packages/api/README.md b/packages/api/README.md index 29f99a739c..79c8bd374d 100644 --- a/packages/api/README.md +++ b/packages/api/README.md @@ -26,6 +26,61 @@ You need to have a running Worker database, for instructions on how to run the w - `DATABASE_CONNECTION_POOL_SIZE` - Set `CONTRACT_VERIFICATION_API_URL` to your verification API URL. For zkSync Era testnet use `https://zksync2-testnet-explorer.zksync.dev`. For zkSync Era mainnet - `https://zksync2-mainnet-explorer.zksync.io`. +## Custom base token configuration +For networks with a custom base token, there are a number of environment variables used to configure custom base and ETH tokens: +- `BASE_TOKEN_L1_ADDRESS` - required, 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` - required, example: `ZK` +- `BASE_TOKEN_NAME` - required, example: `ZK` +- `BASE_TOKEN_DECIMALS` - required, example: `18` +- `BASE_TOKEN_LIQUIDITY` - optional, example: `20000` +- `BASE_TOKEN_ICON_URL` - optional, example: `https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266` +- `BASE_TOKEN_USDPRICE` - optional, example: `3300.30`. + +- `ETH_TOKEN_L2_ADDRESS` - required, example: `0x642C0689b87dEa060B9f0E2e715DaB8564840861`. Eth L2 address can be calculated using SDK: + ``` + import { utils, Provider } from "zksync-ethers"; + + async function main() { + const l2provider = new Provider("http://localhost:3050"); + const ethL2Address = await l2provider.l2TokenAddress(utils.ETH_ADDRESS); + console.log('ethL2Address', ethL2Address); + } + main() + .then() + .catch((error) => { + console.error(error); + process.exitCode = 1; + }); + ``` +- `ETH_TOKEN_NAME` - optional, default is `Ether` +- `ETH_TOKEN_SYMBOL` - optional, default is `ETH` +- `ETH_TOKEN_DECIMALS` - optional, default is `18` +- `ETH_TOKEN_LIQUIDITY` - optional, example: `20000` +- `ETH_TOKEN_ICON_URL` - optional, default (ETH icon) is: `https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266` +- `ETH_TOKEN_USDPRICE` - optional, example: `3300.30`. + ## Running the app ```bash diff --git a/packages/app/tests/components/TheFooter.spec.ts b/packages/app/tests/components/TheFooter.spec.ts index 8ecf1a640d..e48c3a721a 100644 --- a/packages/app/tests/components/TheFooter.spec.ts +++ b/packages/app/tests/components/TheFooter.spec.ts @@ -24,9 +24,7 @@ describe("TheFooter:", () => { }, }); const links = wrapper.findAll("a"); - expect(links[0].attributes("href")).toBe( - "https://docs.zksync.io/build/tooling/block-explorer/getting-started.html" - ); + expect(links[0].attributes("href")).toBe("https://docs.zksync.io/build/tooling/zksync-block-explorers"); expect(links[1].attributes("href")).toBe("https://zksync.io/terms"); expect(links[2].attributes("href")).toBe("https://zksync.io/contact"); }); diff --git a/packages/app/tests/components/TheHeader.spec.ts b/packages/app/tests/components/TheHeader.spec.ts index a5367a5832..aa31d1562a 100644 --- a/packages/app/tests/components/TheHeader.spec.ts +++ b/packages/app/tests/components/TheHeader.spec.ts @@ -62,7 +62,7 @@ describe("TheHeader:", () => { expect(toolsLinks[2].attributes("href")).toBe("https://bridge.zksync.io/"); expect(wrapper.findAll(".navigation-container > .navigation-link")[0].attributes("href")).toBe( - "https://docs.zksync.io/build/tooling/block-explorer/getting-started.html" + "https://docs.zksync.io/build/tooling/zksync-block-explorers" ); }); it("renders social links", () => {