Skip to content

Instantly share code, notes, and snippets.

@nuevoalex
nuevoalex / layer2-spec.md
Last active October 21, 2020 05:38 — forked from pgebheim/layer2-spec.md
Augur Sidechain Specification

Augur Trading on L2 Specification

Goal

The security of the Augur v2 Oracle was designed to be independent of trading, so long as sufficient trading fees can be extracted such that the total REP market cap grows to be able to maintain security of the oracle via Augur's forking mechanism. Because of this design decision it is possible to move Augur v2 Trading off of Layer 1 (ethereum) and on to any other plaform with the constraint that the assets used for trading must be locked up on ethereum when participating.

Since releasing Augur v2 work has been done to implement support for multiple collateral types in Augur. This feature is referred to as "ParaAugur", meaning Parallel Augur. This implementation allows multiple trading implementations, collateralized in arbitrary tokens, to pool their Open Interest such that the security guarantees above remain true. This opens the opportunity for side-chains to interact with a specific collateralization of Augur depending on their use case, and also opens to the

@nuevoalex
nuevoalex / AssToken.md
Created July 22, 2020 00:24
Ass Token

Ass Token

A utility token combining exclusivity of the highest tier, cutting edge Ethereum technology, and the greatest stank yields in all of DEFI.

Purchase (Only appears while tokens are available for purchasing still)

Ass Tokens, your pass to the world of gas powered finance, are available now for .05 ETH per ASS.

field to enter in desired amount field showing price in ETH button to purchase

import In3Client from 'in3';
import { ABI } from 'in3/js/src/modules/eth/api';
declare global {
interface Window { test: any; }
}
window.test = window.test || {};
// use the In3Client
### V2 Invalid Filter:
Get 0x bids (remove all bids where gas fees are > max(5 cents, 1% of the trade's value), we should do this for all books on augur in v2)
valid_revenue = best_bid_quantity*range*(1-reporter_fee-creator_fee)*e^(-.15*time_til_market_finalizes_in_years) - gasToDoATrade - gasToClaimWinnings
valid_cost = best_bid_quantity * (max - best_bid)
valid_profit = valid_revenue - valid_cost
if valid_profit >= 0:
show_market
### LIQUIDITY SORT:
Get 0x bids/asks (remove all bids where gas fees are > max(5 cents, 1% of the trade's value), we should do this for all books on augur in v2)
Fetch all orders to start and store them somewhere that get_orders_down_to_price and get_orders_up_to_price can easily access
midpoint_liquidity = []
outcomes = 0
For outcome in market:
best_bid = get_best_bid(market)
best_ask = get_best_ask(market)
pragma solidity ^0.5.0;
contract ERC20 {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
}
@nuevoalex
nuevoalex / Augur.sol
Created March 4, 2019 23:08
Augur flattened
pragma solidity 0.4.24;
library Order {
using SafeMathUint256 for uint256;
enum Types {
Bid, Ask
}
enum TradeDirections {
pragma solidity ^0.5.0;
contract ERC20 {
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
}
@nuevoalex
nuevoalex / error.js
Created October 24, 2018 21:14
Error connecting to Rinkeby node
[ethrpc] http-transport unexpected status code IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,

Known Contract Bugs

The following vulnerabilities / bugs are already known and are not eligible for bounty:

Incorrect Reporting Fee Calculation

The reporting fee in Augur is calculated and adjusted by comparing the OI within the platform to a target OI which is based on the price of REP. The goal of this is to dynamically adjust the fee rate downward when the price is too speculative and upward when the price does not reflect the fees being collected.

There is an error in the current contracts however which will prevent the fee from ever rising. Namely the getRepMarketCapInAttoeth function does not properly convert units and will always be many orders of magnitude too high when comparing to the target market cap.

While this is a very serious problem for the platform long term the intention is to release a v2 of the contracts within a relatively short time frame and since the price of REP is still highly speculative relative to OI this will almost certainly not become a problem.