Solidity to LIGO token conversion update

Julian Konchunas
Madfish Solutions
Published in
3 min readJul 3, 2020

Though the pandemic is ongoing, we are keeping nose to the grindstone on our Solidity to LIGO transpiler.

We have planned a lot of new and useful features; that’s why we have to drastically rework our the project for its better maintainability in the future. Now our architecture is reorganized according to the modern standards of compiler development. This new architecture will allow us to improve code analysis for implementing more complex features and polishing contract interoperability support.

We have laid the foundation for ERC20 and ERC721 interfaces conversion. This means transpiler will now detect if your Solidity contract uses either of these two interfaces. Thereafter, the transplier will try to replace them to a corresponding FA1.2 and FA2 code respectively. For example, if you want to migrate your Dex contract which works with ERC-20 tokens, you will get a code which theoretically does the same with FA1.2 tokens on Tezos. Since Tezos and Ethereum contracts have different mechanisms of interoperability, this will require some manual intervention. But as of now, it feels extra convenient to have at least a template for things that can’t be translated.

The example of ERC-20 conversion to FA1.2

Another thing we worked on was a runtime execution tests. From the very start of this project, we were a bit worried issues could appear at runtime, even when the transpiled code looks valid. To eliminate this risk, we have developed a bunch of tests which compare execution results of a translated code. We have decided to limit ourselves to plain types and maps. But now we at least can be sure that Solidity adding to map is, in fact the same as LIGO's Map.add.

In the process we have improved our static analysis methods along with incorporating some new and more concise LIGO syntax. Now resulting code better detects external functions and returns operation list when appropriate. We are also planning to implement a similar approach to pure functions detection and such.

You can play around with our transpiler online here. Try these new features and tell us what you think! And don’t hesitate to reach out to us if you run into any difficulties. We are open to suggestions — the more users trying out our utility, the better we become.

Links

Try it online: sol2ligo

Feel free to provide your feedback in our Github Issues section:

Subscribe to our twitter for updates on this and other our projects: @madfishofficial

--

--

Julian Konchunas
Madfish Solutions

Blockchain engineer at @madfish.solutions. Ex-Ubisoft. Telegram channel https://t.me/tenxer