trufflesuite / trufflesuite.com

Trufflesuite website source ✨
https://trufflesuite.com
181 stars 418 forks source link

Add documentation on using Truffle with Vyper; make existing documentation more language-agnostic #1397

Open haltman-at opened 3 years ago

haltman-at commented 3 years ago

Issue

The Truffle documentation, as best I can tell, makes hardly any mention of the fact that Truffle can be used with Vyper, and it says very little about how to do it.

Now, to a substantial extent, adding this really just means making the existing documentation language-agnostic; a lot of things specify Solidity when they don't have to. As an example, this page says that ./contracts are where Solidity contracts go, even though Vyper contracts can go there too, or other languages in the future. (In particular, I'm planning on finally adding Yul support, as per trufflesuite/truffle#1906, sometime soon.)

(Note: @gnidan suggests that we should have a "supported languages" page.)

However, there are a few things that are specific to Vyper that I think will need to be mentioned:

  1. Unlike with Solidity, Vyper compilation requires that the user install a Vyper compiler. (Hopefully we'll remedy this in the future (#3563, trufflesuite/truffle#1750), but for now this is the case.)
  2. File extensions -- Vyper contracts can use any of the extensions .vy, .v.py, or .vyper.py; although it's not possible to import contracts that use the latter two extensions. (I'd prefer to take them out, personally, but I assume someone is using them and that would break things.)
  3. Imports -- this page will have to be updated with examples of how to use imports in Vyper. Note that as of Truffle v5.1.64, it is possible to import external packages in Vyper just as in Solidity, but, y'know, it's Vyper so the syntax is a bit different. I think it's worth demonstrating this with examples. (Whoever does this will probably want to talk to me about this part...)
  4. Maybe other things I'm forgetting? IDK.

(Possibly this should be two separate issues, one for making things more language-agnostic and another for adding Vyper-specific parts? Oh well; I'm posting it as one, people can split it up later if they think it's appropriate.)

Thanks!

ControlCplusControlV commented 3 years ago

I know Vyper is a lot more popular, but I would love anything explaining how to use Yul with Truffle. I found 1 mention of Yul support in a commit message for Truffle 5, but docs have no mention of it, and would love to learn how to use Truffle to test Yul Contracts