Coder Social home page Coder Social logo

parr's People

Contributors

gkaemmer avatar mertcelebi avatar pfletcherhill avatar tyre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

parr's Issues

ABIs that don't have both name and type fields fail implementsABI

Example:

[
    {
      "constant": true,
      "inputs": [],
      "name": "rate",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "weiRaised",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "wallet",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "token",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "name": "_rate",
          "type": "uint256"
        },
        {
          "name": "_wallet",
          "type": "address"
        },
        {
          "name": "_token",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "nonpayable",
      "type": "constructor"
    }]

importTransaction sometimes fails to get transaction

Example output:

Failed to download transaction 0x752924da840fbe610484c3d510de165bc42c0ddc4cd35971727f65e3b9d97b4f TypeError: Cannot read property 'to' of null
    at /Users/pfh/Projects/ferrari/src/lib/TransactionDownloader.js:77:50
    at Generator.next (<anonymous>)
    at step (/Users/pfh/Projects/ferrari/dist/lib/TransactionDownloader.js:20:191)
    at /Users/pfh/Projects/ferrari/dist/lib/TransactionDownloader.js:20:361
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

Importer v1

Update Importer to only download a block and persist the block and its included transactions to postgres. It should not call getTransactionReceipt for the transactions.

Update elasticsearch indices and mappings

Index 1: Blocks and transactions

  • Index containing documents with type field that can be either block or transaction
  • All transactions with from, to, logs and internal_transactions all embedded
  • Blocks will be parents, and transactions will be children

Index 2: Addresses

  • Should include addresses as parents and transactions (with embedded block, log and internal transaction data) as children
  • Will have to store each transaction twice, since a child can only have one parent via join field
  • Index will have a type field that can be address, fromTransaction and toTransaction

User stories

The goal of this issue is to list out all use-cases for parr, so that we build only useful things. This is meant to serve as a living document of interesting use-cases.

  1. Make a dashboard of personal ethmoji earnings, both over time and cumulative.
  2. See a list of all ethmojis my ethmoji items contributed to.
  3. See a list of all accounts with more than 1000 ETH

Transaction importer v1

Not sure what to call this, but it should take an arbitrary, un-imported transaction from postgres, call getTransactionReceipt, get internal transactions, decode logs, and write all the data back to postgres for indexing.

Add postgres to store downloaded data relationally

Included items:

  • Add postgres database for storing all downloaded data
  • Create blocks, transactions, internal_transactions and logs tables
  • Add status fields (or another name) to indicate parsing status (i.e. downloaded transaction but not transaction receipt or added block ID but not block data)

Add queries

Allow people to save and share queries.

POST /queries:

  • { query: "[THE QUERY]", hash: "[hash]" }

GET /queries/[hash]

  • { query: "[THE QUERY]", hash: "[hash]" }

Add metadata for crowdsales

Data should include:

  • start time
  • end time
  • token (address)

All of this is in the Crowdsale ABI:

{
  "contractName": "Crowdsale",
  "abi": [
    {
      "constant": true,
      "inputs": [],
      "name": "rate",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "endTime",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "weiRaised",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "wallet",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "startTime",
      "outputs": [
        {
          "name": "",
          "type": "uint256"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "token",
      "outputs": [
        {
          "name": "",
          "type": "address"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "purchaser",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "beneficiary",
          "type": "address"
        },
        {
          "indexed": false,
          "name": "value",
          "type": "uint256"
        },
        {
          "indexed": false,
          "name": "amount",
          "type": "uint256"
        }
      ],
      "name": "TokenPurchase",
      "type": "event"
    },
    {
      "constant": false,
      "inputs": [
        {
          "name": "beneficiary",
          "type": "address"
        }
      ],
      "name": "buyTokens",
      "outputs": [],
      "payable": true,
      "stateMutability": "payable",
      "type": "function"
    },
    {
      "constant": true,
      "inputs": [],
      "name": "hasEnded",
      "outputs": [
        {
          "name": "",
          "type": "bool"
        }
      ],
      "payable": false,
      "stateMutability": "view",
      "type": "function"
    }
  ]
}

API for searching

Includes:

  • API for searching Elasticsearch index with /query or /search POST method

TODO:

  • Need to work out format of Elasticsearch indices

Website to show-off functionality

The simplest version of this website will be just a textarea and a submit button. A user can input an ES json query into the textarea and send to /search by submitting the form.

Make a more reliable ABI validator

Because encodeSignature requires its argument to have both a name and a type, just checking that all inputs have those works for now. However, it might make sense to tell the user that their ABI is invalid, if they pass an ABI with an entry that is of type function but lacks a name. It seems only constructor and fallback types are allowed to miss name.

Make a script for adding an ABI / implements key

When adding a new ABI to check every address against, we shouldn't have to re-download transactions. We should have a separate script for re-checking bytecode against ABIs and updating the implements jsonb column.

Indexer v1

We should update Indexer to index blocks, transactions, logs, internal transactions, and addresses from postgres. The script should watch postgres and index fully imported rows once the importers update them.

Re-index transactions that embed an address when the address is updated

The parr_blocks_transactions index embeds addresses inside transactions (i.e. {type: "transaction", from: {address: "...", is_contract: false}}). When the embedded address changes, each transaction should be re-indexed.

The parr_addresses index embeds addresses as well, even though it also has a parent/child relationship between transactions and addresses.

Streaming v1

Includes:

  • Script to poll Infura and index all new blocks (can use index method here: #1)

Contract importer v1

We need a way for community members to submit contract ABIs and specify their addresses

Deploy everything

Not sure what the best setup will be, but we should start working on this

Stats api route

A JSON route that a user can hit that gives stats about the import/download/index status of the whole system.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.