Smart contracts for futarchy curated registry.
Futarchy curated registries are similar to token curated registries. Token curated registries decide what to add/remove based on token weighted voting, while futarchy curated registries make these decisions using futarchy.
In this project, futarchy markets are created using CategoricalEvent and ScalarEvent smart contracts from the Gnosis platform. They are set up according to the model described here under
Futarchy Market Setups #1.
Since futarchy markets are driven by future price predicion, we use the Gnosis DutchX as an oracle to resolve the price of the "FCR Token".
npm run compile to compile truffle artifacts to
Contains core registry functionality, and stores the state of registry listings. Adapted from skmgoldin/tcr/contracts/Registry.sol.
Factory contract for creation of Registry instances.
From skmgoldin/tcr/contracts/Parameterizer. Used to set parameters for registries and challenges, such as
minDeposit. New parameters values can be proposed with a token weighted vote. The voting process is implemented with PLCRVoting.
Factory contract for creation of Parameterizer instances.
Interface for DutchExchange contract. Provides the functions that are needed for the FCR implementation, so that dutch exchange can be mocked for testing.
Used to force compilation of all contracts for testing. Not intended to be deployed to testnet/mainnet.
The futarchy based challenge implementation. For each new challenge issued via Registry, there will be one instance of FutarchyChallenge deployed.
initiateFutarchy() function is used to create an instance of FutarchyOracle, which creates all events and markets for the futarchy based challenge decision.
Factory contract for creation of FutarchyChallenge instances.
Interface for a challenge instance. Implemented by FutarchyChallenge and used by FutarchyChallengeFactory.
Interface for a challenge factory instance. Implemented by FutarchyChallengeFactory and used by Registry.
Mock contract for testing with DutchX.
Allows an outcome to be set based on the average price of a given token trading pair on DutchX. Takes the average of the last 5 auctions for the token pair.
Factory contract for creation of ScalarPriceOracle instances.
Allows a resolution date to be set, and provides a modifier
resolutionDatePassed() to require that the resolution date has passed.
test dir contains unit tests and integration tests. Unit tests run against individual contract instances. Integration tests run a series of transactions against multiple deployed contracts, and assert that certain conditions are met.
Run Unit Tests
npm run test
Run Integration Tests
npm run ganache to start ganache-cli
npm run migrate-reset to run truffle migrations
npm run integration-test <testName>
Compile With solc (debugging only)
npm run solc-compile script is an optimization that allows you to compile contracts quickly with
solc, rather than
truffle compile which adds a lot of additional overhead.
First, run these prerequisite steps:
- Install latest solc CLI install solidity.
- Compile all contracts:
npm run compile
- Run the flattener:
npm run flattener
Then follow these steps to make contract changes for debugging:
- Make a change in
npm run solc-compile <ContractName>(don't include
- If there are no errors, run
npm run migrate-resetto deploy everything including your change.
Keep in mind that the truffle build data in
build/contracts/ will be modified in ways that are likely not compatible with the truffle suite. Delete the entire
build dir (
rm -rf ./build) and
npm run compile to go return to a stable state.