Solidity to Ligo transpiler

by MadFish Team

Hello! We are the team at Madfish Solutions and we were awarded a grant by Tezos foundation for creating Solidity to LIGO transpiler.

Our project aims to assist developers in transitioning smart contracts from Ethereum-ecosystem to Tezos. We are very excited about this, so we would like to introduce ourselves and tell you more about our project and goals!

It all started at the hackathon

In 2019, Tezos Ukraine organized a hackathon in Kyiv to develop projects for the Tezos ecosystem. We had a bunch of ideas, but after a short evaluation, we settled on doing a transpiler from Solidity to Tezos. Transpiler is a program that translates from one programming language to another language with a similar level of abstraction. Tezos Ecosystem was adolescent at a time, so our options were limited considering the hackathon’s tight timeframe. It seemed feasible to do at least basic language conversion in 48 hours and the value would be tremendous in case of success. And we have succeeded! Since our team has engineers with prior hobby compiler experience we have rapidly implemented a small transpiler and converted a minimal example of a custom token from Solidity to Ligo and were able to show the achieved result on stage.

Judges quite liked our idea so we took the first place! They loved our idea so much that Tezos has generously awarded us a grant to progress this idea further.

About our project

Right now our we have a hackathon edition and its online version. We have cleaned it up and refactored for easier expansion and maintenance. It is able to convert simple expressions and statements from Solidity to PascalLIGO. Our goal is to make it compile the most popular and widely used smart contracts from Ethereum and Tron blockchain to Ligo. It is no easy task since Solidity is a kind of an object-oriented language, while LIGO is strict and functional. These two paradigms are rather different, some constructions are absent in LIGO, but we hope to compensate this by other powerful LIGO features so most of the Solidity can be converted or emulated. We aim to achieve a pleasurable dev experience, preserving overall logic soundness and correctness whenever possible.

Our goals

  • A working CLI utility able to transpile Solidity code from version 0.4 up to the newest ones.
  • LIGO output that can be compiled and deployed to Tezos network
  • Resulting code that is readable and maintainable (or at least there should be a flag to prefer readability over correctness)
  • Constructions working the same way as they used to work in Solidity
  • A suite of tests to ensure translation validity
  • A web version to play around in the same way we had it for our hackathon project

Future plans

  • Identification of troublesome and insecure pieces and warn the user about them
  • Detection and compatibility with existing Tezos and Ligo token standards (FN1.2, NFT)
  • Consider supporting other dialects like ReasonLIGO

Tools

We are using CoffeeScript as our language of choice. Sergey, our team member, has already written other transpilers so we use his library named ast4gen as a base for our application. For testing, we are using truffle with ganache from Solidity devkit and taquito paired with granary for LIGO and Tezos testing purposes.

Check it out

Here are places where development will be ongoing

sol2ligo— main repo with all the code

Our Wiki — mostly internal for now, but may contain info about the translation process and its quirks

eth2tez_online — an old playground with the hackathon version of the transpiler

The team

We blockchain developers with varying experience in different fields: fullstack web, gamedev, hardware, and so on.

vird— Sergey Glushkovskyi

KStasi — Anastasiia Kondaurova

konchunas— Julian Konchunas (yours truly)

You may also like

Leave a Comment