All Projects β†’ aragon β†’ radspec

aragon / radspec

Licence: MIT license
🀘 Radspec is a safe interpreter for Ethereum's NatSpec

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to radspec

Codecrumbs
Learn, design or document codebase by putting breadcrumbs in source code. Live updates, multi-language support and more.
Stars: ✭ 2,581 (+1998.37%)
Mutual labels:  documentation-tool
Hugo
The world’s fastest framework for building websites.
Stars: ✭ 55,899 (+45346.34%)
Mutual labels:  documentation-tool
api-explorer
API Explorer is a live documentation client for Swagger/OpenAPI Specification
Stars: ✭ 44 (-64.23%)
Mutual labels:  documentation-tool
Projectz
Stop wasting time maintaining your project's readme and package files! Let Projectz do it for you.
Stars: ✭ 235 (+91.06%)
Mutual labels:  documentation-tool
Nbdev
Create delightful python projects using Jupyter Notebooks
Stars: ✭ 3,061 (+2388.62%)
Mutual labels:  documentation-tool
Api-Doc
A Technology for Rest API Documentation πŸ’» πŸ“œ "Dockerized"
Stars: ✭ 14 (-88.62%)
Mutual labels:  documentation-tool
Dart
DART is a test documentation tool created by the Lockheed Martin Red Team to document and report on penetration tests, especially in isolated network environments.
Stars: ✭ 207 (+68.29%)
Mutual labels:  documentation-tool
madness
Instant Markdown Server
Stars: ✭ 54 (-56.1%)
Mutual labels:  documentation-tool
Gatsby
Build blazing fast, modern apps and websites with React
Stars: ✭ 51,925 (+42115.45%)
Mutual labels:  documentation-tool
tinyspec
Simple syntax for describing REST APIs
Stars: ✭ 95 (-22.76%)
Mutual labels:  documentation-tool
Vscode Restructuredtext
reStructuredText Language Support in Visual Studio Code
Stars: ✭ 243 (+97.56%)
Mutual labels:  documentation-tool
Ford
Automatically generates FORtran Documentation from comments within the code.
Stars: ✭ 245 (+99.19%)
Mutual labels:  documentation-tool
RTFMbot
Discord bot for programming, runs code (600+ langs), queries/show docs and references
Stars: ✭ 184 (+49.59%)
Mutual labels:  documentation-tool
Paradox
Markdown documentation
Stars: ✭ 229 (+86.18%)
Mutual labels:  documentation-tool
strictdoc
Software for writing technical requirements specifications.
Stars: ✭ 80 (-34.96%)
Mutual labels:  documentation-tool
Hexo Theme Doc
A documentation theme for the Hexo blog framework
Stars: ✭ 222 (+80.49%)
Mutual labels:  documentation-tool
bocco
Generate API documentation from Markdown
Stars: ✭ 39 (-68.29%)
Mutual labels:  documentation-tool
scod
A nice documentation generator based on ddox.
Stars: ✭ 32 (-73.98%)
Mutual labels:  documentation-tool
BooGi
Generate GitBook-like modern docs/tutorial websites using Gatsby
Stars: ✭ 117 (-4.88%)
Mutual labels:  documentation-tool
versions-jekyll
An example site and repo for controlling versions of content in a web site.
Stars: ✭ 18 (-85.37%)
Mutual labels:  documentation-tool

radspec 🀘

Travis branch Coveralls github branch

Radspec is a safe interpreter for dynamic expressions in Ethereum's NatSpec.

This allows smart contact developers to show improved function documentation to end users, without the security pitfalls of natspec.js. Radspec defines its own syntax structure and parses its own AST rather than directly evaluating untrusted JavaScript.

Features

  • Expressive: Show relevant details to smart contract end-users at the time they make transactions.
  • External calls: Radspec can query other contracts.
  • Safe: Radspec requires no DOM access or untrusted JavaScript evaluation.
  • Compatible: Most existing NatSpec dynamic expressions are compatible with Radspec.

Introduction & quick start

Radspec supports any contract programming language, such as Solidity or Vyper because radspec works on the compiled JSON ABI. Here is an example using Solidity.

pragma solidity ^0.5.0;

contract Tree {
    /// @notice Set the tree age to `numYears` years
    function setAge(uint256 numYears) external {
        // set the age into storage
    }
}

Notice the dynamic expression documentation for the setAge function. When presented to the end user, this will render based on the inputs provided by the user. For example, if the end user is calling the contract with an input of 10 years, this will be rendered by radspec as:

Set the tree age to 10 years

Use the Solidity compiler to generate user documentation and ABI with:

solc --userdoc --abi tree.sol

This produces the outputs:

{
  "methods" :
  {
    "setAge(uint256)" :
    {
      "notice" : "Set the tree age to `numYears` years"
    }
  }
}

and

[{
  "constant":false,
  "inputs":[{"name":"numYears","type":"uint256"}],
  "name":"setAge",
  "outputs":[],
  "payable":false,
  "stateMutability":"nonpayable",
  "type":"function"
}]

Write a simple tool using radspec to interpret this:

import radspec from 'radspec'

// Set userDoc and ABI from above
const expression = userDoc.methods["setAge(uint256)"].notice
const call = {
  abi: abi,
  transaction: {
    to: '0x8521742d3f456bd237e312d6e30724960f72517a',
    data: '0xd5dcf127000000000000000000000000000000000000000000000000000000000000000a'
  }
}
radspec.evaluate(expression, call)
  .then(console.log) // => "Set the tree age to 10 years"

See more examples here and in the tests.

Please let us know if there's anything else you'd like Radspec to be able to evaluate by filing an issue!

Installation

Simply use your favorite Node.js package manager:

npm i radspec

Documentation

Documentation about radspec and the internals of radspec can be found here.

Contributing

TBD

Aside: Why is natspec.js unsafe?

natspec.js accepts any valid JavaScript. There are multiple reasons this is a bad idea:

  1. You either need to write your own JavaScript VM or use eval (unsafe!) from inside JavaScript
  2. A fully-featured language with classes, functions and much more is absolutely overkill for something that could be solved with a simple DSL.

As dapps become increasingly complex, it is paramount that tools are written in a way that makes phishing near impossible. Evaluating JavaScript directly makes opens your dapp up to cross-site scripting attacks by users merely submitting a transaction(!).

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].