# ForeMarket

### factory

Returns address of factory contract

### marketConfig

Returns address of market config contract

### market

Returns market info

| Input/Output | Data Type  | Variable Name | Comment                  |
| ------------ | ---------- | ------------- | ------------------------ |
| output       | bytes32    | N/A           | marketHash               |
| output       | uint256    | N/A           | sideA                    |
| output       | uint256    | N/A           | sideB                    |
| output       | uint256    | N/A           | verifiedA                |
| output       | uint256    | N/A           | verifiedB                |
| output       | uint256    | N/A           | startPredictionTimestamp |
| output       | uint256    | N/A           | endPredictionTimestamp   |
| output       | uint256    | N/A           | marketTokenId            |
| output       | ResultType | N/A           | result                   |

### privilegeNft

Returns privlegeNft info

| Input/Output | Data Type | Variable Name | Comment            |
| ------------ | --------- | ------------- | ------------------ |
| output       | address   | N/A           | privilegeNftStaker |
| output       | uint256   | N/A           | privilegeNftId     |
| output       | bool      | N/A           | privilegeNftUsed   |

### dispute

Returns Dispute info

| Input/Output | Data Type | Variable Name | Comment        |
| ------------ | --------- | ------------- | -------------- |
| output       | address   | N/A           | disputeCreator |
| output       | bool      | N/A           | confirmed      |
| output       | bool      | N/A           | solved         |

### verifications

Returns verification info for id

| Input/Output | Data Type | Variable Name | Comment   |
| ------------ | --------- | ------------- | --------- |
| input        | uint256   | N/A           | id        |
| output       | address   | N/A           | verifier  |
| output       | uint256   | N/A           | power     |
| output       | uint256   | N/A           | tokenId   |
| output       | bool      | N/A           | side      |
| output       | bool      | N/A           | withdrawn |

### predictionsA

Returns prediction amount for side A for address

### predictionsB

Returns prediction amount for side B for address

### verificationHeigth

Verification array size

| Input/Output | Data Type | Variable Name | Comment                   |
| ------------ | --------- | ------------- | ------------------------- |
| output       | uint256   | N/A           | Verification array lenght |

### initialize

*Possible to call only via the factory*

Initialization function

| Input/Output | Data Type | Variable Name            | Comment                               |
| ------------ | --------- | ------------------------ | ------------------------------------- |
| input        | bytes32   | mHash                    | market hash                           |
| input        | address   | receiver                 | market creator nft receiver           |
| input        | uint256   | amountA                  | initial prediction for side A         |
| input        | uint256   | amountB                  | initial prediction for side B         |
| input        | uint256   | startPredictionTimestamp | Start predictions unix timestamp      |
| input        | uint256   | endPredictionTimestamp   | End predictions unix timestamp        |
| input        | uint256   | tokenId                  | market creator token id (ForeMarkets) |

### predict

Add new prediction

| Input/Output | Data Type | Variable Name | Comment                                                            |
| ------------ | --------- | ------------- | ------------------------------------------------------------------ |
| input        | uint256   | amount        | Amount of ForeToken                                                |
| input        | bool      | side          | Predicition side (true - positive result, false - negative result) |

### stakeForPrivilege

Stakes nft token for the privilege of being a verifier

| Input/Output | Data Type | Variable Name | Comment              |
| ------------ | --------- | ------------- | -------------------- |
| input        | uint256   | tokenId       | ForeVerifiers nft id |

### maxAmountToVerifyForSide

Returns the maximum value(power) available for verification

| Input/Output | Data Type | Variable Name | Comment                                            |
| ------------ | --------- | ------------- | -------------------------------------------------- |
| input        | bool      | side          | Marketd side (true - positive / false - negative); |
| output       | uint256   | N/A           | Maximum power                                      |

### verify

Verifies the side with maximum available power

| Input/Output | Data Type | Variable Name | Comment                                            |
| ------------ | --------- | ------------- | -------------------------------------------------- |
| input        | uint256   | tokenId       | ForeVerifiers token id                             |
| input        | bool      | side          | Marketd side (true - positive / false - negative); |

### openDispute

Opens a dispute, takes fee

### resolveDispute

*Only HighGuard*

Resolves Dispute

| Input/Output | Data Type | Variable Name | Comment     |
| ------------ | --------- | ------------- | ----------- |
| input        | undefined | result        | Result Type |

### closeMarket

Closes market

### calculatePredictionReward

*Returns full available amount to withdraw(Deposited fund + reward of winnings - Protocol fees)*

Returns prediction reward in ForeToken

| Input/Output | Data Type | Variable Name | Comment            |
| ------------ | --------- | ------------- | ------------------ |
| input        | address   | predictor     | Predictior address |
| output       | uint256   | N/A           | Amount to withdraw |

### withdrawPredictionReward

Withdraw prediction rewards

| Input/Output | Data Type | Variable Name | Comment           |
| ------------ | --------- | ------------- | ----------------- |
| input        | address   | predictor     | predictor address |

### withdrawVerificationReward

*Verification id*

Withdraw Verificator Reward

| Input/Output | Data Type | Variable Name  | Comment         |
| ------------ | --------- | -------------- | --------------- |
| input        | uint256   | verificationId | verification id |

### marketCreatorFeeWithdraw

Withdraws Market Creators Reward


---

# 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://docs.foreprotocol.io/documentation/developers/smart-contracts/foremarket.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.
