Skip to content

Instantly share code, notes, and snippets.

0x0101A4dca362c653f7dE9772Ab1b8C4550738000
@cwhinfrey
cwhinfrey / .md
Last active April 24, 2018 09:00
Possible Futarchy Setups

I'd like to introduce two possible prediction market setups for implementing futarchy. First I will review 3 types of prediction markets. Then I will apply these to 2 different Futarchy models.

Introduction to Prediction Market Setups

If you already have a good understanding of categorical, scalar, and conditional prediction markets, feel free to skip this section.

Each prediction market has a question, a collateral token, and at least two outcome tokens covering the possible outcomes of the question. At any point one collateral token can be locked up in exchange for one of each outcome token and likewise, a complete set of outcome tokens can be exchanged back for a collateral token.

  1. Categorical markets - Categorical markets have a set of possible outcomes. When the market is resolved to one of those outcomes, that outcome token can be redeemed for a collateral token.
contracts/Storage.sol
12:0 warning 'Storage' has no comment. zeppelin/missing-natspec-comments
contracts/estate/EstateRegistry.sol
15:0 warning 'EstateRegistry' has no natspec comment. zeppelin/missing-natspec-comments
48:2 warning 'mint' has no natspec title comment. zeppelin/missing-natspec-comments
58:2 warning 'mint' has no natspec title comment. zeppelin/missing-natspec-comments
72:2 warning 'onERC721Received' has no natspec title comment. zeppelin/missing-natspec-comments
93:2 warning 'transferLand' has no natspec title comment. zeppelin/missing-natspec-comments
110:2 warning 'transferManyLands' has no natspec title comment. zeppelin/missing-natspec-comments
contract Futarchy is IForwarder, AragonApp {
// FutarchyOracleFactory comes from Gnosis https://github.com/gnosis/pm-contracts/blob/v1.0.0/contracts/Oracles/FutarchyOracleFactory.sol
// BoundsOracle - Calculates the upper and lower bounds for creating a new FutarchyOracle
// PriceFeedOracle - Is used to resolve all futarchy decision markets
function initialize(
FutarchyOracleFactory _futarchyOracleFactory,
BoundsOracle _boundsOracle,
PriceFeedOracle _priceFeedOracle,
uint256 _decisionTime,
@cwhinfrey
cwhinfrey / SafeERC20.sol
Last active July 9, 2023 17:02
SafeERC20 with safeIncreaseAllowance and safeDecreaseAllowance
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(
@cwhinfrey
cwhinfrey / SignatureBouncer.sol
Last active October 14, 2018 03:18
SignatureBouncer
pragma solidity ^0.4.24;
library ECDSA {
/**
* @dev Recover signer address from a message by using their signature
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param signature bytes signature, the signature is generated using web3.eth.sign()
*/
@cwhinfrey
cwhinfrey / SafeERC20.sol
Created October 14, 2018 18:01
SafeERC20 Example
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
@cwhinfrey
cwhinfrey / Escrow Comment Recommendations.md
Last active October 14, 2018 20:03
Escrow Comment Recommendations

Proposed directory structure:

contracts/
  escrow/
    ConditionalEscrow.sol
    Escrow.sol
    RefundEscrow.sol
  payment/
    PullPayment.sol
    SplitPayment.sol
@cwhinfrey
cwhinfrey / ERC721 with updated _clearApproval
Created October 18, 2018 06:22
ERC721 with updated _clearApproval
pragma solidity ^0.4.24;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../introspection/ERC165.sol";
/**
@cwhinfrey
cwhinfrey / MemoryAndStorageViewer.sol
Created November 7, 2018 18:44
MemoryAndStorageViewer.sol
contract MemoryAndStorageViewer {
uint256 storageVar1 = 23;
bytes32 storageVar2 = 0x12345;
uint8 storageVar3 = 55;
uint8 storageVar4 = 123;
function printStorage()
public
view