This project contains the smart contracts required for operation of Web3 Analytics. Documentation for Web3 Analytics is available here.
Web3 Analytics currently runs on Goerli and will continue to do so until OpenGSN enables v3 on a mainnet network.
To run the tests, you must first start a node using the following command:
npx hardhat node
Then, run the tests using this command:
npx hardhat test --network local
You cannot test using just npx hardhat test
because it runs a node that the GSN instance used for tests cannot connect to.
Before deploying, create a .env
file in the root directory and, at minimum, configure the following values:
GOERLI_URL
: the json RPC URL from your node providerPRIVATE_KEY
: the private key of the account you want to deploy the accounts from (this account must have sufficient Goerli ETH)ETHERSCAN_API_KEY
: your api key to enable contract verification on etherscan
Optional .env values you can set include:
REPORT_GAS
: set to true or false based on whether you want to report gas for transactionsCOINMARKETCAP_API_KEY
: used to estimate the price of gas- Other possible configuration settings might be required. See hardhat.config.ts for details.
Deploy the contracts by running:
npx hardhat run scripts/deploy.ts --network goerli
Copy the deployment address of the paymaster contract and paste it in to replace WEB3ANALYTICS_PAYMASTER_ADDRESS
in this command to verify it:
npx hardhat verify --network goerli WEB3ANALYTICS_PAYMASTER_ADDRESS
Then, copy the deployment address of the main contract and paste it in to replace WEB3ANALYTICS_CONTRACT_ADDRESS
in this command to verify it:
npx hardhat verify --network goerli WEB3ANALYTICS_CONTRACT_ADDRESS "{trusted forwarder}"
Finally, you need to fund the paymaster account by running the following task:
npx hardhat --network goerli fundPaymaster WEB3ANALYTICS_PAYMASTER_ADDRESS
If you're not deploying to Goerli, you will need to replace the value in double quotes with the correct trusted forwarder for that network. You will also need to make changes to the deploy script to correctly configure it for the network you're deploying to.
Web3 Analytics has several attributes that can be configured post deployment if desired:
The best way to configure these value is to connect your wallet and write to the contract via Etherscan.