Example contracts to show how to use Idris as a smart contract language for the Ethereum platform.
- Idris (tested against 0.10) with FFI support
- Serpent back end for Idris
- Serpent (tested against 2.0.2)
For compiling to actual EVM code (not yet fully possible due to back end output size), you need either:
- pyethereum (for running Serpent code in a simulator), or
- An Ethereum client like AlethZero to compile the LLL code
For example, building the Rock-Paper-Scissors sample. Assuming idris-se
and examples
are checked out in the same directory.
Compiling to Serpent and then to LLL:
idris -p effects -p contrib idris/RPS_SIO.idr -i idris/ -i ../idris-se/lib --codegen se --interface -o rps.se --no-partial-eval
serpent compile_to_lll rps.se > rps.lll
Run using the test runner (should work):
idris -p effects -p contrib idris/RPS_IO.idr -i ../idris-se/lib -i idris -o rps --no-partial-eval && ./rps