Skip to content

Reference implementation for Aion non-fungible tokens

License

Notifications You must be signed in to change notification settings

fulldecent/aion-aip040

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

⚠️ PROJECT STATUS: Technology preview ⚠️

AIP-040 Non-Fungible Token — Reference Implementation

This project can be used directly to deploy non-fungible tokens on Aion AVM, and we recommend to use the NFToken class as the starting point for every Aion Java contract which will incorporate/extend non-fungible functionality.

Prerequisites

  1. Supported operating systems are macOS, Linux and Windows
  2. Install Java (version 11 or later) and Apache Maven
    • On macOS
      1. Do not use the official installer from Oracle, that approach is painful, nobody uses it
      2. Install Homebrew
      3. brew cask install java
      4. brew install maven

Building and testing

Prepare your Maven project build state

./mvnw initialize

Build and test

./mvnw clean install

A build which passes all tests will be indicated by:

[INFO] BUILD SUCCESS

at the bottom of your build.

After you have made any changes, run the build and test command above.

Overview

  • AVMBlockchainWrapper is a wrapper around the current AVM storage API.
  • AIP040Encoder is an encoder for any contract to interrogate any AIP-040 contract, use this to make type safe method calls which it converts to ABI encoded, wire-ready bytecode.
  • AIP040Events is an output encoder for any AIP-040 contract to emit events, use this to pass type safe calls which it directly logs to the blockchain.
  • NFToken{,Storage} are a base class and storage details for implementing the standardized AIP-040 behavior.
  • NFTokenMock{,Encoder} are a useful implementation and encoder which has additional functionality which we believe many people will want, but which is not standardized.
  • Main{,Encoder} are a deployable contract and encoder to access it.

Notes:

  • We expect the AVM storage API will change in the future, and the wrapper will be promoted upstream, obviating the need to include it in this project. aionnetwork/AVM#399.

  • The encoders are boilerplate code which should be generated from a Java interface. Java does not support class (not instance) methods with dynamic dispatch, so we cannot make an interface for Aion contracts. This is a shortcoming of Java and should be addressed as a Java Specification Request. Please help.

Extending

If you extend the functionality of the token implementation, for example to add pausing, extend the provided implementation.

To incorporate non-fungible tokens into your contract, which may have other features, copy the AIP-040 boilerplate code from the provided Main.java.

References

Maintenance

  • Periodically update to the most recent version, to obtain the latest bug fixes and new features:

    mvn versions:use-latest-versions -Dincludes="org.checkerframework:*"

License

This project is assigned copyright to Aion Foundation and released under the MIT license. Thank you to Aion Foundation for sponsoring this work!

About

Reference implementation for Aion non-fungible tokens

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages