# 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.

{% stepper %}
{% step %}

### Install Entangle Package

Start by installing the Entangle Labs UTS Contract package using NPM.

```bash
npm i @entangle-labs/uts-contracts
```

{% endstep %}

{% step %}

### 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.&#x20;

To learn more, check out our [examples](https://docs.entangle.fi/universal-token-standard/developer-guides/manual-deploy/examples), which include code with detailed technical documentation.

```solidity
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

{% endstep %}

{% step %}

### 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.

{% hint style="info" %}

* 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 the `setRouter` and `setChainConfig` functions.
* The `_mintTo` function MUST be overridden to implement `mint`/`transfer` underlying tokens to receiver `to` address by `_router`.
* The `_burnFrom` function MUST be overridden to implement `burn`/`transferFrom` underlying tokens from `spender`/`from` address for bridging.
  {% endhint %}
  {% endstep %}

{% step %}

### Deployment

Once you've finished editing the logic in your implementation, you can proceed with deployment. If you don't have precomputed contract addresses, you can leave initial settings, such as `chain Ids` and `chain configs`, empty.
{% endstep %}

{% step %}

### Configuration

{% hint style="info" %}
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.
{% endhint %}

If you didn’t provide chain configurations during deployment, you can add them afterward by calling `setChainConfig`.

```solidity
/**
 * @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)
```

{% endstep %}

{% step %}

### 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](https://docs.entangle.fi/universal-token-standard/developer-guides/manual-deploy/examples) of custom tokens to guide you further.
{% endstep %}
{% endstepper %}

## Additional Important Information and Notes

<details>

<summary>Ensure Connector is Funded for Proper Functioning</summary>

Connector's chain. Without funds, the Connector contract won't be able to unlock tokens. You can fill it by using the bridge from the Connector's chain, which will lock funds on that chain, or you can directly transfer the underlying token to the Connector's address. See how to [transfer liquidity to the Connector](https://docs.entangle.fi/universal-token-standard/user-guides/transfer-liquidity-to-connector).

</details>

<details>

<summary>Maintain Adequate Token Balances in Your Connectors</summary>

If you have multiple Connectors in your cluster, you must ensure their balances always contain enough underlying tokens to facilitate the redemption of funds.

</details>

<details>

<summary>Automate Token Minting and Burning for Connector Liquidity</summary>

You can implement advanced logic to allow your Connector to mint and burn tokens, eliminating the need to manage liquidity on the Connectors.

</details>
