creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    constructor(address initialOwner) {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC721/IERC721.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n    /**\n     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n     */\n    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n    /**\n     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n     */\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n    /**\n     * @dev Returns the number of tokens in ``owner``'s account.\n     */\n    function balanceOf(address owner) external view returns (uint256 balance);\n\n    /**\n     * @dev Returns the owner of the `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function ownerOf(uint256 tokenId) external view returns (address owner);\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n    /**\n     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n     * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must exist and be owned by `from`.\n     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n     *   {setApprovalForAll}.\n     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n     *   a safe transfer.\n     *\n     * Emits a {Transfer} event.\n     */\n    function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Transfers `tokenId` token from `from` to `to`.\n     *\n     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n     * understand this adds an external call which potentially creates a reentrancy vulnerability.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `tokenId` token must be owned by `from`.\n     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 tokenId) external;\n\n    /**\n     * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n     * The approval is cleared when the token is transferred.\n     *\n     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n     *\n     * Requirements:\n     *\n     * - The caller must own the token or be an approved operator.\n     * - `tokenId` must exist.\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address to, uint256 tokenId) external;\n\n    /**\n     * @dev Approve or remove `operator` as an operator for the caller.\n     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n     *\n     * Requirements:\n     *\n     * - The `operator` cannot be the address zero.\n     *\n     * Emits an {ApprovalForAll} event.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns the account approved for `tokenId` token.\n     *\n     * Requirements:\n     *\n     * - `tokenId` must exist.\n     */\n    function getApproved(uint256 tokenId) external view returns (address operator);\n\n    /**\n     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n     *\n     * See {setApprovalForAll}\n     */\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant NOT_ENTERED = 1;\n    uint256 private constant ENTERED = 2;\n\n    uint256 private _status;\n\n    /**\n     * @dev Unauthorized reentrant call.\n     */\n    error ReentrancyGuardReentrantCall();\n\n    constructor() {\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be NOT_ENTERED\n        if (_status == ENTERED) {\n            revert ReentrancyGuardReentrantCall();\n        }\n\n        // Any calls to nonReentrant after this point will fail\n        _status = ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == ENTERED;\n    }\n}\n"
      },
      "contracts/MamiStakeV3.sol": {
        "content": "pragma solidity ^0.8.22;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/ReentrancyGuard.sol\";\n\ninterface RewardsToken {\n    function mint(address, uint256) external;\n}\n\ncontract MamiStakeV3 is Ownable, ReentrancyGuard {\n    struct Pool {\n        address nftAddress;\n        address tokenAddress;\n        uint256 tokenAmount;\n        uint256 start;\n        uint256 rate;\n        address rewardsTokenAddress;\n        uint256 stakedAmount;\n        bool passRequired;\n        uint256[] sharePoolIds;\n        uint256 max;\n    }\n\n    struct User {\n        uint256 last;\n        uint256 amount;\n        uint256 remain;\n    }\n\n    mapping(uint256 => Pool) public poolInfos;\n\n    //poolId => user addrs\n    mapping(uint256 => address[]) public poolAddrs;\n    //poolId => user address => User\n    mapping(uint256 => mapping(address => User)) public poolUsers;\n    //poolId => pass token id => user address\n    mapping(uint256 => mapping(uint256 => address)) public passUsed;\n    //poolId => stake token id => user address\n    mapping(uint256 => mapping(uint256 => address)) public tokenUsed;\n    //poolId => stake token id => pass token id\n    mapping(uint256 => mapping(uint256 => uint256)) public tokenPassRelation;\n    //poolId => total claimed\n    mapping(uint256 => uint256) public totalClaimed;\n\n    IERC721 public passAddress;\n\n    address public foundation;\n\n    constructor() Ownable(msg.sender) {\n        //foundation\n        foundation = 0xB03167F37319F2C67Dd3062fc1482044205484d1;\n        //test\n        // address tokenAddress = 0x5195b2709770180903b7aCB3841B081Ec7b6DfFf;\n        // address nftAddress = 0xd3427F2F46cCa277FFBe068fc0a1B417750AcC33;\n        // passAddress = IERC721(0x12c771b96080f243B3e3E0D9643F38FBEb029E24);\n\n        //main\n        address tokenAddress = 0x8983CF891867942d06AD6CEb9B9002de860E202d;\n        address nftAddress = 0xbc77f3A44f19113845B2870ce9E72f612D77DC17;\n        passAddress = IERC721(0xd6591bBb8A4867cEa5ec732f9c30379C4A8bE730);\n\n        uint256[] memory sharePoolIds0 = new uint256[](1);\n        sharePoolIds0[0] = 1;\n        uint256[] memory sharePoolIds1 = new uint256[](1);\n        sharePoolIds1[0] = 0;\n\n        setPool(\n            0,\n            nftAddress,\n            tokenAddress,\n            40000 ether,\n            block.number,\n            8.8 ether,\n            tokenAddress,\n            false,\n            sharePoolIds0,\n            50000000 ether\n        );\n\n        setPool(\n            1,\n            nftAddress,\n            tokenAddress,\n            40000 ether,\n            block.number,\n            10 ether,\n            tokenAddress,\n            true,\n            sharePoolIds1,\n            50000000 ether\n        );\n    }\n\n    function stake(\n        uint256 poolId,\n        uint256[] calldata stakeTokenIds,\n        uint256[] calldata passTokenIds\n    ) external checkPool(poolId) {\n        Pool storage pool = poolInfos[poolId];\n\n        claim(poolId);\n        bool userExist;\n        for (uint256 i = 0; i < poolAddrs[poolId].length; i++) {\n            if (poolAddrs[poolId][i] == msg.sender) {\n                userExist = true;\n                break;\n            }\n        }\n        if (!userExist) {\n            genUser(poolId);\n        }\n\n        for (uint256 i = 0; i < stakeTokenIds.length; i++) {\n            require(\n                msg.sender ==\n                    IERC721(pool.nftAddress).ownerOf(stakeTokenIds[i]),\n                \"You dont owner this nft\"\n            );\n            require(\n                tokenUsed[poolId][stakeTokenIds[i]] == address(0),\n                \"Stake token id used\"\n            );\n            for (uint256 y = 0; y < pool.sharePoolIds.length; y++) {\n                require(\n                    tokenUsed[pool.sharePoolIds[y]][stakeTokenIds[i]] ==\n                        address(0),\n                    \"The nft already staked\"\n                );\n            }\n            tokenUsed[poolId][stakeTokenIds[i]] = msg.sender;\n\n            if (pool.passRequired) {\n                require(\n                    passTokenIds.length == stakeTokenIds.length,\n                    \"Invalid length pass and token ids\"\n                );\n                require(\n                    msg.sender == IERC721(passAddress).ownerOf(passTokenIds[i]),\n                    \"You dont owner this pass\"\n                );\n                require(\n                    passUsed[poolId][passTokenIds[i]] == address(0),\n                    \"Stake pass id used\"\n                );\n                for (uint256 y = 0; y < pool.sharePoolIds.length; y++) {\n                    require(\n                        passUsed[pool.sharePoolIds[y]][passTokenIds[i]] ==\n                            address(0),\n                        \"The pass already staked\"\n                    );\n                }\n                passUsed[poolId][passTokenIds[i]] = msg.sender;\n                tokenPassRelation[poolId][stakeTokenIds[i]] = passTokenIds[i];\n            }\n        }\n\n        poolUsers[poolId][msg.sender].amount += stakeTokenIds.length;\n        pool.stakedAmount += stakeTokenIds.length;\n\n        IERC20(pool.tokenAddress).transferFrom(\n            msg.sender,\n            address(this),\n            pool.tokenAmount * stakeTokenIds.length\n        );\n    }\n\n    function genUser(uint256 poolId) private {\n        poolUsers[poolId][msg.sender] = User(block.number, 0, 0);\n        poolAddrs[poolId].push(msg.sender);\n    }\n\n    function unStake(\n        uint256 poolId,\n        uint256[] calldata unStakeTokenIds\n    ) external checkPool(poolId) {\n        Pool storage pool = poolInfos[poolId];\n\n        claim(poolId);\n\n        for (uint256 i = 0; i < unStakeTokenIds.length; i++) {\n            require(\n                tokenUsed[poolId][unStakeTokenIds[i]] == msg.sender,\n                \"Stake token id not used by you\"\n            );\n            tokenUsed[poolId][unStakeTokenIds[i]] = address(0);\n            if (pool.passRequired) {\n                uint256 passTokenId = tokenPassRelation[poolId][\n                    unStakeTokenIds[i]\n                ];\n                passUsed[poolId][passTokenId] = address(0);\n            }\n        }\n\n        poolUsers[poolId][msg.sender].amount -= unStakeTokenIds.length;\n        pool.stakedAmount -= unStakeTokenIds.length;\n        IERC20(pool.tokenAddress).transfer(\n            msg.sender,\n            pool.tokenAmount * unStakeTokenIds.length\n        );\n    }\n\n    function claim(uint256 poolId) public checkPool(poolId) {\n        _sync(poolId);\n        Pool memory pool = poolInfos[poolId];\n        User storage user = poolUsers[poolId][msg.sender];\n        if (totalClaimed[poolId] + user.remain >= pool.max) {\n            user.remain = pool.max - totalClaimed[poolId];\n        }\n        if (user.remain > 0) {\n            uint256 fee = user.remain / 20;\n            RewardsToken(pool.rewardsTokenAddress).mint(foundation, fee);\n            RewardsToken(pool.rewardsTokenAddress).mint(\n                msg.sender,\n                user.remain - fee\n            );\n            totalClaimed[poolId] += user.remain;\n            user.remain = 0;\n        }\n    }\n\n    function claimAll(uint256[] calldata poolIds) public {\n        for (uint256 i = 0; i < poolIds.length; i++) {\n            claim(poolIds[i]);\n        }\n    }\n\n    function setPool(\n        uint256 poolId,\n        address nftAddress,\n        address tokenAddress,\n        uint256 tokenAmount,\n        uint256 start,\n        uint256 rate,\n        address rewardsTokenAddress,\n        bool passRequired,\n        uint256[] memory sharePoolIds,\n        uint256 max\n    ) public onlyOwner {\n        poolInfos[poolId] = Pool(\n            nftAddress,\n            tokenAddress,\n            tokenAmount,\n            start,\n            rate,\n            rewardsTokenAddress,\n            0,\n            passRequired,\n            sharePoolIds,\n            max\n        );\n    }\n\n    modifier checkPool(uint256 poolId) {\n        Pool memory pool = poolInfos[poolId];\n        require(pool.tokenAddress != address(0), \"Pool not exist\");\n        require(pool.start <= block.number, \"Pool not start\");\n        _;\n    }\n\n    function _sync(uint256 poolId) private {\n        uint256 pendingRemain = getPendingRemain(poolId, msg.sender);\n        User storage user = poolUsers[poolId][msg.sender];\n        user.remain += pendingRemain;\n        user.last = block.number;\n    }\n\n    function getPendingRemain(\n        uint256 poolId,\n        address account\n    ) public view returns (uint256) {\n        uint256 pendingRemain = 0;\n        Pool memory pool = poolInfos[poolId];\n        if (pool.stakedAmount > 0) {\n            User memory user = poolUsers[poolId][account];\n            uint256 last = pool.start > user.last ? pool.start : user.last;\n\n            pendingRemain =\n                ((block.number - last) * user.amount * pool.rate) /\n                pool.stakedAmount;\n        }\n        return pendingRemain;\n    }\n\n    function getSharedTokenIds(\n        uint256 poolId\n    ) public view returns (uint256[] memory) {\n        return poolInfos[poolId].sharePoolIds;\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}