---
# System prepended metadata

title: understand NFTicket project (V3)
tags: [NFTicket]

---

# understand NFTicket project (V3)
according to master branch commit id c075398296c03520c4c807f710c0e376647a59b8

---

## Contract Architecture
![](https://i.imgur.com/EvY9u4k.jpg)


## Function for each contract
**NFTicket contract**

ticket related
* mint NFTicket
* top up ticket
* get/update ticket data
* get ticket balance

certificate related
* present certificate re-purchase

role related
* get/set master wallet
* get reseller
* get service provider
* get treasury owner
* is service provider for (certain service contract)
* is service provider
* register reseller & service provider pair
* register service provider

pool related
* present ticket fee to pool
* get reseller/transaction/service provider/total ticket pool size
* withdraw ERC20

others
* initial processor
* update service type
* get company descriptor

**NFTicketProcessor contract**
* top up ticket
* lock ticket
* release ticket
* present ticket

**NFTicketReseller (abstract) contract**
* issue NFTicket
* issue NFTicket unsigned
* deserialize ticket
* buy NFTicket

**NFTicketStandAlone contract**

ticket related
* mint NFTicket
* top up ticket
* get/set ticket data
* get ticket balance

certificate related
* present certificate re-purchase

role related
* get treasury owner
* get reseller
* get service provider
* set master wallet
* is service provider for (certain service contract)
* is service provider
* register reseller & service provider pair
* register service provider

pool related
* present ticket fee to pool
* withdraw ERC20
* get reseller/transaction/service provider/total ticket pool size

others
* initial processor
* update service type
* get company descriptor


**NFTreasury contract**

ticket related
* get/set ticket data
* get ticket balance by ERC20 
* get ticket balance
* is ticket
* add/reduce ticket balance
* top up ticket
* verify allowance

credit related
* update credits
* verify credits
* consume credits

certificate related
* is certificate
* present certificate re-purchase

cash voucher related
* is cash voucher
* fund cash voucher

role related
* get reseller
* get reseller wallet
* get service provider
* get service provider wallet
* get/set master wallet
* is registered service provider
* register service provider
* register service reseller

pool related
* get reseller/transaction/service provider/total ticket pool size
* withdraw ERC20
* split revenue
* calculate transaction fee
* update ticket pools
* distribute ticket/certificate revenue to pool
* present ticket fee to pool

others
* update service type
* get company descriptor

**NFTReseller contract**
* issue NFTicket unsigned
* issue NFTicket
* register as reseller
* view allocation

**NFTServiceProvider contract**
* consume credit

---

## Access control

### NFTicket contract
:::success
**Owner Only**
* initial processor
* set master wallet
:::

:::info
**Whitelist Only**
* get master wallet
* update ticket data
* get reseller pool size
* get transaction pool size
* get service provider pool size
* get total ticket pool size
* register reseller & service provider pair
* register service provider
:::

:::warning
**Qualified Service Provider Only**
* update service type
:::

### NFTicketProcessor contract
:::danger
*no access control*
:::


### NFTicketStandAlone contract

:::success
**Owner Only**
* add white list
* remove white list
* initial processor
* set master wallet
:::

:::info
**Whitelist Only**
* get reseller pool size
* get transaction pool size
* get service provider pool size
* get total ticket pool size
* register reseller & service provider pair
* register service provider
:::

:::warning
**Qualified Service Provider Only**
* set ticket data
* update service type
:::

### NFTreasury contract
:::danger
*no access control*
:::

### NFTReseller contract

:::success
**Owner Only**
* set up verifier account
* add white list
* remove white list
:::

:::info
**Whitelist Only**
* register as reseller
:::

:::warning
**Verifier Account Only**
* payload verification
:::

### NFTServiceProvider contract
:::success
**Owner Only**
* add consumer
* add admin
:::

:::warning
**Consumer Role Only**
* consume credits
:::

---

## Actor
* minter
* ticket owner
    * NFTicket owner (in top up & withdraw)
    * recipient (in mint ticket)
    * receiver (in release ticket)
* ERC20 token receiver (in withdraw)
* treasury owner/master
* reseller 
* service provider

---

## Smart Contract Sequence Diagram
1. minter approve NFTReseller contract
![](https://i.imgur.com/CtPvNoy.png)

2. minter mint NFTicket to recipient
![](https://i.imgur.com/V9R4JkU.png)

3. reseller lock NFTicket
![](https://i.imgur.com/x9fV4GC.png)

4. master release NFTicket
![](https://i.imgur.com/gUnaDrs.png)

5. service provider redeem allowance
![](https://i.imgur.com/ahYb5wM.png)

6. NFTicket owner top up ticket
![](https://i.imgur.com/xHabnoq.png)

7. NFTicket owner withdraw fund to ERC20 token receiver
![](https://i.imgur.com/6cNI6xE.png)


###### tags: `NFTicket`