Skip to content

odradev/nysa

Repository files navigation

NYSA

NYSA - Solidity to Rust Transpiler.

The project aims to transpile smart contracts written in Solidity to Rust smart contracts.

Nysa performs Solidity-to-Rust translation in four steps:

nysa-gen

By design, Nysa is a universal tool, so the Parser component from the diagram is exchangeable. In other words, a Solidity input can be converted into Rust code supporting a framework/SDK of your choice, unless a parser implementation is provided.

At this moment, the only implementation is OdraParser which takes a contract written in Solidity and prints out Odra-compatible code.

Prerequisites

  • Rust toolchain installed (see rustup.rs).
  • WebAssembly Binary Toolkit (wabt) installed (see wabt).
  • just (not required but recommended) (see just).
  • cargo-odra (not required but recommended) (see cargo-odra).

Test Nysa

To test Nysa internal tests, execute:

$ just test

The core of tests is the resources directory. It is a test collection of Solidity code samples with the expected Rust output.

Build and test examples

The easiest way to build and test examples is to run commands defined in the justfile.

To build wasm files and run tests, execute:

$ just test-status-contract-solidity
$ just test-token-contract-solidity

To run all the example tests, execute:

$ just test-examples

Status

Legend

Done: ✅

Partially Done: 🔨

Not Done: ❌

Soon: 🔜

Solidity Statements Status
Block
If
While
For 🔜
Do while 🔜
Continue 🔜
Break 🔜
Return
Revert
Emit
Doc comment
Variable definition
Assembly
Args
Try 🔜
Solidity Expressions Status Solidity Expressions Status
PostIncrement LessEqual
PostDecrement MoreEqual
New Equal
ArraySubscript 🔨 NotEqual
ArraySlice And
MemberAccess 🔨 Or
FunctionCall 🔨 Ternary
FunctionCallBlock Assign
NamedFunctionCall AssignOr 🔨
Not AssignAnd 🔨
Complement AssignXor 🔨
Delete AssignShiftLeft 🔨
PreIncrement AssignShiftRight 🔨
PreDecrement AssignAdd
UnaryPlus AssignSubtract
UnaryMinus AssignMultiply
Power AssignDivide
Multiply AssignModulo
Divide BoolLiteral
Modulo NumberLiteral 🔨
Add RationalNumberLiteral
Subtract HexNumberLiteral
ShiftLeft 🔨 StringLiteral
ShiftRight 🔨 Type
BitwiseAnd 🔨 HexLiteral
BitwiseXor 🔨 BoolLiteral
BitwiseOr 🔨 AddressLiteral
Less Variable
More List
ArrayLiteral Unit
This

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published