# Contracts

The **Phrase.Trade protocol** is powered by a collection of smart contracts, each playing a critical role in the platform’s on-chain operations. These contracts manage essential tasks such as minting unique NFTs, handling marketplace interactions, and securely storing data. Below is an overview of the key contracts that drive the Phrase.Trade ecosystem:

#### 1. **PhraseTradeEIP712**

The **PhraseTradeEIP712** contract implements the **EIP-712 standard** for typed structured data signing. This allows off-chain message signing for various operations, reducing gas costs and improving security. It enables efficient and verifiable off-chain approvals, which are later submitted on-chain.

* **Key Functions**:
  * Handles secure off-chain approvals.
  * Minimizes gas usage for certain operations.
  * Provides a secure mechanism for signing typed data.

#### 2. **PhraseTradeMain**

The **PhraseTradeMain** contract is the core of the protocol, managing the majority of the platform's key logic. It handles the minting and trading of NFTs, as well as the buy and sell processes. Unlike the marketplace contract, this is where the bulk of **trading logic** resides, including dividend distributions and ownership transfers.

* **Key Functions**:
  * Facilitates the minting and transfer of phrase NFTs.
  * Manages buy and sell operations for NFTs.
  * Distributes dividends to NFT holders based on platform activity.

#### 3. **PhraseTradeNFT**

This contract is responsible for **minting and managing phrase NFTs**. Each NFT is linked to a unique phrase and sentiment score, ensuring the rarity and uniqueness of every token. Built on the ERC-721 standard, **PhraseTradeNFT** ensures compatibility with major NFT platforms.

* **Key Functions**:
  * Mints new phrase NFTs.
  * Manages the ownership of NFTs.
  * Stores unique identifiers and metadata for each NFT.

#### 4. **PhraseTradeNFTMarketplace**

Though it is designed to enable users to **buy and sell phrase NFT ownerships**, the **PhraseTradeNFTMarketplace** is currently not integrated into the protocol. Instead, initial ownership sales can occur on platforms like **OpenSea**. Once integrated, this contract will provide a dedicated space for ownership transactions within the Phrase.Trade ecosystem.

* **Key Functions**:
  * Facilitates ownership transfers (when active).
  * Designed to provide a marketplace for NFT trading within the platform.
  * Not yet active within the current protocol.

#### 5. **PhraseTradeStorage**

The **PhraseTradeStorage** contract handles the **secure storage of platform data**, including critical metadata, user information, and NFT-related data. By leveraging decentralized storage systems like **IPFS**, it ensures long-term data integrity and accessibility.

* **Key Functions**:
  * Stores metadata for NFTs and platform data.
  * Manages decentralized storage solutions.
  * Ensures data immutability and scalability.
