# Simple Token

Create contract with name `UTSTokenShowcase` .&#x20;

You need to import:

```solidity
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

We are starting with defining contract and dependencies. As access control we are choosing Ownable and also since it is UTS Token we need to import ERC20 implementation, here we are using one by OpenZeppelin.

`UTSBase` is our main contract that should be inherited by any Token or Connector.

In this implementation we also used `Ownable` and `ERC20`

```solidity
contract UTSTokenShowcase is UTSBase, Ownable, ERC20 {}
```

<pre class="language-solidity"><code class="lang-solidity"><strong>constructor(
</strong><strong>    address _router,  
</strong>    uint256[] memory _allowedChainIds,
    ChainConfig[] memory _chainConfigs
) Ownable(msg.sender) ERC20("UTS Token Showcase", "UTSTS") {
    __UTSBase_init(address(this), decimals());

    _setRouter(_router);
    _setChainConfig(_allowedChainIds, _chainConfigs);

    _mint(msg.sender, 1_000_000 * 10 ** decimals());
}
</code></pre>

Then we need do define constructor. Since it is Token, we don't need a lot, just general UTS settings and ERC20 metadata.&#x20;

We need setup `_router` address, that can be found [here](/universal-token-standard/contract-addresses.md).&#x20;

`_allowedChainIds` are simply whitelist of chain id's, where you are allowing to bridge tokens.&#x20;

`_chainConfigs` is array of settings responsible for bridge settings. We described this config [here](/universal-token-standard/developer-guides/manual-deploy/factory-blueprint-deployment.md).

In constructor we need to call `__UTSBase_init` function to initialize UTS Base contract. Also we need to set router and chain config.

{% hint style="info" %}
We can skip setting router and chain configs in constructor, but before starting bridging we need to do it with relevant public functions.
{% endhint %}

After this step we need to override 3 functions: `_mintTo`*,* `_burnFrom` and `_authorizeCall`.&#x20;

```solidity
function _authorizeCall() internal override onlyOwner() {}
```

```solidity
function _burnFrom(
    address spender,
    address from, 
    bytes memory /* to */, 
    uint256 amount, 
    uint256 /* dstChainId */, 
    bytes memory /* customPayload */
) internal override returns(uint256 bridgedAmount) {
    if (from != spender) _spendAllowance(from, spender, amount);

    _update(from, address(0), amount);

    return amount;
}
```

```solidity
function _mintTo(
    address to,
    uint256 amount,
    bytes memory /* customPayload */,
    Origin memory /* origin */
) internal override returns(uint256 receivedAmount) {
    _update(address(0), to, amount);

    return amount;
}
```

So, here is very simple logic, in the outbounding `bridge` transaction, we need to burn tokens from `from` address (do not forget about ERC20 allowance check), in the inbounding `redeem` transaction, we need to mint tokens to receiver `to` address.&#x20;

So, our contract is ready, now it can be deployed on networks and we can start bridging tokens between each chain.

{% hint style="info" %}
You can find full code [here](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/showcases/UTSTokenShowcase.sol)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.entangle.fi/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/simple-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
