
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
augur-core
Advanced tools
Smart contracts for Augur, a decentralized prediction market platform on the Ethereum blockchain.
If you just want to clone the repo and quickly have a couple local proof of authority networks (Geth/Clique and Parity/Aura) running with the contracts deployed then you can just clone the repo and run:
docker-compose -f support/test/integration/docker-compose.yml up --build --force-recreate
47622
.47624
.0xfae42052f82bed612a724fec3632f325f377120592c75bb78adfcceae6470c5a
.You need system-wide installations of Python 2.7.6+, Node.js 8+, and Solidity 0.4.20. (Or Docker; see below.) Install the dependencies:
npm install npx
npm install
pip install -r requirements.txt
Note: on macOS, you need to use virtualenv or homebrew Python to work around System Integrity Protection.
Solidity contract deployment is handled by ContractDeployer.tsand the wrapper programs located in
source/deployment`. This deployment framework allows for incremental deploys of contracts to a given controller (specified via a configuration option). This allows us to deploy new contracts without touching the controller, effectively upgrading the deployed system in-place.
Main Code
Configuration
Wrapper programs
The tests directory (augur-core/tests) contain tests and test fixtures to test the various functionalities present in Augur, including trading, reporting, and wcl tests.
Use pytest to run Augur's test suite:
pytest tests
This executes all the tests. To run a test individually, run the following:
pytest path/to/test_file.py -k 'name_of_test'
When writing tests, it is highly recommended to make use of the ContractFixtures class for "placeholder" variables. Python's unit testing framework comes handy here; encapsulate tests within functions that start with "test_", and use assert
statements when testing for certain values. Parameterized tests are recommended as well to test various possibilities and edge cases.
augur-core can optionally be built, run, and tested using Docker. A number of Docker commands are included as npm scripts, which map to the non-Dockerized versions where this makes sense. Docker commands beginning with docker:run
execute the command within the Docker image. Docker commands without run
(e.g. docker:test
) first build the image, then execute docker:run:<command>
.
npm run docker:build
# With a pre-built image
npm run docker:run:test:unit:all
# Build and run all unit tests and integration tests
npm run docker:test
# Build and run just integration test
npm run docker:test:integration
For quicker iteration on integration tests follow the instructions here to run tests locally against a node running in docker:
If the contracts aren't changing, after the first run you can add "AUGUR_CONTROLLER_ADDRESS": "..." to the env and it will even skip re-uploading the contracts with each run of the integration tests.
Install Oyente locally. This can be done by following the instructions on their GitHub: https://github.com/melonproject/oyente
Run the oyente script with this command to get the output for all contracts:
python source/tools/runOyente.py -p
Augur's smart contracts are organized into four folders:
source/contracts/factories
: Constructors for universes, markets, fee windows, etc.source/contracts/libraries
: Data structures used elsewhere in the source code.source/contracts/reporting
: Creation and manipulation of universes, markets, fee windows, and reporting-related tokens.source/contracts/trading
: Functions to create, view, and fill orders, to issue and close out complete sets of shares, and for traders to claim proceeds after markets are closed.There are no floating-point numbers in the EVM, only integers. Therefore, Ether and Reputation values in contracts are always represented in units of wei (i.e., indivisible units of 10^-18 Ether or 10^-18 Reputation).
FAQs
Core augur contracts and deployment process
The npm package augur-core receives a total of 76 weekly downloads. As such, augur-core popularity was classified as not popular.
We found that augur-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.