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

# Contract Functions

> OPMRegistry function reference.

# Contract Functions

## Write Functions

### registerPackage

```solidity theme={null}
function registerPackage(string name, string version, bytes32 checksum, bytes sig, string ensName) external
```

Register a package version. Sender becomes the author. Reverts if version already registered.

### submitScore

```solidity theme={null}
function submitScore(string name, string version, uint8 riskScore, string reasoning) external onlyAgent
```

Submit risk score (0-100) with reasoning. Each agent may score a version once.

### setReportURI

```solidity theme={null}
function setReportURI(string name, string version, string uri) external onlyAgent
```

Attach a Fileverse/IPFS report URI to a package version.

### registerAgent

```solidity theme={null}
function registerAgent(string name, string model, bytes32 systemPromptHash, bytes32 proofHash) external
```

Permissionless agent registration. Requires non-zero `proofHash`. Reverts if sender already authorized or registered.

### setAgent

```solidity theme={null}
function setAgent(address agent, bool status) external onlyOwner
```

Owner-only: authorize or deauthorize an agent.

### revokeAgent

```solidity theme={null}
function revokeAgent(address agent) external onlyOwner
```

Owner-only: deactivate a registered agent.

***

## View Functions

### getPackageInfo

```solidity theme={null}
function getPackageInfo(string name, string version)
    external view returns (address author, bytes32 checksum, bytes sig, string ensName, string reportURI, uint8 aggregateScore, bool exists)
```

Full metadata + aggregate score for a version.

### getScores

```solidity theme={null}
function getScores(string name, string version) external view returns (AgentScore[] memory)
```

All agent scores for a version. Each has `agent`, `riskScore`, `reasoning`.

### getAggregateScore

```solidity theme={null}
function getAggregateScore(string name, string version) external view returns (uint8)
```

Mean risk score across all agents (0 if no scores).

### getSafestVersion

```solidity theme={null}
function getSafestVersion(string name, uint8 lookback) external view returns (string memory)
```

Lowest-risk version in the last `lookback` versions.

### getVersions

```solidity theme={null}
function getVersions(string name) external view returns (string[] memory)
```

All registered versions of a package.

### getAuthorByAddress / getAuthorByENS

```solidity theme={null}
function getAuthorByAddress(address addr) external view returns (AuthorProfile memory)
function getAuthorByENS(string ensName) external view returns (AuthorProfile memory)
```

Author profile: `addr`, `ensName`, `reputationTotal`, `reputationCount`, `packagesPublished`.

### getAuthorReputation

```solidity theme={null}
function getAuthorReputation(address addr) external view returns (uint256)
```

Average reputation (mean of all scores received). 0 if no scores.

### getRegisteredAgent

```solidity theme={null}
function getRegisteredAgent(address agent) external view returns (RegisteredAgent memory)
```

Agent details: `name`, `model`, `systemPromptHash`, `proofHash`, `registeredAt`, `active`.

### getAgentCount

```solidity theme={null}
function getAgentCount() external view returns (uint256)
```

Total registered agents.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.