Skip to content

andyjagoe/web3-analytics-core

Repository files navigation

Web3 Analytics Core

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.

Testing

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.

Pre-Deployment Setup

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 provider
  • PRIVATE_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 transactions
  • COINMARKETCAP_API_KEY: used to estimate the price of gas
  • Other possible configuration settings might be required. See hardhat.config.ts for details.

Deploying

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.

Post-Deployment Configuration

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.

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published