InterRep contracts
InterRep Solidity smart contracts.
If you want an overwiew of InterRep, read our announcement post: https://jaygraber.medium.com/introducing-interrep-255d3f56682. For more details, please see our documentation website.
⚠️ Notice: interrep.link and ropsten.interrep.link still refer to the old MVP version of interRep. They will soon be updated. You can find an updated version at kovan.interrep.link (staging env).
Deployed contracts
| Kovan | Ropsten | Arbitrum One | |
|---|---|---|---|
| ReputationBadge (Twitter) | 0xF685...1E07 | 0x2F4d...BC11 | 0x2F4d...BC11 |
| ReputationBadge (Github) | 0xD6B4...2E18 | ||
| ReputationBadge (Reddit) | 0x55d2...B4Cf | ||
| Groups | 0xD2C9...735B |
Install
Clone this repository and install the dependencies:
$ git clone https://github.com/InterRep/contracts.git
$ cd contracts
$ yarn # or `npm i`
Usage
Copy the .env.example file and rename it .env.
Compile
Compile the smart contracts with Hardhat:
yarn compile
This should generate the TypeChain typings. If you want to generate them manually run:
yarn typechain
Lint
Lint the Solidity or the TypeScript code:
yarn lint:sol
yarn lint:ts
# or yarn lint to lint both.
And check if the code is well formatted:
yarn prettier
Test
Run the Mocha tests:
yarn test
Coverage
Generate the code coverage report:
yarn coverage
Report Gas
See the gas usage per unit test and average gas per method call:
REPORT_GAS=true yarn test
Clean
Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
yarn clean
Start a local network
Run a Hardhat Network in a stand-alone fashion:
yarn start
Use --network localhost with the following commands if you want to interact with it.
Deploy
Deploy the contracts:
yarn deploy:reputation-badge --name "InterRep Twitter Badge" --symbol iTWITT
yarn deploy:groups
If you have to deploy the contracts locally you can also run yarn deploy:mocks --network localhost. It runs both the previous commands with mocked data.
If you want to deploy contracts in a specific network you can set up the DEFAULT_NETWORK variable in your .env file with the name of one of our supported networks (hardhat, localhost, ropsten, kovan, arbitrum). Or you can specify it as option:
yarn deploy:groups --network kovan // Kovan testnet
yarn deploy:groups --network localhost // Local network
If you want to deploy the contracts on Ropsten, Kovan or Arbitrum remember to provide a valid private key and an Infura API in your .env file.
Groups
Create the InterRep default groups:
$ yarn create:groups --address <contractAddress> --depth <treesDepth>