The Socket V2 Verifier contract allows consumers of the Socket API to validate onchain that their call data will have the effects they expect.
This guards against a compromise of API servers causing users to sign malicious transactions coming from the API.
Compile the smart contracts with Hardhat:
$ yarn compile
Compile the smart contracts and generate TypeChain bindings:
$ yarn typechain
Run the tests with Hardhat:
$ yarn test
Lint the Solidity code:
$ yarn lint:sol
Lint the TypeScript code:
$ yarn lint:ts
Generate the code coverage report:
$ yarn coverage
See the gas usage per unit test and average gas per method call:
$ REPORT_GAS=true yarn test
Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
$ yarn clean
Deploy the contracts to Hardhat Network:
$ yarn deploy"
To deploy to production. First load a private key with enough funds for deployment. You can see the required networks in the config xdeploy.networks
section.
Then run with your private key:
$ PRIVATE_KEY="0xprivatekey" yarn deploy:prod
Having to set mnemonics and api keys to develop locally is unnecessary so the template was modified to only require these for deploying and testing on live networks.
To deploy to live networks, make sure to set MNEMONIC
and INFURA_API_KEY
and NODE_ENV="production"
, via env variables or .env
file. Example available in .env.example