> ## Documentation Index
> Fetch the complete documentation index at: https://docs.signalarc.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# ONCHAIN INTEGRATION

# Onchain Integration

SignalArc currently references an Arc Testnet `SignalArcMarket` deployment and includes frontend browser-wallet transaction wiring in the current working tree. This is prototype/testnet behavior only.

## Network

| Field                            | Value                                        |
| -------------------------------- | -------------------------------------------- |
| Network                          | Arc Testnet                                  |
| Chain ID                         | `5042002`                                    |
| RPC URL                          | `https://rpc.testnet.arc.network`            |
| Explorer                         | `https://testnet.arcscan.app`                |
| Arc Testnet USDC ERC20 interface | `0x3600000000000000000000000000000000000000` |

## Deployed Contracts

| Contract          | Address                                      | Status                           |
| ----------------- | -------------------------------------------- | -------------------------------- |
| `SignalArcMarket` | `0xf4ccc11A9e24fb996679F946C23C04AFd2797F26` | Arc Testnet prototype reference. |

Arcscan:

* Contract: [https://testnet.arcscan.app/address/0xf4ccc11A9e24fb996679F946C23C04AFd2797F26](https://testnet.arcscan.app/address/0xf4ccc11A9e24fb996679F946C23C04AFd2797F26)

## Contract Functions

Verified from `contracts/src/SignalArcMarket.sol` and contract tests:

| Function                                    | Type  | Notes                                                              |
| ------------------------------------------- | ----- | ------------------------------------------------------------------ |
| `isOpen()`                                  | View  | Returns whether status is open and close timestamp has not passed. |
| `openPosition(Outcome side,uint256 amount)` | Write | Transfers collateral from caller and records YES/NO position.      |
| `claimableAmount(address user)`             | View  | Returns claimable payout or refund amount.                         |
| `claim()`                                   | Write | Claims payout after resolution or refund after cancellation.       |
| `closeMarket()`                             | Write | Closes after close timestamp.                                      |
| `cancelMarket()`                            | Write | Resolver-only cancellation.                                        |
| `resolve(Outcome winningOutcome_)`          | Write | Resolver-only resolution after close.                              |

Public state getters are also generated by Solidity for fields such as `question`, `closeTimestamp`, `resolver`, `collateralToken`, `status`, `winningOutcome`, `yesPositions`, `noPositions`, `hasClaimed`, `totalYes`, `totalNo`, and `totalCollateral`.

## Frontend-Used Functions

The current frontend uses:

| Contract                         | Function                      |
| -------------------------------- | ----------------------------- |
| Arc Testnet USDC ERC20 interface | `approve(address,uint256)`    |
| `SignalArcMarket`                | `isOpen()`                    |
| `SignalArcMarket`                | `openPosition(uint8,uint256)` |

## Outcome Mapping

The contract enum is:

| Solidity enum  | Numeric value |
| -------------- | ------------- |
| `Outcome.None` | `0`           |
| `Outcome.Yes`  | `1`           |
| `Outcome.No`   | `2`           |

Frontend mapping:

| UI outcome | Contract value |
| ---------- | -------------- |
| YES        | `1`            |
| NO         | `2`            |

## USDC Decimals

The project state records Arc Testnet USDC ERC20 interface behavior as 6 decimals. The test-only `MockUSDC` also uses 6 decimals.

```text theme={null}
1 USDC = 1000000 base units
```

## Browser Transaction Flow

When the wallet is connected to Arc Testnet and the market is open:

1. Parse the user-entered USDC amount with 6 decimals.
2. Submit `approve(SignalArcMarket, amount)` to the Arc Testnet USDC ERC20 interface.
3. Wait for the approval receipt.
4. Submit `openPosition(outcome, amount)` to `SignalArcMarket`.
5. Wait for the open-position receipt.
6. Show Arcscan transaction links.

## Backend Contract Metadata

The backend exposes local/testnet metadata at `GET /arc/contract`. The response marks the deployment as a prototype and `production_approved: false`.

## Explicit Limitations

* Prototype/testnet only.
* Not audited.
* Not production custody.
* Not production settlement.
* No Arc mainnet deployment.
* No Circle production wallet or custody integration.
* No oracle integration.
* No dispute flow.
* Payout behavior is fixed 1:1 in the prototype contract.
* Resolver is a single address.
* Any Arc or Circle behavior not implemented or not documented in official sources is unknown / not documented.
