Audius has two sets of contracts - the one in this directory, which runs on Ethereum mainnet in production, and the one here which runs on POA mainnet in production.
The smart contracts in this directory implement the Audius ERC-20 token, staking functionality, service provider registration, delegator support and off-chain service version management. For a more in depth look at the contracts and architecture, please see the Audius Ethereum Contracts Wiki page.
The two sets of smart contracts do not interact with one another, but both sets are used by end-user clients and the off-chain services that run Audius to make use of their respective functionality.
To install and run the contracts locally, clone the audius-protocol repo and go into the
eth-contracts folder. Assuming you have node.js, npm, and docker installed, run the
following commands to run Ganache and migrate the contracts.
Note - Ganache from the command below is exposed on port 8546, not 8545.
npm install
npm run ganache
npm run truffle-migrate
To run tests, run the following command:
npm run test
To run tests with coverage calculation, run the following command:
npm run test-coverage
Add the audius-protocol repo as a remote in your extracted repos:
git remote add audius-protocol ../audius-protocol
git fetch audius-protocol- Find eth-contracts-related commits in the audius-protocol repo:
git log audius-protocol/main --oneline -- "eth-contracts/*"- Cherry-pick specific commits:
git cherry-pick <commit-hash>- Test your changes:
# Adjust based on your actual build/test commands
npm run build
npm run test- Handle conflicts if they occur:
# Fix conflicts manually, then:
git add .
git cherry-pick --continuePlease report security issues to security@audius.co with a description of the
vulenerability and any steps to reproduce. We have bounties available for issues reported
via responsible disclosure!
Apache 2.0