Giter Site home page Giter Site logo

5afe / bivrost-kotlin Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 10.0 331 KB

๐Ÿ”ฅ ๐ŸŒˆ Bridge between Solidity Contracts and Kotlin

License: Apache License 2.0

Kotlin 99.84% Shell 0.16%
abi ethereum kotlin-library solidity solidity-contracts

bivrost-kotlin's People

Contributors

biafra23 avatar fmrsabino avatar jpalvarezl avatar rmeissner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bivrost-kotlin's Issues

`Unresolved reference: intValueExact` on v0.7.0 on Android

Expected behavior

Code generated by bivrost-kotlin should also compile on Android

Actual behavior

I'm getting Unresolved reference: intValueExact compilation error for code generated based on a particular contract.
The generated code seems to be using the new stuff about encoding dynamic types.

Steps to reproduce the behavior

I created an example project that is seeing this behavior.
It's a basic Android app project that uses bivrost to generate code from an ABI also in the repo:
https://github.com/mirceanis/bivrost-kotlin-eval

It seems there's no intValueExact method on the BigInteger class on Android.

Add abi project to travis

  • We want tests to be run automatically for each commit
  • We want to deploy releases to GitHub when we create an tag

Code gen fails with `Required value contractName missing at $` in v0.6.2

Expected behavior

Generating code for a contract compiled with a recent version of truffle should work.

Actual behavior

in v0.6.2, code generation fails with:
Required value contractName missing at $

Looks like abi generated by truffle is adding a field called "contractName" and the parser expects to see "contract_name".
The workaround is to manually change the field name in the abi json.
There is a feature/update_json branch that seems to fix this, and is already in master.

Is it possible to have a 0.7.x release with recent fixes including this?

Generate equals() and hashCode() for Bytes and BytesN

Expected behavior

Comparing different Bytes and BytesN based on their values, not reference. Right now we need to access their contents for comparison.

Actual behavior

Comparing these classes will compare the references which is not really useful for most use cases. We should implement the equals() and hashCode() methods in order to easily compare their values.

Migrate to GitHub actions

Currently the build process relies on Travis. As Gnosis has moved to GitHub action this project should also be migrated.

Notes:

  • Remove GITHUB_API_KEY usage as it will be deleted beginning of July
  • Same has to be done for Svalinn: 5afe/svalinn-kotlin#52

Optimize network calls

Combine multiple rpc calls:

[{
"method": "eth_estimateGas",
"params": ["0xa5056c8efadb5d6a1a6eb0176615692b6e648313"],
"jsonrpc":"2.0",
"id": 42
},{
"method": "eth_gasPrice",
"params": [],
"jsonrpc":"2.0",
"id": 45
},{
"method": "eth_getTransactionCount",
"params": [
"0xa5056c8efadb5d6a1a6eb0176615692b6e648313",
"latest"
],
"jsonrpc": "3.0",
"id": "dkhfgs"
}]

remove android dependency

currently it depends on the android gradle plugin and is tightly coupled to android. This plugin might also be useful outside the android scope. So it would be great if the android dependency could be dropped or optional.

Make decoding of bytes more robust

Some abi encoder encode empty bytes as
0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (length = 0 and an 0-bytes body)

bivrost is expecting 0x0000000000000000000000000000000000000000000000000000000000000000

we make use of this assumption when decoding tuples. Therefore we will have unexpected results if we try to decode tuples that contain the "padded" encoding.

The solution would be to parse the position of each dynamic type and jump to that position for decoding.

Add encoding and decoding of constructors and option to include deployment data

It would be really useful to be able to create deployment transactions. For this the deployment code (init code) is required and it should be possible to encode the constructor data.

Another useful feature would be to decode constructor data, so that deployment transactions can be analysed.

As this are potentially large strings that are copied into code it should be possible to deactivate this as a compiler flag (or even better specify the contracts that should include their deployment data)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.