Hello SCORE developers,
I’ve just released a NFT (Non-Fungible Token) reference implementation written in Java SCORE.
You can find the source code and an example of how to use it:
- GitHub - sink772/javaee-tokens: A Java SCORE Library for Standard Tokens
- java-score-examples/irc3-token at master · icon-project/java-score-examples · GitHub
The NFT RI is a concise and complete example of the IRC3 standard. In addition to the APIs defined in the specification, the RI also implements some extensions like mint
, burn
, and enumerable functions like totalSupply
, tokenByIndex
, tokenOfOwnerByIndex
.
To implement the enumerable APIs, I wrote EnumerableMap.java which is similar to EnumerableMap.sol in OpenZeppelin contracts, but more concise. This is an excellent example of how to implement custom data mappings using Java SCORE.
You can run an integration testing of NFT RI against the Gangnam testnet. Clone the Java SCORE Examples repo and run the following Gradle task.
$ git clone git@github.com:icon-project/java-score-examples.git
$ cd java-score-examples
$ ./gradlew clean build optimizedJar
$ ./gradlew irc3-token:integrationTest
[NOTE] The above example assumes that the configuration file (testinteg/conf/env.props
) has been properly set for the Gangnam testnet as the following.
node.url=https://gicon.net.solidwallet.io
chain.nid=0x7
chain.godWallet=<your_keystore_file>
chain.godPassword=<your_keystore_password>
Here are the my test transactions during the integration test.
- Contract owner: https://gicon.tracker.solidwallet.io/address/hxb42c62ad8bd6de79c5112bde889bd1df63507d4e
- Player1 (Alice): https://gicon.tracker.solidwallet.io/address/hx3e04f166a6594d77913bb63fe73346429654626c
If you have any question regarding the RI or testing, feel free to post it here. I will happily answer to them.