Create a Custom Token
You can extend the base implementation of the UTS Token or UTS Connector to accommodate your specific requirements.
To implement your custom token you need to follow some basic rules:
You need to install our package
Import UTS Base smart contract
UTS Base contract is the main entity in the process of creation UTS Token or UTS Connector. To implement any token or connector you will need to inherit UTS Base smart contract. Simply, it is wrapper around cross-chain communication logic.
To learn more about you can check our examples. There you can also find code with rich technical documentation.
Inherit from UTS Base contract. All necessary functions are virtual and you can override them with your own logic.
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.
Once you have finished editing logic in your implementation, you can proceed to deployment. If you don't have precomputed addresses of your contracts, you can leave initial settings like,
chain Ids
andchain configs
empty.If you didn't provide chain configs through deployment, you can do this after deployment by calling
Without setting up this configs in your Token/Connector contracts, your bridge will not work. So, you need to do it on each side of your cluster.
After that step your cluster is ready to work.
If you have Connector in your cluster, to bridge to Connector's chain, you need to fill it with tokens, otherwise Connector contract will not have funds to unlock. You can fill it using bridge from Connector's chain, so you will lock some funds on this chain or you can just transfer underlying token to Connector's address. See how to transref liquidity to connector.
You can use advanced logic and let your Connector to mint/burn your tokens, so, you don't need to think about liquidity on Connectors.
If you have multiple Connectors in your cluster, you need to ensure that their balances always have sufficient amounts of underlying token to have a possibility to redeem funds.
We have also Examples section, with clear examples of custom tokens.
Last updated