The custom token pallet offered here facilitates the implementation of a custom token functionality within a Substrate runtime. It includes functionalities such as exchanging native currency for custom tokens, transferring tokens between accounts, and checking token balances.
- Exchange Native to Custom Token: Allows users to exchange native currency for custom tokens, ensuring sufficient balance checks.
- Token Transfer: Facilitates the transfer of custom tokens between accounts, managing balances accordingly.
- Get Balance: Enables users to retrieve their current token balance.
To integrate this custom token pallet into your Substrate runtime, follow these steps:
- Add the custom token pallet to your Substrate runtime Cargo.toml file:
pallet-custom-token = { version = "4.0.0-dev", default-features = false, path = "../pallets/template" }
- In the Cargo.toml file, ensure that the custom token pallet is added as a dependency in the feature std by including the line:
[features] default = ["std"] std = [ # other dependencies "pallet-custom-token/std" ]
- Configure the
pallet_custom_tokenpallet in the Substrate node runtime as follows:impl pallet_custom_token::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Currency = Balances; }
- Deploy and run your updated Substrate runtime with the custom token pallet included to enable custom token using the following command
cargo build --release
- Run the node using the following command
./target/release/node-template --dev
- Use the polkadot.org.js for test the functionalities