PANDAS Part 2: Registering and Deploying Your Multichain Token

Pantos
Pantos
Published in
3 min readApr 12, 2023

In this blog post, we will walk you through the process of creating and registering a multichain token based on the Pantos Digital Asset Standard (PANDAS). We will use the provided PantosBaseToken and PantosHub ABI to create a custom token and register it on multiple chains.

Requirements

To create a simple multichain token, you will need the following:

  1. PantosBaseToken / IPantosInterface
  2. PantosHub & PantosToken ABI
  3. PAN Stake on each chain to register the token in Pantos Hub
  4. Blockchain IDs

PantosHub ABI

The PantosHub ABI (Application Binary Interface) is a JSON representation of the smart contract’s functions and events, which allows developers to interact with the smart contract through a programming language like JavaScript. The ABI acts as an interface between the contract’s bytecode and the outside world. Here’s a breakdown of the important elements in the PantosHub ABI:

Events in the ABI represent loggable occurrences within the smart contract.

In the PantosHub ABI, there are four events:

  • ExternalTokenRegistered: Emitted when an external token is registered on another blockchain.
  • ExternalTokenUnregistered: Emitted when an external token is unregistered from another blockchain.
  • TokenRegistered: Emitted when a token is registered on the current blockchain.
  • TokenUnregistered: Emitted when a token is unregistered from the current blockchain.

Functions are the callable methods within the smart contract.

In the PantosHub ABI, there are six key functions:

getPantosForwarder: A view function that returns the address of the Pantos Forwarder, which is required for cross-chain functionality.

registerExternalToken: A nonpayable function that registers an external token from another blockchain to the Pantos Hub. It takes three arguments:

  • token: The address of the token on the current blockchain.
  • blockchainID: The ID of the blockchain where the external token resides.
  • externalToken: The address of the token on the external blockchain.

registerToken: A nonpayable function that registers a token to the Pantos Hub. It takes two arguments:

  • token: The address of the token to be registered.
  • stake: The amount of PAN tokens to be staked for registration

unregisterExternalToken: A nonpayable function that unregisters an external token from another blockchain. It takes two arguments:

  • token: The address of the token on the current blockchain.
  • blockchainId: The ID of the blockchain where the external token resides.

unregisterToken: A nonpayable function that unregisters a token from the Pantos Hub. It takes one argument:

  • token: The address of the token to be unregistered.

Creating Your Own Token

To create your own token, you will need to create a new contract that inherits from PantosBaseToken. You will then deploy this contract on every chain you want your token to be available on.

Here’s an example of a custom token contract called MyToken:

// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;
pragma abicoder v2;

import "./PantosBaseToken.sol";

contract MyToken is PantosBaseToken {
string private constant _NAME = "MyToken";
string private constant _SYMBOL = "MT";
uint8 private constant _DECIMALS = 18;

constructor(uint256 initialSupply)
PantosBaseToken(_NAME, _SYMBOL, _DECIMALS)
{
ERC20._mint(msg.sender, initialSupply);
}

function setPantosForwarder(address pantosForwarder)
external
onlyOwner
{
_setPantosForwarder(pantosForwarder);
}
}

Registering Your Token on PantosHub

After deploying your custom token on every desired chain, you will need to register it on each PantosHub. To do this, follow these steps:

  1. Approve the PantosHub to take PAN using the approve function.
  2. Call the registerToken function on the PantosHub contract with your token’s address and the amount of PAN to stake.
  3. Note down the address of your token on each chain.

Registering External Token Addresses

Next, you need to register the address of your token on one chain to another. To do this, call the registerExternalToken function on the PantosHub contract. This function takes the following parameters:

  1. Your token’s address
  2. The target blockchain ID
  3. The external token’s address as a string

Once you have completed these steps, your token will be deployed on all the supported testnets and registered with the Pantos Hubs. This will enable your token to be transferred across these networks seamlessly.

Wrapping Up

By following these steps, you will have successfully created a multichain token based on the Pantos Digital Asset Standard. Your token will now be available on multiple chains, and you can use it in various decentralized applications and projects that utilize Pantos’ technology.

Check our developer documentation for more info on how to deploy your own multichain token.

--

--

Pantos
Pantos
Editor for

The first multi-blockchain token system. Made with ♥ and care in Vienna by @bitpanda.