> For the complete documentation index, see [llms.txt](https://triple-plus-global.gitbook.io/tpt-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://triple-plus-global.gitbook.io/tpt-whitepaper/protocol-mechanics/smart-contracts.md).

# Smart Contracts

All capital flows through audited smart contracts with no centralized custody:

{% @mermaid/diagram content="sequenceDiagram
participant S as Seller
participant E as Escrow Contract
participant I as Investor
participant D as Debtor
participant O as Oracle

```
S->>E: Submit verified asset
I->>E: Deposit investment
E->>S: Release funds (immediate)
Note over E: Asset held in escrow
D->>E: Pay invoice at maturity
O->>E: Confirm payment received
E->>I: Release principal + yield" %}
```

## Escrow Mechanism

The escrow contract holds:

| Item                       | Description                                |
| -------------------------- | ------------------------------------------ |
| **Asset ownership rights** | Tokenized representation of the receivable |
| **Investor capital**       | Held until released to seller              |
| **Debtor payments**        | Held until distributed to investors        |

**No party—including the protocol team—can unilaterally access escrowed funds.**

## Settlement Triggers

Automated settlement occurs when:

* Debtor payment confirmed (via oracle or direct deposit)
* Maturity date reached
* All conditions in smart contract satisfied

Manual intervention is only possible through governance for exceptional circumstances (e.g., dispute resolution).

## Contract Architecture

{% @mermaid/diagram content="flowchart TB
subgraph Core\["Core Contracts"]
ESC\["Escrow"]
SET\["Settlement"]
REG\["Registry"]
end

```
subgraph Access["Access Control"]
    STAKE["Staking"]
    KYC["KYC/KYB"]
end

subgraph Assets["Asset Contracts"]
    INV["Invoice NFT"]
    PO["PO NFT"]
end

Access --> Core
Assets --> Core" %}
```

## Upgrade Mechanism

Contracts use a transparent proxy pattern:

| Feature                | Description                            |
| ---------------------- | -------------------------------------- |
| **Multi-sig approval** | Upgrades require multiple signatures   |
| **Time-lock delay**    | Waiting period on all upgrades         |
| **Emergency pause**    | Halt functionality for critical issues |

## Audit Status

All smart contracts undergo:

* Pre-deployment third-party audits
* Ongoing bug bounty program
* Formal verification for critical functions

{% hint style="warning" %}
Audit reports will be linked here upon completion.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://triple-plus-global.gitbook.io/tpt-whitepaper/protocol-mechanics/smart-contracts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
