Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial README #4

Merged
merged 1 commit into from
Nov 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[![](https://jitpack.io/v/komputing/kethabi.svg)](https://jitpack.io/#komputing/kethabi)

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:

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

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

And then apply the plugin:

```kotlin
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](https://github.com/komputing/KEthereum/tree/master/abi_codegen) which itself uses [KotlinPoet](https://square.github.io/kotlinpoet) to generate the code.

Example usages
--------------

* [Görli pusher](https://github.com/goerli/goerli_pusher)
* multiple modules in KEthereum - e.g. [the ERC20 one](https://github.com/komputing/KEthereum/tree/master/erc20)