Skip to content

komputing/kethabi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is it?

This is a gradle plugin to generate Kotlin bindings for Ethereum contracts.

How to use it?

To use it you must have kethabi in your buildscript classpath:

buildscript {
    repositories {
        maven("https://jitpack.io")
    }

    dependencies {
        classpath("com.github.komputing:kethabi:<INSERT CURRENT KETHABI VERSION>")
    }
}

And then apply the plugin:

plugins {
    id("kethabi")
}

Now kethabi will look into the src/main/abi folder for *.abi files (optionally accompanied by a *.config file). It will then generate code based on these abi files. If the abi file starts with an underscore (_) the classes will be marked as internal. The filename will determine the classname (if not changed via the config file). The package name will be generated from the path the abi file is in. E.g. if the file is in src/main/abi/org/foo/contracts then the package name will be org.foo.contracts.

It will generate 3 classes:

  • transaction generator
  • a class that uses RPC to be able directly call functions of the contract
  • transaction detector to check if a given transaction is a function call for the given contract function

Under the hood

It uses the KEthereum module abi_codegen which itself uses KotlinPoet to generate the code.

Example usages