> For the complete documentation index, see [llms.txt](https://stoxfi.gitbook.io/stoxfi-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stoxfi.gitbook.io/stoxfi-docs/testing-and-demonstrated-functionality.md).

# Testing & Demonstrated Functionality

The StoxFi implementation has been tested through automated contract tests and demonstrated through live transactions across Robinhood Chain testnet and Ethereum Sepolia.

The automated test suite validates contract behavior and protocol invariants.

The live transactions demonstrate that shielding, confidential transfers, redemption, and collateral release operate across the deployed testnet architecture.

### Testing and Demonstration Overview

**StoxFi Testing and Demonstrated Functionality**

<figure><img src="https://2963579709-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdIccUwMy0hIW7yzdERSR%2Fuploads%2FsrpZTd6hBaaXLay0kun6%2Fstoxfi-testing-demonstrated-functionality.png?alt=media&amp;token=e484f2c4-750c-456e-b2e7-f3b825e9d582" alt=""><figcaption></figcaption></figure>

The current implementation combines automated contract testing with live cross chain demonstrations of the complete transaction lifecycle.

### Automated Testing

The current Hardhat test suite reports:

**81 passing**

**0 failing**

The complete suite executed in approximately `16` seconds.

The tests are organized across five test suites covering StoxVault, ConfidentialStock, security findings, overflow behavior, and integration behavior.

No coverage report is currently available.

For this reason, StoxFi does not claim a test coverage percentage.

### Test Environment

The automated tests use an FHEVM Hardhat mock coprocessor for confidential computation.

Cross chain behavior in the automated suite is simulated using `MockCCIPRouter`.

The live CCIP infrastructure is therefore demonstrated through deployed testnet transactions rather than through the local unit test environment.

### Tested Security and Protocol Behavior

The automated testing covers protections against:

1. Forged cross chain messages
2. Incorrect source chains
3. Incorrect message senders
4. Message replay
5. Unauthorized confidential transfers
6. Double spending during redemption
7. Forged decryption results
8. Redemption replay
9. Encrypted underflow
10. Encrypted overflow
11. Cross collateral drain attempts
12. Fee on transfer undercollateralization
13. Reentrancy
14. Storage griefing

The tests also validate behavior associated with the immutable contract architecture.

### Verified Protocol Invariants

Testing verifies five principal protocol invariants.

#### Collateral Relationship

The locked underlying collateral corresponds to the live confidential representation according to the configured decimal conversion rate.

`lockedOf[stock] = live confidential supply × rate`

#### Peer Isolation

Each confidential stock is associated with its own underlying collateral relationship.

One confidential asset cannot release collateral belonging to another asset.

#### Burn Before Release

Confidential value is burned before the corresponding underlying collateral can be released.

This prevents a position from remaining spendable while redemption is pending.

#### No Encrypted Underflow

Confidential transfers do not subtract more encrypted value than the sender can provide.

#### Holder Balance Access

The holder can decrypt their own confidential balance while public observers cannot.

### Live Testnet Demonstration

The complete StoxFi lifecycle has also been demonstrated using deployed contracts on Robinhood Chain testnet and Ethereum Sepolia.

The demonstrated sequence includes:

1. Shielding an underlying test token
2. Creating the corresponding confidential balance
3. Transferring confidential value between addresses
4. Requesting redemption
5. Verifying the decrypted redemption amount
6. Sending the release instruction
7. Releasing the underlying collateral

### Demonstrated Shield

A verified shield transaction deposited:

`2,000` tokens

The underlying amount was:

`2000 × 10^18`

The transaction occurred on Robinhood Chain testnet.

#### Transaction

Hash:

`0xbae23791717161e586650d05fa4a7430f3bd3fb5838625a2f6c3ddbe904872db`

Block:

`108279513`

Timestamp:

`2026 08 27 15:34:12 UTC`

Gas used:

`394,817`

Transaction fee:

`0.00454 ETH`

The resulting confidential amount was:

`2,000,000,000`

The corresponding CCIP message identifier was:

`0xe79764ac11d37ea94bbb2ab6c737b6827caf16e26173b4c547d88ac6a8390ba9`

This transaction demonstrates the public entry side of the StoxFi lifecycle.

### Demonstrated Confidential Transfer

A confidential transfer was then executed on Ethereum Sepolia.

#### Transaction

Hash:

`0x7d9dc8a37a4c9b0a9e62beffeb4b437205dcb711fcaf47819671a1de2e3fe5ae`

Block:

`11578894`

Timestamp:

`2026 08 27 16:05:24 UTC`

Gas used:

`541,331`

The transaction called cNVDA and contained `778` bytes of calldata.

The transaction emitted:

`ConfidentialTransfer(from, to)`

The sender and recipient were present.

The transfer amount was not present in the event.

The transaction also produced `10` coprocessor logs and `7` access control logs.

This transaction provides direct evidence of the confidential transfer behavior implemented by StoxFi.

The interaction is visible.

The participant addresses are visible.

The transfer amount is not exposed in the event.

### Demonstrated Redemption

A redemption was finalized on Ethereum Sepolia.

#### Transaction

Hash:

`0x898912ddd1a1355a3ebdf7056a75b6d677130ce0941c480bd442716d8b37daed`

Block:

`11578905`

Timestamp:

`2026 08 27 16:07:36 UTC`

Redemption request:

`1`

Clear amount:

`500,000,000`

This corresponds to:

`500` underlying tokens

The transaction carried a `914` byte decryption proof.

Gas used:

`668,155`

The corresponding CCIP message identifier was:

`0x36d86222161434cc4342a7a7c7e0aca2bae82afa218dcfe12ba80d1d6387144e`

This transaction demonstrates verification of the publicly decrypted redemption value and dispatch of the collateral release instruction.

### Demonstrated Collateral Release

Release events on Robinhood Chain show three completed releases.

The demonstrated releases were:

`500` tokens to the deploying address

`500` tokens to a second address

`500` tokens to the same second address

The demonstrated lifecycle therefore included:

`2,000` tokens shielded

followed by confidential transfer activity

followed by

`1,500` tokens released across three redemptions

The second address received and later redeemed confidential value that originated through an encrypted transfer.

This demonstrates that the confidential transfer moved redeemable value rather than only producing a transfer event.

### Demonstrated Capabilities

The deployed testnet implementation has demonstrated:

| Capability                       | Demonstrated |
| -------------------------------- | ------------ |
| Underlying collateral deposit    | Yes          |
| Decimal conversion               | Yes          |
| Cross chain shield instruction   | Yes          |
| Confidential balance creation    | Yes          |
| Confidential transfer            | Yes          |
| Transfer event without amount    | Yes          |
| Redemption request               | Yes          |
| Burn before release              | Yes          |
| Public redemption decryption     | Yes          |
| Decryption proof verification    | Yes          |
| Cross chain release instruction  | Yes          |
| Underlying collateral release    | Yes          |
| Multiple independent redemptions | Yes          |

### Testing Boundary

The automated tests and live transactions demonstrate different parts of the implementation.

The automated suite uses mock infrastructure for FHE computation and CCIP behavior.

The deployed transactions demonstrate interaction with the live testnet infrastructure.

The current evidence therefore consists of both contract level testing and end to end testnet execution.

### Audit and Testing Are Separate

Automated testing should not be treated as a substitute for an independent security audit.

The current contracts have undergone an internal security review, with both identified Medium findings fixed in the deployed bytecode.

A third party audit has not yet been completed.

The implementation status is therefore supported by automated testing and live testnet demonstration while independent external security review remains pending.

### Demonstrated Functionality Summary

StoxFi has demonstrated the complete transaction lifecycle on test networks.

A public underlying asset was deposited into StoxVault.

A confidential representation was created on Ethereum.

Confidential value was transferred between addresses without an amount field appearing in the transfer event.

Encrypted value was burned for redemption.

The decrypted amount was verified.

A return cross chain instruction was sent.

The corresponding underlying collateral was released on Robinhood Chain.

Together with the automated test suite, these transactions demonstrate the current functionality of the StoxFi implementation.


---

# 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://stoxfi.gitbook.io/stoxfi-docs/testing-and-demonstrated-functionality.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.
