Coder Social home page Coder Social logo

huff-language / huff-docs Goto Github PK

View Code? Open in Web Editor NEW
36.0 2.0 34.0 1.58 MB

Extensive Huff Language Documentation, Tutorials, and Resources built with Vuepress and deployed at https://docs.huff.sh

Home Page: https://docs.huff.sh

License: MIT License

JavaScript 33.65% Stylus 66.35%
ethereum evm huff huff-lang

huff-docs's People

Contributors

0xbhagi avatar 0xdaiko avatar 0xsomnus avatar 0xtutturu avatar altugbakan avatar audityourcontracts avatar calabashsquash avatar clabby avatar dev-doggo avatar devtooligan avatar jetjadeja avatar kadenzipfel avatar kuly14 avatar maddiaa0 avatar markus0x1 avatar printerdude avatar pynchmeister avatar refcell avatar robriks avatar rodrigoherrerai avatar sabnock01 avatar the-wary-one avatar unloadinggnat avatar z0r0z 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

huff-docs's Issues

Add #include keyword

Currently, there is no explaining of the importing rules in the docs, maybe we should add this, with a brief explanation of forge remappings (link to their docs?), or relative importing.

Homepage: Footer

Overview

Create Footer on homepage, with links to github, twitter, discord, copyright, etc.

Erroneous example in the Jump Labels section and ambiguous stack comments

The example given for the Jump Labels section in Huff By Examples, is causing stack underflow error on the mstore opcode under the success label. You can try it out here quickly.

image

It seems to me that 0x00 mstore part is unnecessary as the following line simply returns the "Hello, World!" string already stored in the memory (with some weird characters in the beginning cause of the padded zeroes which could be fixed with 0x0d 0x13 return).

Also, the comments representing the state of the stack seem a bit off.

Following is how I think the example should have been:

#define macro MAIN() = takes (0) returns (0) {
    // Store "Hello, World!" in memory
    0x48656c6c6f2c20576f726c6421 // ["Hello, World!"]
    0x00 mstore // [ ]

    // Jump to success label, skipping the revert statement
    success     // [success_label_pc]
    jump        // [ ]

    // Revert if this point is reached
    0x00 0x00 revert

    // Labels are defined within macros or functions, and are designated
    // by a word followed by a colon. Note that while it may appear as if
    // labels are scoped code blocks due to the indentation, they are simply
    // destinations to jump to in the bytecode. If operations exist below a label,
    // they will be executed unless the program counter is altered or execution is
    // halted by a `revert`, `return`, `stop`, or `selfdestruct` opcode.
    success:
        0x0d 0x13 return
}

Etherscan verified contracts

What's the status of Etherscan support?

Etherscan has a lot of great features for verified contracts such as Read/Write Contract, ABI, natspec, etc. Since huffc generates artifacts, Etherscan should have most of what it needs. The only thing that might be missing is natspec, which can be solved by recommending that the natspec be placed next to the ABI definitions rather than the macro definitions (this would allow it to be plugged into doc generators in general).

Natspec Styleguide

Overview

Add a section to the style guide detailing the standard used in huffmate for natspec comments.

  • At the top of the file with @title, @notice, and @author(s)
  • Above macros/functions with @notice, @dev (optional), @param (if there are any), and @return (if there are any)

Tutorial: Hello World

Overview

Following what's outlined in the tutorials overview, the Huff Docs should demonstrate how to write a simple "Hello World" contract.

Warning

Blocked by #14 due to large-scale docs refactoring

EDIT: No longer blocked!

Macro Arguments Cannot Be Opcodes

In the Huff by Example section of the docs under Macros and Functions > Macros > Macro Arguments it is mentioned that "Macro arguments may be one of: label, opcode, literal, or a constant" however it doesn't currently seem to be possible to use opcodes as macro arguments (as of huffc v0.2.0, latest version at time of writing).

Specifically the lexer module of the Huff compiler does not recognize opcodes outside of the body of macros / functions at the moment (lexer reference). Personally I haven't dived deep enough into the codegen module so I'm unsure if there's any logic to support opcode args there already.

While this could be quite a useful feature in certain instances, it doesn't seem to be possible just yet.

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.