# Technical and product requirements

### Design

* Market with Cardano assets (NFTs)
* Offers participation on the market to 3rd parties
* Offers to use contract in own market
* There is a fixed fee of 2.5% that is distributed between all parties, that participated in successful trade
* **All datums should be compatible with original the contract designed by Vacuumlabs (verified by Cbor serialization)**

### Fees and royalty calculation

* 10% to JoB
* 20% listing marketplace
* 20% listing affiliate (can be same as a marketplace)
* 50% to selling marketplace, which can be divided into many records (affiliates)
* Royalty

**The calculation for price 100 ADA, and a typical set of treasuries and 5% royalty:**

* 92.5 ADA to the seller (100 - 2.5 (fees) - 5 (5% royalty) )
* 0.25 ADA to JoB treasury (100 \_ 0.25 \_ 0.1)
* 0.5 ADA to listing marketplace treasury(100 \_ 0.025 \_ 0.2)
* 0.5 ADA to listing affiliate treasury (100 \_ 0.025 \_ 0.2)
* 0.625 ADA to selling marketplace treasury (100 \_ 0.25 \_ 0.25)
* 0.625 ADA to selling affiliate treasury (100 \_ 0.25 \_ 0.25)
* 5 ADA to royalty treasury (100 \* 0.05)

### Tech specs

* It is not necessary to mint values
* There is an option to produce treasury during a transaction
* There is an option to consume treasury
* Logic is divided between Treasury the contract and function contracts (InstantBuy/Offer)

#### Mint

Simple contract, that checks argument OutputReference is present on inputs. The purpose is only for minting disposable assets (for treasury validation method)

#### Staking

A simple contract that is validated same as the Withdrawal method, which is passed as an argument. The second argument is just salt for PolicyId It is a stake address that can be withdrawn by the wallet/token holder

#### Treasury

Common contract where user can collect ADA value during interacting with NFT market. There are two purposes:

* Use the treasury in transaction
* Withdraw treasury

The contract holds information about the withdrawal method in datum

**Usage in transaction**

<figure><img src="/files/JpwkJbTIwHyJN3ZSRplv" alt=""><figcaption></figcaption></figure>

Typical usage of the treasury is, that the original UTxO is spending during the transaction and a new one is created on output. The diff between output and input is provision.

* Check, that the count of UTxOs with the same script hash and datum like spending UTxO is equal to one (there is no need to spend more than one)
* Check, that the count of UTxOs with the same address (payment credential and spending credential) is equal to One (it is not possible to burn it or change stake address)
* Check, that the output ADA on UTxO is bigger than the input ADA
* Check, that the output values of ADA are bigger than the defined minimal value
* Check, that treasury UTxOs do not contain another asset except ADA

**Usage during withdrawal**

There are two validation mechanisms, depending on the type of treasury:

* by payment credential
* by validation token
* Check, that the validation mechanism is valid
* Check that outputs UTxOs is bigger than a minimal value
* The number of the same treasury (credential, datum, stake) is present on the input and output
* The number of output treasury (credential, datum, stake) can be reduced to 5 (another can be spent without creating new ones)

#### Instant buy

Contract for buying NFTs

There are two purposes:

* Accept
* Cancel

The validator has params

```
validator(
  treasury_script_hash: Hash<Blake2b_224, credential.Script>, // Reference to treasury validator
  stake_addresses: List<credential.StakeCredential>,          // List of accepted JoB stake address
  job: types.WithdrawalMethod,                                // JoB treasury, what is present in each transaction
)
```

Information about price, royalty etc., are stored in datum

**Accept**

* Check, that the ADA sent to a user is correct
* Check, that all provisions are correct
* Check, that the basis of royalty is not lower than the minimal value
* Check, that portions defined in the redeemer are correct
* If the royalty (payment credential) is the same as the seller's address, the royalty is not paid to a treasury, but directly to the seller's address

<figure><img src="/files/HrXIoSd7ZmkiRkAY0t3I" alt=""><figcaption></figcaption></figure>

**Cancel**

The transaction is signed by stored payment credentials There is no other check for the spending contract

#### Offer

Is very similar to instant buying instead of a final check to pay assets/ADA to the offerer's address.

Information about price, royalty etc., are stored in datum<br>

<figure><img src="/files/fKK2tfH3XO11ke1vDzgy" alt=""><figcaption></figcaption></figure>


---

# 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://jamonbread-io.gitbook.io/jamonbread/devs/technical-and-product-requirements.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.
