Create a Custom Token
You can extend the base implementation of the UTS Token or UTS Connector to meet your specific requirements. To implement your custom token, you’ll need to follow a few basic guidelines.
Import Dependencies
Next, you'll need to import the UTS Base smart contract dependency. The UTS Base contract is the core component in the creation of a UTS Token or UTS Connector. To implement any token or connector, you’ll need to inherit from the UTS Base smart contract. Simply put, it acts as a wrapper around the cross-chain communication logic.
To learn more, check out our examples, which include code with detailed technical documentation.
Inheritance and Virtual Functions
Inherit from UTS Base contract. All necessary functions are virtual, allowing you to override them with your own logic if necessary.
The
__UTSBase_init
function MUST be called before using other functions of the UTSBase contract.The
_authorizeCall
function MUST be overridden to include access restriction to thesetRouter
andsetChainConfig
functions.The
_mintTo
function MUST be overridden to implementmint
/transfer
underlying tokens to receiverto
address by_router
.The
_burnFrom
function MUST be overridden to implementburn
/transferFrom
underlying tokens fromspender
/from
address for bridging.
Configuration
Without configuring these settings in your Token/Connector contracts, your bridge will not function properly. Therefore, you must apply these configurations on both sides of your cluster.
If you didn’t provide chain configurations during deployment, you can add them afterward by calling setChainConfig
.
Finishing
That's it! You've successfully created a custom token, and your cluster is now set up and ready to go. For additional important information, please refer to the section below. We also provide clear examples of custom tokens to guide you further.
Additional Important Information and Notes
Last updated
Was this helpful?