/tokenvm-Subnet

tokenvm subnet

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Tokenvm Subnet using the Avalanche HyperSDK

The tokenvm using the Avalanche HyperSDK allows anyone create any asset, mint more of their asset, modify the metadata of their asset (if they reveal some info), and burn their asset. Additionally, there is an embedded on-chain exchange that allows anyone to create orders and fill (partial) orders of anyone else. To make this example easy to play with, the tokenvm also bundles a powerful CLI tool and serves RPC requests for trades out of an in-memory order book it maintains by syncing blocks.

Demo Videos

https://www.loom.com/share/bcc5ab87db9f43948141a8e76edd22a7?sid=8e138c78-207e-4db9-8721-e35d97fc1a89

Completing the consts.go

consts/consts.go

const (
	// TODO: choose a human-readable part for your hyperchain
	HRP = "Hugo Waters Capitals Chain"
	// TODO: choose a name for your hyperchain
	Name = "Hugo Waters"
	// TODO: choose a token symbol
	Symbol = "HWC"
)

Registering the Missing Actions

registry/registry.go

// TODO: register action: actions.CreateAsset
consts.ActionRegistry.Register(&actions.CreateAsset{}, actions.UnmarshalCreateAsset, false),

// TODO: register action: actions.MintAsset
consts.ActionRegistry.Register(&actions.MintAsset{}, actions.UnmarshalMintAsset, false),

Successfully Setup my subnet

  • Step 1
MODE="run-single" ./scripts/run.sh
  • Step 2
./scripts/build.sh
  • Step 3
./build/token-cli key import demo.pk
  • Step 4
./build/token-cli chain import-anr

Interacting with the Subnet

Creating Asset

./build/token-cli action create-asset

Minting Tokens

./build/token-cli action mint-asset

Checking Balance

./build/token-cli key balance

Disclaimer

  • This smart contract is provided under the MIT license, and users are encouraged to review and understand the code before interacting with it.