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.
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
Configuration
If you didn’t provide chain configurations during deployment, you can add them afterward by calling setChainConfig
.
/**
* @notice Sets the destination chains settings.
* @param allowedChainIds chains Ids available for bridging in both directions.
* @param chainConfigs array of {ChainConfig} settings for provided {allowedChainIds}, containing:
* peerAddress: connected {UTSToken} or {UTSConnector} contract address on the destination chain
* minGasLimit: the amount of gas required to execute {redeem} function on the destination chain
* decimals: connected {peerAddress} decimals on the destination chain
* paused: flag indicating whether current contract is paused for sending/receiving messages from the connected {peerAddress}
*
* @return success call result.
*/
function setChainConfig(
uint256[] calldata allowedChainIds,
ChainConfig[] calldata chainConfigs
) external virtual returns(bool success)
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?