Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
Anxo Rodriguez edited this page Jul 31, 2020 · 12 revisions

Gnosis Protocol Web has some built-in configuration parameters, that allow, among other things to use your own token list, rebrand it, add new pages or modify the existing ones.

📄 Create your config file

The web has some default configuration. This configuration can be

  • Default app configs can be found on the default config file
  • We recommend against editing this file directly, though.
  • If you wish to replace any default config, create a file named config inside the custom folder.
  • Both JSON and YAML formats are supported.

Simply replace any config found on config-default.

⚠️ NOTE: If you are forking the project, you might want to delete the custom/.gitignore file so you can commit a config file and components inside the custom directory.

⚙️ Config Parameters

Below we provide details for each config.

name

A single string that controls the page title and favicon metadata.

appId

Identify the app. The IDs range from 1 until 256 Every transaction sent to the blockchain will include the ID and some basic analytic info.

appId can also be passed as an environment variable, e.g. APP_ID=2 yarn start. In which case it overrides the appId from config file.

More info about this parameter can be found here.

logoPath

Path to favicon logo.

templatePath

Path to the template html file.

tcr

Tokens are dynamically loaded from the contract, but it might not be desirable to display everything in the interface.

Gnosis Protocol is a fully permissionless trading protocol for ERC-20, as such, anyone can enable a token for trading. Tokens of dubious value or nature or those not compatible with the ERC-20 standard may also be added. Accordingly, it is the responsibility of the Site operator to determine which tokens listed on the permissionless Gnosis Protocol are displayed on their Site.

To dynamically control which tokens are displayed without the need of a redeployment, it's possible to use a Token Curated Registry (TCR) contract per network.

The only requirement is that this contract implements the following method:

function getTokens(uint256 _listId) public view returns (address[] memory)

For a sample implementation, refer to dxDAO's TCR.

Config format:

tcr:
  type: 'multi-tcr'
  config:
    lists:
      - networkId: number
        listId: number
        contractAddress: string

# OR, for no filtering
tcr:
  type: 'none'

Where:

  • type currently is either multi-tcr or none for no filter.
  • networkId is a number, such as 1 for Mainnet, 4 for Rinkeby and so on.
  • listId is optional and defaults to 0
  • contractAddress the address of the contract deployed in network networkId

Note: For networks where a TCR contract is not provided, the tokens will not be filtered.

dexPriceEstimator

Endpoints for service that provides price estimation and data for the orderbook graph.

Config format:

dexPriceEstimator:
  type: 'dex-price-estimator'
  config:
    - networkId: number
      url_production: string
      url_develop: string

Where:

  • type can only be dex-price-estimator.
  • networkId is a number, such as 1 for Mainnet, 4 for Rinkeby and so on.
  • url_production the endpoint for given networkId to use in production
  • url_develop the endpoint for given networkId to use in development (optional)

theGraphApi

Endpoints for Gnosis Protocol Subgraph.

Config format:

theGraphApi:
  type: 'the-graph'
  config:
    - networkId: number
      url: string

Where:

  • type can only be the-graph.
  • networkId is a number, such as 1 for Mainnet, 4 for Rinkeby and so on.
  • url the endpoint for given networkId

defaultProviderConfig

Endpoint for default Ethereum network provider.

Used when a wallet is not connected and for read operations when connected through Wallet Connect.

Config format:

defaultProviderConfig:
  type: 'infura'
  config:
    infuraId: 607a7dfcb1ad4a0b83152e30ce20cfc5
    infuraEndpoint: wss://mainnet.infura.io/ws/v3/

OR

defaultProviderConfig:
  type: 'url'
  config:
    ethNodeUrl: http://localhost:8383

Where:

  • infuraId is your Infura id. Appended to infuraEndpoint.
  • infuraEndpoint is the base url to Infura endpoint -- without the infuraId.
  • ethNodeUrl is the url to an Ethereum node.

Note: Both values can be provided as environment variables. Respectively, INFURA_ID and ETH_NODE_URL.

exchangeContractConfig

Exchange contract config. Used for narrowing down event queries.

Config format:

exchangeContractConfig:
  type: 'contractBlock'
  config:
    - networkId: number
      blockNumber: number

Where:

  • type can only be contractBlock.
  • networkId is a number, such as 1 for Mainnet, 4 for Rinkeby and so on.
  • blockNumber is the block where contract was deployed to given network

Wallet connect

Config for wallet connect. Allows to set a different bridge.

Config format:

walletConnect:
  bridge: 'wss://safe-walletconnect.gnosis.io/'

Alternatively you can set the bridge by declaring the env var WALLET_CONNECT_BRIDGE that would take precedence over the config.