# MOR OFT

The contract is the core implementation of the MOR token using LayerZero’s Omnichain Fungible Token (OFT) standard. It extends the traditional ERC20 token with cross-chain messaging capabilities, controlled minting, and token burning. The contract is designed to enable seamless use of the MOR token across multiple blockchains in the MOR ecosystem while maintaining strict control over its supply and minting rights.

## Key Features

1. Omnichain compatibility: built on LayerZero’s OFT (OApp v2) for seamless token transfers across chains.
2. ERC20 compliant: supports standard ERC20 interface (IERC20), including allowance-based `burnFrom`.
3. Minting control: only approved minters (set by contract owner, `L2MessageReceiver` as default) can mint new MOR tokens.
4. Burnable: users can burn their own tokens or those they’ve been approved to spend.
5. Interface support: implements `IMOROFT`, `IERC20`, `IOAppCore`, and `IERC165` for interoperability.

## Notes

Standard [ERC20](https://docs.openzeppelin.com/contracts/2.x/api/token/erc20) and [OFT](https://docs.layerzero.network/v2/developers/evm/oft/quickstart) functions are not listed below.

## Storage

### isMinter

Returns `true` when the address has rights to mint tokens. `isMinter[<address>]`

```solidity
mapping(address => bool) public isMinter;
```

## Functions with restricted access

### updateMinter

Add or remove rights for `minter_` to call the `mint` function.

```solidity
function updateMinter(address minter_, bool status_) external onlyOwner;
```

| Name      | Description                                                                             |
| --------- | --------------------------------------------------------------------------------------- |
| `minter_` | The new or existed minter address.                                                      |
| `status_` | The true, when we want to add new minter, and false when we want tot remove the rights. |

### mint

Mints new tokens to the specified account. This function can only be called by the `_minter_` – `L2MessageReceiver`.

```solidity
function mint(address account_, uint256 amount_) public
```

| Name       | Description                             |
| ---------- | --------------------------------------- |
| `account_` | The account to which tokens are minted. |
| `amount_`  | The number of tokens to mint.           |

## Functions

### burn

Burns a specified amount of tokens from the caller's account, reducing the total supply.

```solidity
function burn(uint256 amount_) public
```

| Name      | Description                                                                             |
| --------- | --------------------------------------------------------------------------------------- |
| `amount_` | The number of tokens to be burned (removed) from the total supply and caller's account. |

### burnFrom

Burns a specified amount of tokens from the specified account, reducing the total supply. The caller must have allowance for at least the specified amount of tokens.

```solidity
function burnFrom(address account_, uint256 amount_) public
```

| Name       | Description                                                        |
| ---------- | ------------------------------------------------------------------ |
| `account_` | The account from which to burn tokens.                             |
| `amount_`  | The number of tokens to be burned (removed) from the total supply. |

## Read functions

### supportsInterface

Used for interface detection (ERC165). Returns `true` if the contract supports a specific `interfaceId_`. Supports `IMOROFT`, `IERC165`.

```solidity
function supportsInterface(bytes4 interfaceId_) external pure returns (bool)
```


---

# 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://gitbook.mor.org/smart-contracts/documentation/mor-oft.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.
