> For the complete documentation index, see [llms.txt](https://apriori-docs.gitbook.io/apriori-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apriori-docs.gitbook.io/apriori-docs/aprmon/smart-contract-integration.md).

# Smart Contract Integration

## Overview

This guide is intended for developers integrating with aPriori’s liquid staking protocol.

#### aprMON - Reward Bearing LST

aprMON is a reward-bearing liquid staking token. This means that it does not automatically adjust the number of tokens in circulation. Instead, the token’s value increases as rewards are generated. When you hold a reward-bearing token, you maintain the same number of tokens in your wallet, but the value of those tokens increases over time as the staking rewards accumulate.

## Smart Contract Integration

### Contract Addresses

#### Mainnet

aprMON: 0x0c65A0BC65a5D819235B71F554D210D3F80E0852

### ABIs

aprMON vault contract:

{% code expandable="true" %}

```json
[
    { "type": "constructor", "inputs": [], "stateMutability": "nonpayable" },
    { "type": "receive", "stateMutability": "payable" },
    {
      "type": "function",
      "name": "DOMAIN_SEPARATOR",
      "inputs": [],
      "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "DUST_THRESHOLD",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "MIN_SHARE_SUPPLY",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "allowance",
      "inputs": [
        { "name": "owner", "type": "address", "internalType": "address" },
        { "name": "spender", "type": "address", "internalType": "address" }
      ],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "approve",
      "inputs": [
        { "name": "spender", "type": "address", "internalType": "address" },
        { "name": "value", "type": "uint256", "internalType": "uint256" }
      ],
      "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "asset",
      "inputs": [],
      "outputs": [{ "name": "assetTokenAddress", "type": "address", "internalType": "address" }],
      "stateMutability": "pure"
    },
    {
      "type": "function",
      "name": "balanceOf",
      "inputs": [{ "name": "account", "type": "address", "internalType": "address" }],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "burnableShares",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    { "type": "function", "name": "claimProtocolFees", "inputs": [], "outputs": [], "stateMutability": "nonpayable" },
    {
      "type": "function",
      "name": "claimValidatorRewards",
      "inputs": [
        { "name": "start", "type": "uint256", "internalType": "uint256" },
        { "name": "limit", "type": "uint256", "internalType": "uint256" },
        { "name": "_totalWithdrawalAmount", "type": "uint256", "internalType": "uint256" },
        { "name": "_totalBurnableShares", "type": "uint256", "internalType": "uint256" },
        { "name": "_nextRequestId", "type": "uint256", "internalType": "uint256" },
        { "name": "_pendingDeposit", "type": "uint256", "internalType": "uint256" },
        { "name": "_blockNumber", "type": "uint256", "internalType": "uint256" },
        { "name": "_rebalanceNeeded", "type": "bool", "internalType": "bool" }
      ],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "claimableRedeemRequest",
      "inputs": [
        { "name": "requestId", "type": "uint256", "internalType": "uint256" },
        { "name": "controller", "type": "address", "internalType": "address" }
      ],
      "outputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "convertToAssets",
      "inputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "assets", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "convertToShares",
      "inputs": [{ "name": "assets", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "currentWithdrawalBatchId",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    { "type": "function", "name": "decimals", "inputs": [], "outputs": [{ "name": "", "type": "uint8", "internalType": "uint8" }], "stateMutability": "view" },
    {
      "type": "function",
      "name": "deposit",
      "inputs": [
        { "name": "assets", "type": "uint256", "internalType": "uint256" },
        { "name": "receiver", "type": "address", "internalType": "address" }
      ],
      "outputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "payable"
    },
    {
      "type": "function",
      "name": "eip712Domain",
      "inputs": [],
      "outputs": [
        { "name": "fields", "type": "bytes1", "internalType": "bytes1" },
        { "name": "name", "type": "string", "internalType": "string" },
        { "name": "version", "type": "string", "internalType": "string" },
        { "name": "chainId", "type": "uint256", "internalType": "uint256" },
        { "name": "verifyingContract", "type": "address", "internalType": "address" },
        { "name": "salt", "type": "bytes32", "internalType": "bytes32" },
        { "name": "extensions", "type": "uint256[]", "internalType": "uint256[]" }
      ],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "epochLength",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "feeVault",
      "inputs": [],
      "outputs": [{ "name": "", "type": "address", "internalType": "address" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "getPendingWithdrawalAmounts",
      "inputs": [{ "name": "batchSize", "type": "uint256", "internalType": "uint256" }],
      "outputs": [
        { "name": "_totalWithdrawalAmount", "type": "uint256", "internalType": "uint256" },
        { "name": "_totalBurnableShares", "type": "uint256", "internalType": "uint256" },
        { "name": "_nextRequestId", "type": "uint256", "internalType": "uint256" },
        { "name": "_pendingDeposit", "type": "uint256", "internalType": "uint256" },
        { "name": "_blockNumber", "type": "uint256", "internalType": "uint256" }
      ],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "getUserRequestData",
      "inputs": [
        { "name": "user", "type": "address", "internalType": "address" },
        { "name": "startIndex", "type": "uint256", "internalType": "uint256" },
        { "name": "pageSize", "type": "uint256", "internalType": "uint256" }
      ],
      "outputs": [
        {
          "name": "requestData",
          "type": "tuple[]",
          "internalType": "struct aprMON.RequestData[]",
          "components": [
            { "name": "id", "type": "uint256", "internalType": "uint256" },
            { "name": "claimed", "type": "bool", "internalType": "bool" },
            { "name": "claimable", "type": "bool", "internalType": "bool" },
            { "name": "shares", "type": "uint256", "internalType": "uint256" },
            { "name": "assets", "type": "uint256", "internalType": "uint256" },
            { "name": "timestamp", "type": "uint256", "internalType": "uint256" },
            { "name": "unlockEpoch", "type": "uint64", "internalType": "uint64" }
          ]
        }
      ],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "getUserRequestDataCount",
      "inputs": [{ "name": "user", "type": "address", "internalType": "address" }],
      "outputs": [{ "name": "count", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "initialize",
      "inputs": [
        { "name": "_validatorsRegistry", "type": "address", "internalType": "address" },
        { "name": "_stakePrecompile", "type": "address", "internalType": "address payable" },
        { "name": "_feeVault", "type": "address", "internalType": "address" },
        { "name": "_owner", "type": "address", "internalType": "address" },
        { "name": "_minimumRedeem", "type": "uint256", "internalType": "uint256" },
        { "name": "_withdrawalFee", "type": "uint256", "internalType": "uint256" },
        { "name": "_rewardFee", "type": "uint8", "internalType": "uint8" },
        { "name": "_epochLength", "type": "uint256", "internalType": "uint256" },
        { "name": "_withdrawalDelay", "type": "uint64", "internalType": "uint64" }
      ],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "isOperator",
      "inputs": [
        { "name": "controller", "type": "address", "internalType": "address" },
        { "name": "operator", "type": "address", "internalType": "address" }
      ],
      "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "lastProcessedBlockNumber",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "lastProcessedRequestId",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "lastProcessedWithdrawalBatchId",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "latestUpdateBlockNumber",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "maxDeposit",
      "inputs": [{ "name": "receiver", "type": "address", "internalType": "address" }],
      "outputs": [{ "name": "maxAssets", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "pure"
    },
    {
      "type": "function",
      "name": "maxMint",
      "inputs": [{ "name": "receiver", "type": "address", "internalType": "address" }],
      "outputs": [{ "name": "maxShares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "pure"
    },
    {
      "type": "function",
      "name": "maxRedeem",
      "inputs": [{ "name": "owner", "type": "address", "internalType": "address" }],
      "outputs": [{ "name": "maxShares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "maxWithdraw",
      "inputs": [{ "name": "owner", "type": "address", "internalType": "address" }],
      "outputs": [{ "name": "maxAssets", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "midUpdateAdjustment",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "minimumRedeem",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "mint",
      "inputs": [
        { "name": "shares", "type": "uint256", "internalType": "uint256" },
        { "name": "receiver", "type": "address", "internalType": "address" }
      ],
      "outputs": [{ "name": "assets", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "payable"
    },
    { "type": "function", "name": "name", "inputs": [], "outputs": [{ "name": "", "type": "string", "internalType": "string" }], "stateMutability": "view" },
    {
      "type": "function",
      "name": "nextRequestId",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "nonces",
      "inputs": [{ "name": "owner", "type": "address", "internalType": "address" }],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "oracleOperator",
      "inputs": [],
      "outputs": [{ "name": "", "type": "address", "internalType": "address" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "oracleParams",
      "inputs": [],
      "outputs": [
        { "name": "totalWithdrawalAmount", "type": "uint256", "internalType": "uint256" },
        { "name": "totalBurnableShares", "type": "uint256", "internalType": "uint256" },
        { "name": "nextRequestId", "type": "uint256", "internalType": "uint256" },
        { "name": "pendingDeposit", "type": "uint256", "internalType": "uint256" },
        { "name": "blockNumber", "type": "uint256", "internalType": "uint256" },
        { "name": "rebalanceNeeded", "type": "bool", "internalType": "bool" }
      ],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "oracleUpdateTracking",
      "inputs": [
        { "name": "", "type": "uint8", "internalType": "enum aprMON.OracleTxType" },
        { "name": "", "type": "uint256", "internalType": "uint256" }
      ],
      "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
      "stateMutability": "view"
    },
    { "type": "function", "name": "owner", "inputs": [], "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" },
    { "type": "function", "name": "pause", "inputs": [], "outputs": [], "stateMutability": "nonpayable" },
    { "type": "function", "name": "paused", "inputs": [], "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], "stateMutability": "view" },
    {
      "type": "function",
      "name": "pendingRedeemRequest",
      "inputs": [
        { "name": "requestId", "type": "uint256", "internalType": "uint256" },
        { "name": "controller", "type": "address", "internalType": "address" }
      ],
      "outputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "permit",
      "inputs": [
        { "name": "owner", "type": "address", "internalType": "address" },
        { "name": "spender", "type": "address", "internalType": "address" },
        { "name": "value", "type": "uint256", "internalType": "uint256" },
        { "name": "deadline", "type": "uint256", "internalType": "uint256" },
        { "name": "v", "type": "uint8", "internalType": "uint8" },
        { "name": "r", "type": "bytes32", "internalType": "bytes32" },
        { "name": "s", "type": "bytes32", "internalType": "bytes32" }
      ],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "previewDeposit",
      "inputs": [{ "name": "assets", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "previewMint",
      "inputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "assets", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "previewRedeem",
      "inputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "assets", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "previewWithdraw",
      "inputs": [{ "name": "assets", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "shares", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "processDepositsAndWithdrawals",
      "inputs": [{ "name": "start", "type": "uint256", "internalType": "uint256" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "rebalanceBatchId",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "rebalanceBatchWithdrawn",
      "inputs": [],
      "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "rebalanceDelegate",
      "inputs": [{ "name": "start", "type": "uint256", "internalType": "uint256" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "rebalanceInProgress",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "rebalanceUndelegate",
      "inputs": [{ "name": "start", "type": "uint256", "internalType": "uint256" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "redeem",
      "inputs": [
        { "name": "requestIDs", "type": "uint256[]", "internalType": "uint256[]" },
        { "name": "receiver", "type": "address", "internalType": "address" }
      ],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    { "type": "function", "name": "renounceOwnership", "inputs": [], "outputs": [], "stateMutability": "nonpayable" },
    {
      "type": "function",
      "name": "requestRedeem",
      "inputs": [
        { "name": "shares", "type": "uint256", "internalType": "uint256" },
        { "name": "controller", "type": "address", "internalType": "address" },
        { "name": "owner", "type": "address", "internalType": "address" }
      ],
      "outputs": [{ "name": "requestId", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "nonpayable"
    },
    { "type": "function", "name": "rewardFee", "inputs": [], "outputs": [{ "name": "", "type": "uint8", "internalType": "uint8" }], "stateMutability": "view" },
    {
      "type": "function",
      "name": "rewardFeesAccumulated",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "rewardsDistributing",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "setEpochLength",
      "inputs": [{ "name": "_epochLength", "type": "uint256", "internalType": "uint256" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setFeeVault",
      "inputs": [{ "name": "_feeVault", "type": "address", "internalType": "address" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setMinimumRedeem",
      "inputs": [{ "name": "_minimumRedeem", "type": "uint256", "internalType": "uint256" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setOperator",
      "inputs": [
        { "name": "operator", "type": "address", "internalType": "address" },
        { "name": "approved", "type": "bool", "internalType": "bool" }
      ],
      "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setOracleOperator",
      "inputs": [{ "name": "_oracleOperator", "type": "address", "internalType": "address" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setRewardFee",
      "inputs": [{ "name": "_rewardFee", "type": "uint8", "internalType": "uint8" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setStakePrecompile",
      "inputs": [{ "name": "_stakePrecompile", "type": "address", "internalType": "address payable" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setValidatorsRegistry",
      "inputs": [{ "name": "_validatorsRegistry", "type": "address", "internalType": "address" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setWithdrawalDelay",
      "inputs": [{ "name": "_withdrawalDelay", "type": "uint64", "internalType": "uint64" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "setWithdrawalFee",
      "inputs": [{ "name": "_withdrawalFee", "type": "uint256", "internalType": "uint256" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "stakePrecompile",
      "inputs": [],
      "outputs": [{ "name": "", "type": "address", "internalType": "address payable" }],
      "stateMutability": "view"
    },
    { "type": "function", "name": "symbol", "inputs": [], "outputs": [{ "name": "", "type": "string", "internalType": "string" }], "stateMutability": "view" },
    {
      "type": "function",
      "name": "totalAssets",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "totalPendingDeposit",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "totalStaked",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "totalSupply",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "transfer",
      "inputs": [
        { "name": "to", "type": "address", "internalType": "address" },
        { "name": "value", "type": "uint256", "internalType": "uint256" }
      ],
      "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "transferFrom",
      "inputs": [
        { "name": "from", "type": "address", "internalType": "address" },
        { "name": "to", "type": "address", "internalType": "address" },
        { "name": "value", "type": "uint256", "internalType": "uint256" }
      ],
      "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "transferOwnership",
      "inputs": [{ "name": "newOwner", "type": "address", "internalType": "address" }],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    { "type": "function", "name": "unpause", "inputs": [], "outputs": [], "stateMutability": "nonpayable" },
    {
      "type": "function",
      "name": "updateOracleData",
      "inputs": [
        { "name": "_blockNumber", "type": "uint256", "internalType": "uint256" },
        { "name": "_pendingDepositUtilisedForWithdrawals", "type": "uint256", "internalType": "uint256" },
        { "name": "_rewardsAfterProcessingWithdrawals", "type": "uint256", "internalType": "uint256" },
        { "name": "_totalStaked", "type": "uint256", "internalType": "uint256" },
        { "name": "_burnableShares", "type": "uint256", "internalType": "uint256" },
        { "name": "_lastProcessedRequestId", "type": "uint256", "internalType": "uint256" },
        { "name": "_rewardFees", "type": "uint256", "internalType": "uint256" }
      ],
      "outputs": [],
      "stateMutability": "nonpayable"
    },
    {
      "type": "function",
      "name": "validatorBatchIndices",
      "inputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "validatorsRegistry",
      "inputs": [],
      "outputs": [{ "name": "", "type": "address", "internalType": "address" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "viewRedeemRequest",
      "inputs": [{ "name": "requestId", "type": "uint256", "internalType": "uint256" }],
      "outputs": [
        {
          "name": "redeemRequest",
          "type": "tuple",
          "internalType": "struct aprMON.RequestData",
          "components": [
            { "name": "id", "type": "uint256", "internalType": "uint256" },
            { "name": "claimed", "type": "bool", "internalType": "bool" },
            { "name": "claimable", "type": "bool", "internalType": "bool" },
            { "name": "shares", "type": "uint256", "internalType": "uint256" },
            { "name": "assets", "type": "uint256", "internalType": "uint256" },
            { "name": "timestamp", "type": "uint256", "internalType": "uint256" },
            { "name": "unlockEpoch", "type": "uint64", "internalType": "uint64" }
          ]
        }
      ],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "withdrawalBatchUnlockEpochs",
      "inputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "outputs": [{ "name": "", "type": "uint64", "internalType": "uint64" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "withdrawalDelay",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint64", "internalType": "uint64" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "withdrawalFee",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "function",
      "name": "withdrawalFeesAccumulated",
      "inputs": [],
      "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
      "stateMutability": "view"
    },
    {
      "type": "event",
      "name": "Approval",
      "inputs": [
        { "name": "owner", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "spender", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "ClaimedProtocolFees",
      "inputs": [
        { "name": "rewardFees", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "withdrawalFees", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "Deposit",
      "inputs": [
        { "name": "sender", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "owner", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "assets", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "shares", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    { "type": "event", "name": "EIP712DomainChanged", "inputs": [], "anonymous": false },
    {
      "type": "event",
      "name": "EpochLengthUpdated",
      "inputs": [{ "name": "epochLength", "type": "uint256", "indexed": false, "internalType": "uint256" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "EpochRewardsUpdated",
      "inputs": [
        { "name": "blockNumber", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "rewardsDistributing", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "FeeVaultUpdated",
      "inputs": [{ "name": "protocolFeeVault", "type": "address", "indexed": false, "internalType": "address" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "Initialized",
      "inputs": [{ "name": "version", "type": "uint64", "indexed": false, "internalType": "uint64" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "MinimumRedeemUpdated",
      "inputs": [{ "name": "minimumRedeem", "type": "uint256", "indexed": false, "internalType": "uint256" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "OperatorSet",
      "inputs": [
        { "name": "controller", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "operator", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "approved", "type": "bool", "indexed": false, "internalType": "bool" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "OracleDataUpdate",
      "inputs": [
        { "name": "blockNumber", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "totalPendingDeposit", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "totalStaked", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "burnableShares", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "lastProcessedRequestId", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "rewardFeesAccumulated", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "OracleOperatorUpdated",
      "inputs": [{ "name": "oracle", "type": "address", "indexed": false, "internalType": "address" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "OwnershipTransferred",
      "inputs": [
        { "name": "previousOwner", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "newOwner", "type": "address", "indexed": true, "internalType": "address" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "Paused",
      "inputs": [{ "name": "account", "type": "address", "indexed": false, "internalType": "address" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "RebalanceStarted",
      "inputs": [{ "name": "rebalanceInProgress", "type": "uint256", "indexed": false, "internalType": "uint256" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "Redeem",
      "inputs": [
        { "name": "controller", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "receiver", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "requestId", "type": "uint256", "indexed": true, "internalType": "uint256" },
        { "name": "shares", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "assets", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "fee", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "RedeemRequest",
      "inputs": [
        { "name": "controller", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "owner", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "requestId", "type": "uint256", "indexed": true, "internalType": "uint256" },
        { "name": "sender", "type": "address", "indexed": false, "internalType": "address" },
        { "name": "shares", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "assets", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "RewardFeeUpdated",
      "inputs": [{ "name": "rewardFee", "type": "uint8", "indexed": false, "internalType": "uint8" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "StakePrecompileUpdated",
      "inputs": [{ "name": "stakePrecompile", "type": "address", "indexed": false, "internalType": "address" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "Transfer",
      "inputs": [
        { "name": "from", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "to", "type": "address", "indexed": true, "internalType": "address" },
        { "name": "value", "type": "uint256", "indexed": false, "internalType": "uint256" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "Unpaused",
      "inputs": [{ "name": "account", "type": "address", "indexed": false, "internalType": "address" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "ValidatorRebalance",
      "inputs": [
        { "name": "validatorId", "type": "uint64", "indexed": false, "internalType": "uint64" },
        { "name": "amount", "type": "uint256", "indexed": false, "internalType": "uint256" },
        { "name": "isStaked", "type": "bool", "indexed": false, "internalType": "bool" }
      ],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "ValidatorsRegistryUpdated",
      "inputs": [{ "name": "validatorsRegistry", "type": "address", "indexed": false, "internalType": "address" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "WithdrawalDelayUpdated",
      "inputs": [{ "name": "withdrawalDelay", "type": "uint64", "indexed": false, "internalType": "uint64" }],
      "anonymous": false
    },
    {
      "type": "event",
      "name": "WithdrawalFeeUpdated",
      "inputs": [{ "name": "withdrawalFee", "type": "uint256", "indexed": false, "internalType": "uint256" }],
      "anonymous": false
    },
    { "type": "error", "name": "AlreadyClaimed", "inputs": [] },
    { "type": "error", "name": "BelowMinimumRedeemAmount", "inputs": [] },
    { "type": "error", "name": "ECDSAInvalidSignature", "inputs": [] },
    { "type": "error", "name": "ECDSAInvalidSignatureLength", "inputs": [{ "name": "length", "type": "uint256", "internalType": "uint256" }] },
    { "type": "error", "name": "ECDSAInvalidSignatureS", "inputs": [{ "name": "s", "type": "bytes32", "internalType": "bytes32" }] },
    {
      "type": "error",
      "name": "ERC20InsufficientAllowance",
      "inputs": [
        { "name": "spender", "type": "address", "internalType": "address" },
        { "name": "allowance", "type": "uint256", "internalType": "uint256" },
        { "name": "needed", "type": "uint256", "internalType": "uint256" }
      ]
    },
    {
      "type": "error",
      "name": "ERC20InsufficientBalance",
      "inputs": [
        { "name": "sender", "type": "address", "internalType": "address" },
        { "name": "balance", "type": "uint256", "internalType": "uint256" },
        { "name": "needed", "type": "uint256", "internalType": "uint256" }
      ]
    },
    { "type": "error", "name": "ERC20InvalidApprover", "inputs": [{ "name": "approver", "type": "address", "internalType": "address" }] },
    { "type": "error", "name": "ERC20InvalidReceiver", "inputs": [{ "name": "receiver", "type": "address", "internalType": "address" }] },
    { "type": "error", "name": "ERC20InvalidSender", "inputs": [{ "name": "sender", "type": "address", "internalType": "address" }] },
    { "type": "error", "name": "ERC20InvalidSpender", "inputs": [{ "name": "spender", "type": "address", "internalType": "address" }] },
    { "type": "error", "name": "ERC2612ExpiredSignature", "inputs": [{ "name": "deadline", "type": "uint256", "internalType": "uint256" }] },
    {
      "type": "error",
      "name": "ERC2612InvalidSigner",
      "inputs": [
        { "name": "signer", "type": "address", "internalType": "address" },
        { "name": "owner", "type": "address", "internalType": "address" }
      ]
    },
    { "type": "error", "name": "EnforcedPause", "inputs": [] },
    { "type": "error", "name": "ExpectedPause", "inputs": [] },
    { "type": "error", "name": "InsufficientBalance", "inputs": [] },
    {
      "type": "error",
      "name": "InvalidAccountNonce",
      "inputs": [
        { "name": "account", "type": "address", "internalType": "address" },
        { "name": "currentNonce", "type": "uint256", "internalType": "uint256" }
      ]
    },
    { "type": "error", "name": "InvalidAmount", "inputs": [] },
    { "type": "error", "name": "InvalidBlockNumber", "inputs": [] },
    { "type": "error", "name": "InvalidBurnableShares", "inputs": [] },
    { "type": "error", "name": "InvalidInitialization", "inputs": [] },
    { "type": "error", "name": "InvalidLastProcessedRequestId", "inputs": [] },
    { "type": "error", "name": "InvalidRange", "inputs": [] },
    { "type": "error", "name": "InvalidRequestId", "inputs": [] },
    { "type": "error", "name": "InvalidRewardFee", "inputs": [] },
    { "type": "error", "name": "InvalidTotalStaked", "inputs": [] },
    { "type": "error", "name": "InvalidUtilisedPendingDeposit", "inputs": [] },
    { "type": "error", "name": "InvalidWithdrawalFee", "inputs": [] },
    { "type": "error", "name": "NoActiveValidators", "inputs": [] },
    { "type": "error", "name": "NotInitializing", "inputs": [] },
    { "type": "error", "name": "OnlyOracleOperatorAllowed", "inputs": [] },
    { "type": "error", "name": "OutOfOrderOracleTx", "inputs": [] },
    { "type": "error", "name": "OwnableInvalidOwner", "inputs": [{ "name": "owner", "type": "address", "internalType": "address" }] },
    { "type": "error", "name": "OwnableUnauthorizedAccount", "inputs": [{ "name": "account", "type": "address", "internalType": "address" }] },
    { "type": "error", "name": "RebalanceBatchNotWithdrawn", "inputs": [] },
    { "type": "error", "name": "RebalanceInProgressAlready", "inputs": [] },
    { "type": "error", "name": "RebalanceNotSet", "inputs": [] },
    { "type": "error", "name": "RequestIdsArrayFull", "inputs": [] },
    { "type": "error", "name": "StakePrecompileClaimRewardsFailed", "inputs": [] },
    { "type": "error", "name": "StakePrecompileDelegateFailed", "inputs": [] },
    { "type": "error", "name": "StakePrecompileUndelegateFailed", "inputs": [] },
    { "type": "error", "name": "StakePrecompileWithdrawFailed", "inputs": [] },
    { "type": "error", "name": "TotalAssetsIsZero", "inputs": [] },
    { "type": "error", "name": "TransferFailed", "inputs": [] },
    { "type": "error", "name": "TxAlreadyProcessed", "inputs": [] },
    { "type": "error", "name": "UnauthorizedOperator", "inputs": [] },
    { "type": "error", "name": "ValidatorLengthMismatch", "inputs": [] },
    { "type": "error", "name": "WaitMoreTime", "inputs": [] }
  ]
```

{% endcode %}

### Functions

#### 1. Fetch Exchange Rate

To fetch the current aprMON/MON exchange rate you need to invoke the `convertToAssets` function(i.e. how many MON you get back for certain amount of aprMON):

```solidity
uint256 assets = aprMON.convertToAssets(1 ether)
```

To fetch the current MON/aprMON exchange rate you need to invoke the `convertToShares` function(i.e. how many aprMON you get back for certain amount of MON):

To fetch the current MON/aprMON exchange rate you need to invoke the `convertToShares` function(i.e. how many aprMON you get back for certain amount of MON):

```solidity
uint256 shares = aprMON.convertToShares(1 ether)
```

Note that exchange rate will be 1e18 for now on testnet before Monad staking module is ready. So MON-aprMON will be a 1-to-1 pair.

#### 2. Fetch Balance

To fetch the aprMON balance of a user use the `balanceOf` function:

```solidity
balanceOf(address account) external view returns (uint256 balance)
```

#### 3. Stake

To deposit Monad into aPriori and mint aprMON you need to invoke the `deposit` function:

```solidity
deposit(uint256 assets, address receiver)
```

Deposits immediately mint aprMON tokens with the current exchange rate.

#### 4. Unstake

To request a withdrawal you need to call the `requestRedeem` function:

```solidity
requestRedeem(uint256 shares, address controller, address owner) external returns (uint256 requestId)
```

Withdrawals requests take a few staking module epochs to be claimable. Each staking module epoch is roughly 5.5 to 6 hours, thus the expected wait time for a withdrawal request is usually around 12-18 hours.  Once the withdrawal request has unlocked you can call the `function redeem(uint256[] calldata requestIDs, address receiver)` function to receive the Monad tokens.

#### 5. Withdrawal Information

Once a withdrawal has been requested, you can see more information about it with  `viewRedeemRequest` function:

```solidity
viewRedeemRequest(uint256 requestId) external view returns (uint256 id, bool claimed, bool claimable, uint256 shares, uint256 assets, uint256 timestamp, uint64 unlockEpoch)
```

The `unlockEpoch` field indicates at which epoch the withdrawal request will be ready to claim, usually within the first 10 minutes of the epoch.

You can also see information for all the withdrawal requests for a given address by paginating through the `getUserRequestData` function:

```solidity
getUserRequestData(address user, uint256 startIndex, uint256 pageSize) external view returns (RequestData[] memory requestData)
```

where each item in the `requestData` array is in the same format as an individual item being returned by `viewRedeemRequest`


---

# 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://apriori-docs.gitbook.io/apriori-docs/aprmon/smart-contract-integration.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.
