Giter VIP home page Giter VIP logo

aergo-contract-ex's Introduction

Aergo Contract Example

Aergo, as a distributed application and storage platform, want as many developers as possible to realize their ideas on the blockchain. So we create and provide generally and frequently used libraries and some examples that existing dapp developers would find friendly.

Libraries

  • safemath: It is a library used to prevent overflow, divide-by-zero, etc...
  • address: It is an utility library to verify addresses used in aergo.
  • object: Lua does not provide classes. This is a library that helps you write reusable code using lua tables.
  • typecheck: Provides a library that increases the readability and checks the type.

Smart Contracts

  • helloworld: It is a very basic contract. You can learn how to use set and get.
  • fixedtoken: This is an example of a token contract with a fixed amount of issuance.
  • exchange: It is a simple token <-> aergo exchange contract.
  • crowdsale: Using the object library, we provide a reusable crowdsale contract.
  • sqlwrapper: It is a simple contract that can execute and query SQL to blockchain directly.
  • token: It is a token contract referring to erc20. It can be combined with the object library depending on the usage. We also used the typecheck library to rigorously check the type and reduce the exception cases.
  • flash_loan: Borrow tokens without any collateral by paying on the same transaction.

Build and Publish using Ship

This project builds (or attaches) sources using ship.

To build and publish all projects to the local ship repository, run ./scripts/publish.sh

aergo-contract-ex's People

Contributors

aspiers avatar kroggen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

aspiers

aergo-contract-ex's Issues

typecheck failures don't give caller info

When typecheck catches a type mismatch, the resulting error looks something like this:

ERR execution fail error="[string \"0cca71fcf76698693693c6edc703ea42c82494bfafa1b6a14100aabaa7a1afb08f\"]:27: expected number but got nil" cmd=call module=brick

Even if we ignore aergoio/aergo#113, here the line number 27 refers to this:

      assert(type(got) == expected, string.format("expected %s but got %s", expected or 'nil', type(got)))

which is code internal to the implementation of typecheck. So the error doesn't give any helpful info about where the type mismatch occurred. This makes debugging the issue much harder.

This is easy to fix using the debug module; for example debug.getinfo(2).name would return the name of the calling function, or debug.traceback() would return a full stack trace.

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.