# Overview

## Deployed Contracts

{% tabs %}
{% tab title="Mainnet" %}

| Contract     | Address and ABI's                          |
| ------------ | ------------------------------------------ |
| PHRO Token   | 0xD49d31402723a885e5272903b7C02e8Dd571Ea36 |
| {% endtab %} |                                            |

{% tab title="PGN" %}

{% endtab %}

{% tab title="Optimism" %}

{% endtab %}

{% tab title="Sepolia" %}

| Contracts    | Address and ABI's |
| ------------ | ----------------- |
| PHRO Token   | 0x...             |
| {% endtab %} |                   |

{% tab title="PGN-Sepolia" %}

{% endtab %}
{% endtabs %}

## Audits

## Methods

Besides the standard ERC20 token features (`transfer()`, `balanceOf()`, `allowance()`, etc.), the following features are also available.

### permit()

`function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external`

Allows a use to permit another account (or contract) to use their funds using a signed message. This enables gas-less transactions and single approval/transfer transactions.

| Parameter  | Type    | Description                                                                            |
| ---------- | ------- | -------------------------------------------------------------------------------------- |
| `owner`    | address | The owner of the funds                                                                 |
| `spender`  | address | The spender of the funds                                                               |
| `value`    | uint256 | The amount the `spender` is permitted to use                                           |
| `deadline` | uint256 | The deadline timestamp that the permit is valid. Use `type(uint).max` for no deadline. |
| `v`        | uint8   | Signature parameter                                                                    |
| `r`        | bytes32 | Signature parameter                                                                    |
| `s`        | bytes32 | Signature parameter                                                                    |

{% tabs %}
{% tab title="web3.js" %}

```javascript
import { signTypedData_v4 } from 'eth-sig-util'
import { fromRpcSig } from 'ethereumjs-util'

// ... other imports

import PHROTokenAbi from "./PHROTokenAbi.json"

// ... setup your web3 provider

const phroTokenAddress = "PHRO_TOKEN_ADDRESS"
const phroTokenContract = new web3.eth.Contract(PHROTokenAbi, phroTokenAddress)

const privateKey = "YOUR_PRIVATE_KEY_WITHOUT_0x"
const chainId = 1
const owner = "OWNER_ADDRESS"
const spender = "SPENDER_ADDRESS"
const value = 100 // Amount the spender is permitted
const nonce = 1 // The next valid nonce, use `_nonces()`
const deadline = 1600093162

const permitParams = {
  types: {
    EIP712Domain: [
      { name: "name", type: "string" },
      { name: "version", type: "string" },
      { name: "chainId", type: "uint256" },
      { name: "verifyingContract", type: "address" },
    ],
    Permit: [
      { name: "owner", type: "address" },
      { name: "spender", type: "address" },
      { name: "value", type: "uint256" },
      { name: "nonce", type: "uint256" },
      { name: "deadline", type: "uint256" },
    ],
  },
  primaryType: "Permit",
  domain: {
    name: "Pharo Token",
    version: "1",
    chainId: chainId,
    verifyingContract: phroTokenAddress,
  },
  message: {
    owner,
    spender,
    value,
    nonce,
    deadline,
  },
}

const signature = signTypedData_v4(
  Buffer.from(privateKey, "hex"),
  { data: permitParams }
)

const { v, r, s } = fromRpcSig(signature)

await phroTokenContract.methods
    .permit({
      owner,
      spender,
      value,
      deadline,
      v,
      r,
      s
    })
    .send()
    .catch((e) => {
        throw Error(`Error permitting: ${e.message}`)
    }) 
```

{% endtab %}

{% tab title="ethers.js" %}

{% endtab %}
{% endtabs %}

### \_nonces()

`function _nonces(address owner) public`

Returns the next valid nonce to submit when calling `permit()`

### lock()

`function lock(bytes32 _reason, uint256 _amount, uint256 _time) public`

Locks a specified amount of tokens against an address, for a specified time and reason.

### transferWithLock()

`function transferWithLock(address _to, bytes32 _reason, uint256 _amount, uint256 _time)`

Transfers and locks a specified amount of tokens for an address, for a specified time and reason.

### tokensLocked()

`function tokensLocked(address _of, bytes32 _reason) public`

Returns the tokens locked for a specified address for a specified reason.

### tokensLockedAtTime()

`function tokensLockedAtTime(address _of, bytes32 _reason, uint256 _time) public`

Returns tokens locked for a specified address, for a specified reason at a specific time.

### totalBalanceOf()

`function totalBalanceOf(address _of, bytes32 _reason) public`

Returns the total tokens held by an address (locked and unlocked).

### extendLock()

`function extendLock(bytes32 _reason, uint256 _time) public`

Extends the lock for a specified reason and time.

### increaseLockAmount()

`function increaseLockAmount(bytes32 _reason, uint256 _amount) public`

Increase the number of tokens locked for an address, for a specified reason.

### tokensUnlockable()

`function tokensUnlockable(address _of, bytes32 _reason) public`

Returns unlockable tokens for a specified address, for a specified reason.

### unlock()

`function unlock(address _of) public onlyOwner`

Unlocks the unlockable tokens of a specified address.

### getUnlockableTokens()

`function getUnlockableTokens(address _of) public`

Gets the unlockable tokens of a specified address.


---

# 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.pharo.tech/phro-token/overview.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.
