GithubHelp home page GithubHelp logo

mkinterface's Introduction

MkInterface

A tool for lazy guys to update all interfaces of smart contracts at once.

Installation

npm install -g mkinterface

This tool required truffle, make sure you've already got it.

npm install -g truffle

Configuration

This version had supported solidity compiler 0.5.0 and truffle 5.0.0. To esablishing new feature, we need you to create mkinterface.json in the root of your project.

E.g

{
  "minVersion": "0.4.11",
  "maxVersion": "0.6.0",
  "supportSolc5": true
}

Version configuration

mkinterface will find all .sol files, then update old style of pragma to the new one.

E.g.

Configuration Before After
{"minVersion": "0.4.11","maxVersion": "0.6.0"} pragma solidity ^0.4.3; pragma solidity >= 0.4.11 <= 0.6.0;
{"minVersion": "0.4.11", "supportSolc5": true} pragma solidity ^0.4.3; pragma solidity >= 0.4.11;
{"minVersion": "0.4.11", "supportSolc5": false} pragma solidity ^0.4.3; pragma solidity ^0.4.11;
{} pragma solidity ^0.4.3; pragma solidity ^0.4.3;

Solc compatible

New version of solc have some changes, old version of contract's interface won't work properly.

E.g.

function readProposal(uint256 _id) public view returns (bytes);

Result of truffle compile all

MyContractInterface.sol:13:65: TypeError: Data location must be "memory" for return parameter in function, but none was given.
    function readProposal(uint256 _id) public view returns (bytes);
                                                            ^---^

supportSolc5: true will change interface into:

function readProposal(uint256 _id) public view returns (bytes memory);

Expected result:

pragma solidity >= 0.4.24 <= 0.6.0;


contract MigrationsInterface {
  //Events
  
  //Public methods
  function last_completed_migration() public view returns (uint256);
  function owner() public view returns (address);
  function setCompleted(uint256  completed) public;
  function upgrade(address  new_address) public;
  function test(bytes memory  data, uint256[] memory  dis) public returns (string memory);
}

License

This sofware distributed under MIT License

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.