Solidity to LIGO transpiler. Folder mode

by MadFish Team

In the last update, we implemented what we call a “directory translation mode”. It makes translation easier for you if your contract stretches across multiple files. Take a look at Maker DAO for example. It has a bunch of contracts placed into a tree-like structure in the filesystem. Previously, you would need to specify an exact file, so sol2ligo could automatically get download and resolve every import into one big Solidity Abstract Syntax Tree. Later on, this AST gets transformed and translated so you get a single output. If an original contract is on the larger side, this could lead to producing one large hard-to-read several-thousand-lines-of-code file. But now we have a special mode for this exact case called Directory mode. You specify a whole folder and the transpiler recursively translates every file in it one by one by placing #include statements whenever appropriate. This way resulting LIGO folder structure will be rather similar to what was there in Solidity.

SAI Solidity contract directory structure

We have also worked on fixing numerous issues with our default state generator. The default state is a LIGO structure representing the initial state of a contract needed for its origination in Tezos. This mechanism is needed because an Ethereum contract is first deployed and then initiated by a constructor call. Whereas in Tezos contract is deployed and initiated with some default storage parameters at the same time. Thus default parameters have to be somehow be extracted and prepared. This feature is not yet available in the web version, but you can pass the output file name via--outfile flag transpiler will produce a special .storage.ligo file alongside the main one. Also, this feature is enabled by default if you are translating using the aforementioned directory mode via --dirCLI flag.

Don’t forget to give us star on GitHub 😊😊😊

Try Sol2Ligo here

If you want to stay tuned for more subscribe to our Twitter

You may also like

Leave a Comment