-
Notifications
You must be signed in to change notification settings - Fork 41
Config
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.
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 thecustom
folder. - Both
JSON
andYAML
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.
Below we provide details for each config.
A single string that controls the page title and favicon metadata.
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.
Path to favicon logo.
Path to the template html file.
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 eithermulti-tcr
ornone
for no filter. -
networkId
is a number, such as1
for Mainnet,4
for Rinkeby and so on. -
listId
is optional and defaults to0
-
contractAddress
the address of the contract deployed in networknetworkId
Note: For networks where a TCR contract is not provided, the tokens will not be filtered.
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 bedex-price-estimator
. -
networkId
is a number, such as1
for Mainnet,4
for Rinkeby and so on. -
url_production
the endpoint for givennetworkId
to use in production -
url_develop
the endpoint for givennetworkId
to use in development (optional)
Endpoints for Gnosis Protocol Subgraph.
Config format:
theGraphApi:
type: 'the-graph'
config:
- networkId: number
url: string
Where:
-
type
can only bethe-graph
. -
networkId
is a number, such as1
for Mainnet,4
for Rinkeby and so on. -
url
the endpoint for givennetworkId
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 toinfuraEndpoint
. -
infuraEndpoint
is the base url to Infura endpoint -- without theinfuraId
. -
ethNodeUrl
is the url to an Ethereum node.
Note: Both values can be provided as environment variables. Respectively, INFURA_ID
and ETH_NODE_URL
.
Exchange contract config. Used for narrowing down event queries.
Config format:
exchangeContractConfig:
type: 'contractBlock'
config:
- networkId: number
blockNumber: number
Where:
-
type
can only becontractBlock
. -
networkId
is a number, such as1
for Mainnet,4
for Rinkeby and so on. -
blockNumber
is the block where contract was deployed to given network
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.