{
  "address": "0xc9208049600361f6b551679fcfCBb20fD5067af3",
  "abi": [
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_masaTokenAddress",
          "type": "address"
        },
        {
          "internalType": "address",
          "name": "_admin",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "_secondsForPeriod",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_cooldownPeriod",
          "type": "uint256"
        },
        {
          "internalType": "address",
          "name": "_masaStakingV1",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "_stakingV1Timestamp",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_rewardsReserved",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_totalStaked",
          "type": "uint256"
        },
        {
          "internalType": "uint256[]",
          "name": "_periods",
          "type": "uint256[]"
        },
        {
          "internalType": "uint256[]",
          "name": "_totalStakedForPeriod",
          "type": "uint256[]"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "constructor"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "user",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "reward",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "index",
          "type": "uint256"
        }
      ],
      "name": "Claimed",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "by",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "cooldownPeriod",
          "type": "uint256"
        }
      ],
      "name": "CooldownPeriodUpdated",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "by",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "period",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "rate",
          "type": "uint256"
        }
      ],
      "name": "InterestRateUpdated",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "Paused",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        },
        {
          "indexed": true,
          "internalType": "bytes32",
          "name": "previousAdminRole",
          "type": "bytes32"
        },
        {
          "indexed": true,
          "internalType": "bytes32",
          "name": "newAdminRole",
          "type": "bytes32"
        }
      ],
      "name": "RoleAdminChanged",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "account",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "sender",
          "type": "address"
        }
      ],
      "name": "RoleGranted",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "account",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "sender",
          "type": "address"
        }
      ],
      "name": "RoleRevoked",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "user",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "startTime",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "period",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "interestRate",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "index",
          "type": "uint256"
        }
      ],
      "name": "Staked",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "by",
          "type": "address"
        }
      ],
      "name": "StakingDisabled",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "by",
          "type": "address"
        }
      ],
      "name": "StakingEnabled",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "user",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "index",
          "type": "uint256"
        }
      ],
      "name": "Unlocked",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": false,
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "Unpaused",
      "type": "event"
    },
    {
      "inputs": [],
      "name": "DEFAULT_ADMIN_ROLE",
      "outputs": [
        {
          "internalType": "bytes32",
          "name": "",
          "type": "bytes32"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "INTEREST_PRECISSION",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_user",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "_index",
          "type": "uint256"
        }
      ],
      "name": "canClaimStake",
      "outputs": [
        {
          "internalType": "bool",
          "name": "canClaim",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_user",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "_index",
          "type": "uint256"
        }
      ],
      "name": "canUnlockStake",
      "outputs": [
        {
          "internalType": "bool",
          "name": "canUnlock",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_index",
          "type": "uint256"
        }
      ],
      "name": "claim",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "cooldownPeriod",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "disableStaking",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "enableStaking",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "getPeriods",
      "outputs": [
        {
          "internalType": "uint256[]",
          "name": "",
          "type": "uint256[]"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        }
      ],
      "name": "getRoleAdmin",
      "outputs": [
        {
          "internalType": "bytes32",
          "name": "",
          "type": "bytes32"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_user",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "_index",
          "type": "uint256"
        }
      ],
      "name": "getUserStake",
      "outputs": [
        {
          "components": [
            {
              "components": [
                {
                  "internalType": "uint256",
                  "name": "amount",
                  "type": "uint256"
                },
                {
                  "internalType": "uint256",
                  "name": "startTime",
                  "type": "uint256"
                },
                {
                  "internalType": "uint256",
                  "name": "unlockTime",
                  "type": "uint256"
                },
                {
                  "internalType": "uint256",
                  "name": "period",
                  "type": "uint256"
                },
                {
                  "internalType": "uint256",
                  "name": "interestRate",
                  "type": "uint256"
                }
              ],
              "internalType": "struct MasaStaking.Stake",
              "name": "stake",
              "type": "tuple"
            },
            {
              "internalType": "bool",
              "name": "canUnlock",
              "type": "bool"
            },
            {
              "internalType": "bool",
              "name": "canClaim",
              "type": "bool"
            }
          ],
          "internalType": "struct MasaStaking.StakeDetails",
          "name": "",
          "type": "tuple"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_user",
          "type": "address"
        }
      ],
      "name": "getUserStakeCount",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_user",
          "type": "address"
        }
      ],
      "name": "getUserStakedBalance",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_user",
          "type": "address"
        }
      ],
      "name": "getUserStakes",
      "outputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "amount",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "startTime",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "unlockTime",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "period",
              "type": "uint256"
            },
            {
              "internalType": "uint256",
              "name": "interestRate",
              "type": "uint256"
            },
            {
              "internalType": "bool",
              "name": "imported",
              "type": "bool"
            },
            {
              "internalType": "uint256",
              "name": "importedIndex",
              "type": "uint256"
            }
          ],
          "internalType": "struct MasaStakingV2.Stake[]",
          "name": "",
          "type": "tuple[]"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_user",
          "type": "address"
        }
      ],
      "name": "getUserStakesWithInterest",
      "outputs": [
        {
          "internalType": "uint256[]",
          "name": "principalAmounts",
          "type": "uint256[]"
        },
        {
          "internalType": "uint256[]",
          "name": "interestEarned",
          "type": "uint256[]"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        },
        {
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "grantRole",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        },
        {
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "hasRole",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "name": "importedStakes",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "name": "interestRates",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "masaStakingV1",
      "outputs": [
        {
          "internalType": "contract MasaStaking",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "masaToken",
      "outputs": [
        {
          "internalType": "contract IERC20",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "pause",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "paused",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "name": "periods",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        },
        {
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "renounceRole",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_token",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "_amount",
          "type": "uint256"
        },
        {
          "internalType": "address",
          "name": "_receiver",
          "type": "address"
        }
      ],
      "name": "rescueERC20Token",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_amount",
          "type": "uint256"
        },
        {
          "internalType": "address",
          "name": "_receiver",
          "type": "address"
        }
      ],
      "name": "rescueNativeToken",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "bytes32",
          "name": "role",
          "type": "bytes32"
        },
        {
          "internalType": "address",
          "name": "account",
          "type": "address"
        }
      ],
      "name": "revokeRole",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "rewardsNotReserved",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "rewardsReserved",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "secondsForPeriod",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_cooldownPeriod",
          "type": "uint256"
        }
      ],
      "name": "setCooldownPeriod",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_period",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_rate",
          "type": "uint256"
        }
      ],
      "name": "setInterestRate",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_masaStakingV1",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "_stakingV1Timestamp",
          "type": "uint256"
        }
      ],
      "name": "setMasaStakingV1",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_amount",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "_period",
          "type": "uint256"
        }
      ],
      "name": "stake",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        },
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "name": "stakes",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "amount",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "startTime",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "unlockTime",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "period",
          "type": "uint256"
        },
        {
          "internalType": "uint256",
          "name": "interestRate",
          "type": "uint256"
        },
        {
          "internalType": "bool",
          "name": "imported",
          "type": "bool"
        },
        {
          "internalType": "uint256",
          "name": "importedIndex",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "stakingEnabled",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "stakingV1Timestamp",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "bytes4",
          "name": "interfaceId",
          "type": "bytes4"
        }
      ],
      "name": "supportsInterface",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "totalStaked",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "name": "totalStakedForPeriod",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint256",
          "name": "_index",
          "type": "uint256"
        }
      ],
      "name": "unlock",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "unpause",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }
  ],
  "transactionHash": "0x49bfa0e6ef6734df35a2cda545effc9bbdee5b947905113f93b81c6aca0c6d88",
  "receipt": {
    "to": null,
    "from": "0x6FB8988700B2Afeed0395676487CB5C37697463C",
    "contractAddress": "0xc9208049600361f6b551679fcfCBb20fD5067af3",
    "transactionIndex": 3,
    "gasUsed": "3251939",
    "logsBloom": "0x00000004000000000000000000000000000000000000000000000000000000002000000000000000000000000040000000000000000000000000000000000000000080000000000000000000000000000000400000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000100100000000000000100000000000020008000000000000000000000000000000800400000000000000000000000000000",
    "blockHash": "0x87e632fa16aed24ad6931b4ff43cbee19adb9487cf4607717b86d3909a8f3c66",
    "transactionHash": "0x49bfa0e6ef6734df35a2cda545effc9bbdee5b947905113f93b81c6aca0c6d88",
    "logs": [
      {
        "transactionIndex": 3,
        "blockNumber": 18485083,
        "transactionHash": "0x49bfa0e6ef6734df35a2cda545effc9bbdee5b947905113f93b81c6aca0c6d88",
        "address": "0xc9208049600361f6b551679fcfCBb20fD5067af3",
        "topics": [
          "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d",
          "0x0000000000000000000000000000000000000000000000000000000000000000",
          "0x000000000000000000000000f1a812680ebdc6e27c9cafdca0a62ff607e305c4",
          "0x0000000000000000000000006fb8988700b2afeed0395676487cb5c37697463c"
        ],
        "data": "0x",
        "logIndex": 3,
        "blockHash": "0x87e632fa16aed24ad6931b4ff43cbee19adb9487cf4607717b86d3909a8f3c66"
      }
    ],
    "blockNumber": 18485083,
    "cumulativeGasUsed": "3445208",
    "status": 1,
    "byzantium": true
  },
  "args": [
    "0x6fECCe51a6C4881e68F6460e0d73686e736c44D7",
    "0xf1A812680EBdc6e27c9CAfdca0A62Ff607E305C4",
    60,
    600,
    "0x26775cD6D7615c8570c8421819c228225543a844",
    1732738434,
    "25375000000000000",
    "310000000000000000",
    [
      "9",
      "6",
      "3"
    ],
    [
      "50000000000000000",
      "100000000000000000",
      "160000000000000000"
    ]
  ],
  "numDeployments": 3,
  "solcInputHash": "b691f7d920adef72fc0a21c2816a429c",
  "metadata": "{\"compiler\":{\"version\":\"0.8.18+commit.87f61d96\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_masaTokenAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secondsForPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownPeriod\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_masaStakingV1\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stakingV1Timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_rewardsReserved\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_totalStaked\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"_periods\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_totalStakedForPeriod\",\"type\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"by\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownPeriod\",\"type\":\"uint256\"}],\"name\":\"CooldownPeriodUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"by\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"InterestRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"by\",\"type\":\"address\"}],\"name\":\"StakingDisabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"by\",\"type\":\"address\"}],\"name\":\"StakingEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"Unlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"INTEREST_PRECISSION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"canClaimStake\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"canClaim\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"canUnlockStake\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"canUnlock\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"disableStaking\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enableStaking\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPeriods\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getUserStake\",\"outputs\":[{\"components\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unlockTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"}],\"internalType\":\"struct MasaStaking.Stake\",\"name\":\"stake\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"canUnlock\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"canClaim\",\"type\":\"bool\"}],\"internalType\":\"struct MasaStaking.StakeDetails\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getUserStakeCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getUserStakedBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getUserStakes\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unlockTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"imported\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"importedIndex\",\"type\":\"uint256\"}],\"internalType\":\"struct MasaStakingV2.Stake[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getUserStakesWithInterest\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"principalAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"interestEarned\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"importedStakes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"interestRates\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"masaStakingV1\",\"outputs\":[{\"internalType\":\"contract MasaStaking\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"masaToken\",\"outputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"periods\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"rescueERC20Token\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"}],\"name\":\"rescueNativeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsNotReserved\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rewardsReserved\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"secondsForPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cooldownPeriod\",\"type\":\"uint256\"}],\"name\":\"setCooldownPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_rate\",\"type\":\"uint256\"}],\"name\":\"setInterestRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_masaStakingV1\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stakingV1Timestamp\",\"type\":\"uint256\"}],\"name\":\"setMasaStakingV1\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"stakes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unlockTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"interestRate\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"imported\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"importedIndex\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingV1Timestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalStaked\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"totalStakedForPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"unlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"details\":\"Implementation of a staking contract V2 for MasaToken. This contract allows users to stake their MasaTokens for a specified period and earn interest based on the staking period. The contract includes functionalities for staking, unstaking, and querying staked balances and earned interest. Provides backward compatibility to query pre-migration stakes from MasaStakingV1. Supports new stakes after migration and a query function for historical stakes based on the pause timestamp of V1 contract.\",\"events\":{\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"RoleAdminChanged(bytes32,bytes32,bytes32)\":{\"details\":\"Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._\"},\"RoleGranted(bytes32,address,address)\":{\"details\":\"Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}.\"},\"RoleRevoked(bytes32,address,address)\":{\"details\":\"Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:   - if using `revokeRole`, it is the admin role bearer   - if using `renounceRole`, it is the role bearer (i.e. `account`)\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"canClaimStake(address,uint256)\":{\"details\":\"Determines if a stake is eligible for claiming based on the current timestamp.\",\"params\":{\"_index\":\"The index of the stake within the user's array of stakes.\",\"_user\":\"The address of the user querying claim eligibility.\"},\"returns\":{\"canClaim\":\"True if the stake can be claimed, false otherwise.\"}},\"canUnlockStake(address,uint256)\":{\"details\":\"Determines if a stake is eligible for unlocking based on the current timestamp.\",\"params\":{\"_index\":\"The index of the stake within the user's array of stakes.\",\"_user\":\"The address of the user querying unlock eligibility.\"},\"returns\":{\"canUnlock\":\"True if the stake can be unlocked, false otherwise.\"}},\"claim(uint256)\":{\"details\":\"Allows users to claim a specific stake identified by its index after the cooldown period has fully elapsed.\",\"params\":{\"_index\":\"The index of the stake within the user's array of stakes to be claimed.\"}},\"constructor\":{\"details\":\"Sets the initial values for the MasaToken address and initializes roles and default interest rates for different periods.\",\"params\":{\"_admin\":\"The address of the admin account.\",\"_cooldownPeriod\":\"The period for unstaking in seconds.\",\"_masaStakingV1\":\"The address of the MasaStakingV1 contract.\",\"_masaTokenAddress\":\"The address of the MasaToken contract.\",\"_periods\":\"An array of periods for which interest rates are set.\",\"_rewardsReserved\":\"The rewards reserved for staking.\",\"_secondsForPeriod\":\"The number of seconds for each staking period.\",\"_stakingV1Timestamp\":\"The timestamp when V1 is considered outdated.\",\"_totalStaked\":\"The total staked amount.\",\"_totalStakedForPeriod\":\"An array of total staked amounts for each period.\"}},\"disableStaking()\":{\"details\":\"This function can only be called by an account with the DEFAULT_ADMIN_ROLE. It sets the `stakingEnabled` state variable to false.\"},\"enableStaking()\":{\"details\":\"This function can only be called by an account with the DEFAULT_ADMIN_ROLE. It sets the `stakingEnabled` state variable to true.\"},\"getPeriods()\":{\"details\":\"Returns the periods for which interest rates have been set.\",\"returns\":{\"_0\":\"An array of periods.\"}},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getUserStake(address,uint256)\":{\"details\":\"Returns details of a specific stake for a user, including whether it can be unstaked.\",\"params\":{\"_index\":\"The index of the stake in the user's stakes array.\",\"_user\":\"The address of the user.\"},\"returns\":{\"_0\":\"StakeDetails The details of the stake.\"}},\"getUserStakeCount(address)\":{\"details\":\"Returns the number of stakes a user has made.\",\"params\":{\"_user\":\"The address of the user.\"},\"returns\":{\"_0\":\"The number of stakes.\"}},\"getUserStakedBalance(address)\":{\"details\":\"Returns the total staked balance of a user by summing up the amounts in all their stakes.\",\"params\":{\"_user\":\"The address of the user whose total staked balance is being queried.\"},\"returns\":{\"_0\":\"uint256 The total staked balance of the user.\"}},\"getUserStakes(address)\":{\"details\":\"Returns the stakes of a user.\",\"params\":{\"_user\":\"The address of the user.\"},\"returns\":{\"_0\":\"An array of stakes.\"}},\"getUserStakesWithInterest(address)\":{\"details\":\"Returns the principal amounts and interest earned for each stake of a user This function calculates the interest based on the elapsed time since each stake was made.\",\"params\":{\"_user\":\"The address of the user whose stakes and interest are being queried.\"},\"returns\":{\"interestEarned\":\"An array of the interest earned for each stake of the user.\",\"principalAmounts\":\"An array of the principal amounts for each stake of the user.\"}},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"pause()\":{\"details\":\"Pauses all staking and unstaking functions. Only callable by accounts with the DEFAULT_ADMIN_ROLE.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"rescueERC20Token(address,uint256,address)\":{\"params\":{\"_amount\":\"Token amount\",\"_receiver\":\"Receiver address\",\"_token\":\"Token contract address\"}},\"rescueNativeToken(uint256,address)\":{\"params\":{\"_amount\":\"Token amount\",\"_receiver\":\"Receiver address\"}},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"rewardsNotReserved()\":{\"details\":\"Returns the amount of rewards not reserved for staking.\",\"returns\":{\"_0\":\"uint256 The amount of rewards not reserved for staking.\"}},\"setCooldownPeriod(uint256)\":{\"details\":\"Updates the cooldown period for unstaking. Only callable by accounts with the DEFAULT_ADMIN_ROLE.\",\"params\":{\"_cooldownPeriod\":\"The new cooldown period in seconds.\"}},\"setInterestRate(uint256,uint256)\":{\"details\":\"Updates the interest rate for a specific staking period. Only callable by accounts with the DEFAULT_ADMIN_ROLE.\",\"params\":{\"_period\":\"The staking period to update the interest rate for.\",\"_rate\":\"The new interest rate for the specified staking period.\"}},\"setMasaStakingV1(address,uint256)\":{\"details\":\"Updates the reference to the MasaStakingV1 contract and the paused timestamp. Only callable by accounts with the DEFAULT_ADMIN_ROLE.\",\"params\":{\"_masaStakingV1\":\"The address of the MasaStakingV1 contract.\",\"_stakingV1Timestamp\":\"The timestamp when V1 is considered outdated\"}},\"stake(uint256,uint256)\":{\"details\":\"Allows users to stake a specified amount of MasaToken for a specified period. Stakes are recorded in the stakes mapping, and users are added to the allStakers array if they haven't staked before.\",\"params\":{\"_amount\":\"The amount of MasaToken to be staked.\",\"_period\":\"The period for which the MasaToken is staked, in months.\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"unlock(uint256)\":{\"details\":\"Allows users to unlock a specific stake identified by its index after the staking period has fully elapsed.\",\"params\":{\"_index\":\"The index of the stake within the user's array of stakes to be unlocked.\"}},\"unpause()\":{\"details\":\"Unpauses all staking and unstaking functions. Only callable by accounts with the DEFAULT_ADMIN_ROLE.\"}},\"stateVariables\":{\"stakingEnabled\":{\"details\":\"State variable to control the availability of staking functionality.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"disableStaking()\":{\"notice\":\"Disables the staking functionality.\"},\"enableStaking()\":{\"notice\":\"Enables the staking functionality.\"},\"rescueERC20Token(address,uint256,address)\":{\"notice\":\"Transfer tokens.\"},\"rescueNativeToken(uint256,address)\":{\"notice\":\"Transfer native tokens.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/MasaStakingV2.sol\":\"MasaStakingV2\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"details\":{\"constantOptimizer\":true,\"cse\":true,\"deduplicate\":true,\"inliner\":true,\"jumpdestRemover\":true,\"orderLiterals\":true,\"peephole\":true,\"yul\":false},\"runs\":1},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```solidity\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```solidity\\n * function foo() public {\\n *     require(hasRole(MY_ROLE, msg.sender));\\n *     ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\\n * to enforce additional security measures for this role.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n    struct RoleData {\\n        mapping(address => bool) members;\\n        bytes32 adminRole;\\n    }\\n\\n    mapping(bytes32 => RoleData) private _roles;\\n\\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n    /**\\n     * @dev Modifier that checks that an account has a specific role. Reverts\\n     * with a standardized message including the required role.\\n     *\\n     * The format of the revert reason is given by the following regular expression:\\n     *\\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n     *\\n     * _Available since v4.1._\\n     */\\n    modifier onlyRole(bytes32 role) {\\n        _checkRole(role);\\n        _;\\n    }\\n\\n    /**\\n     * @dev See {IERC165-supportsInterface}.\\n     */\\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n    }\\n\\n    /**\\n     * @dev Returns `true` if `account` has been granted `role`.\\n     */\\n    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n        return _roles[role].members[account];\\n    }\\n\\n    /**\\n     * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n     * Overriding this function changes the behavior of the {onlyRole} modifier.\\n     *\\n     * Format of the revert message is described in {_checkRole}.\\n     *\\n     * _Available since v4.6._\\n     */\\n    function _checkRole(bytes32 role) internal view virtual {\\n        _checkRole(role, _msgSender());\\n    }\\n\\n    /**\\n     * @dev Revert with a standard message if `account` is missing `role`.\\n     *\\n     * The format of the revert reason is given by the following regular expression:\\n     *\\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n     */\\n    function _checkRole(bytes32 role, address account) internal view virtual {\\n        if (!hasRole(role, account)) {\\n            revert(\\n                string(\\n                    abi.encodePacked(\\n                        \\\"AccessControl: account \\\",\\n                        Strings.toHexString(account),\\n                        \\\" is missing role \\\",\\n                        Strings.toHexString(uint256(role), 32)\\n                    )\\n                )\\n            );\\n        }\\n    }\\n\\n    /**\\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\\n     * {revokeRole}.\\n     *\\n     * To change a role's admin, use {_setRoleAdmin}.\\n     */\\n    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n        return _roles[role].adminRole;\\n    }\\n\\n    /**\\n     * @dev Grants `role` to `account`.\\n     *\\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\\n     * event.\\n     *\\n     * Requirements:\\n     *\\n     * - the caller must have ``role``'s admin role.\\n     *\\n     * May emit a {RoleGranted} event.\\n     */\\n    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n        _grantRole(role, account);\\n    }\\n\\n    /**\\n     * @dev Revokes `role` from `account`.\\n     *\\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n     *\\n     * Requirements:\\n     *\\n     * - the caller must have ``role``'s admin role.\\n     *\\n     * May emit a {RoleRevoked} event.\\n     */\\n    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n        _revokeRole(role, account);\\n    }\\n\\n    /**\\n     * @dev Revokes `role` from the calling account.\\n     *\\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n     * purpose is to provide a mechanism for accounts to lose their privileges\\n     * if they are compromised (such as when a trusted device is misplaced).\\n     *\\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n     * event.\\n     *\\n     * Requirements:\\n     *\\n     * - the caller must be `account`.\\n     *\\n     * May emit a {RoleRevoked} event.\\n     */\\n    function renounceRole(bytes32 role, address account) public virtual override {\\n        require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n        _revokeRole(role, account);\\n    }\\n\\n    /**\\n     * @dev Grants `role` to `account`.\\n     *\\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\\n     * event. Note that unlike {grantRole}, this function doesn't perform any\\n     * checks on the calling account.\\n     *\\n     * May emit a {RoleGranted} event.\\n     *\\n     * [WARNING]\\n     * ====\\n     * This function should only be called from the constructor when setting\\n     * up the initial roles for the system.\\n     *\\n     * Using this function in any other way is effectively circumventing the admin\\n     * system imposed by {AccessControl}.\\n     * ====\\n     *\\n     * NOTE: This function is deprecated in favor of {_grantRole}.\\n     */\\n    function _setupRole(bytes32 role, address account) internal virtual {\\n        _grantRole(role, account);\\n    }\\n\\n    /**\\n     * @dev Sets `adminRole` as ``role``'s admin role.\\n     *\\n     * Emits a {RoleAdminChanged} event.\\n     */\\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n        bytes32 previousAdminRole = getRoleAdmin(role);\\n        _roles[role].adminRole = adminRole;\\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n    }\\n\\n    /**\\n     * @dev Grants `role` to `account`.\\n     *\\n     * Internal function without access restriction.\\n     *\\n     * May emit a {RoleGranted} event.\\n     */\\n    function _grantRole(bytes32 role, address account) internal virtual {\\n        if (!hasRole(role, account)) {\\n            _roles[role].members[account] = true;\\n            emit RoleGranted(role, account, _msgSender());\\n        }\\n    }\\n\\n    /**\\n     * @dev Revokes `role` from `account`.\\n     *\\n     * Internal function without access restriction.\\n     *\\n     * May emit a {RoleRevoked} event.\\n     */\\n    function _revokeRole(bytes32 role, address account) internal virtual {\\n        if (hasRole(role, account)) {\\n            _roles[role].members[account] = false;\\n            emit RoleRevoked(role, account, _msgSender());\\n        }\\n    }\\n}\\n\",\"keccak256\":\"0x0dd6e52cb394d7f5abe5dca2d4908a6be40417914720932de757de34a99ab87f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n    /**\\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n     *\\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n     * {RoleAdminChanged} not being emitted signaling this.\\n     *\\n     * _Available since v3.1._\\n     */\\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n    /**\\n     * @dev Emitted when `account` is granted `role`.\\n     *\\n     * `sender` is the account that originated the contract call, an admin role\\n     * bearer except when using {AccessControl-_setupRole}.\\n     */\\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n    /**\\n     * @dev Emitted when `account` is revoked `role`.\\n     *\\n     * `sender` is the account that originated the contract call:\\n     *   - if using `revokeRole`, it is the admin role bearer\\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n     */\\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n    /**\\n     * @dev Returns `true` if `account` has been granted `role`.\\n     */\\n    function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n    /**\\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\\n     * {revokeRole}.\\n     *\\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n     */\\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n    /**\\n     * @dev Grants `role` to `account`.\\n     *\\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\\n     * event.\\n     *\\n     * Requirements:\\n     *\\n     * - the caller must have ``role``'s admin role.\\n     */\\n    function grantRole(bytes32 role, address account) external;\\n\\n    /**\\n     * @dev Revokes `role` from `account`.\\n     *\\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n     *\\n     * Requirements:\\n     *\\n     * - the caller must have ``role``'s admin role.\\n     */\\n    function revokeRole(bytes32 role, address account) external;\\n\\n    /**\\n     * @dev Revokes `role` from the calling account.\\n     *\\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n     * purpose is to provide a mechanism for accounts to lose their privileges\\n     * if they are compromised (such as when a trusted device is misplaced).\\n     *\\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\\n     * event.\\n     *\\n     * Requirements:\\n     *\\n     * - the caller must be `account`.\\n     */\\n    function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n    /**\\n     * @dev Emitted when the pause is triggered by `account`.\\n     */\\n    event Paused(address account);\\n\\n    /**\\n     * @dev Emitted when the pause is lifted by `account`.\\n     */\\n    event Unpaused(address account);\\n\\n    bool private _paused;\\n\\n    /**\\n     * @dev Initializes the contract in unpaused state.\\n     */\\n    constructor() {\\n        _paused = false;\\n    }\\n\\n    /**\\n     * @dev Modifier to make a function callable only when the contract is not paused.\\n     *\\n     * Requirements:\\n     *\\n     * - The contract must not be paused.\\n     */\\n    modifier whenNotPaused() {\\n        _requireNotPaused();\\n        _;\\n    }\\n\\n    /**\\n     * @dev Modifier to make a function callable only when the contract is paused.\\n     *\\n     * Requirements:\\n     *\\n     * - The contract must be paused.\\n     */\\n    modifier whenPaused() {\\n        _requirePaused();\\n        _;\\n    }\\n\\n    /**\\n     * @dev Returns true if the contract is paused, and false otherwise.\\n     */\\n    function paused() public view virtual returns (bool) {\\n        return _paused;\\n    }\\n\\n    /**\\n     * @dev Throws if the contract is paused.\\n     */\\n    function _requireNotPaused() internal view virtual {\\n        require(!paused(), \\\"Pausable: paused\\\");\\n    }\\n\\n    /**\\n     * @dev Throws if the contract is not paused.\\n     */\\n    function _requirePaused() internal view virtual {\\n        require(paused(), \\\"Pausable: not paused\\\");\\n    }\\n\\n    /**\\n     * @dev Triggers stopped state.\\n     *\\n     * Requirements:\\n     *\\n     * - The contract must not be paused.\\n     */\\n    function _pause() internal virtual whenNotPaused {\\n        _paused = true;\\n        emit Paused(_msgSender());\\n    }\\n\\n    /**\\n     * @dev Returns to normal state.\\n     *\\n     * Requirements:\\n     *\\n     * - The contract must be paused.\\n     */\\n    function _unpause() internal virtual whenPaused {\\n        _paused = false;\\n        emit Unpaused(_msgSender());\\n    }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\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    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        require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\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\",\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\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 amount of tokens in existence.\\n     */\\n    function totalSupply() external view returns (uint256);\\n\\n    /**\\n     * @dev Returns the amount of tokens owned by `account`.\\n     */\\n    function balanceOf(address account) external view returns (uint256);\\n\\n    /**\\n     * @dev Moves `amount` 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 amount) 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 `amount` as the allowance of `spender` over the 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 amount) external returns (bool);\\n\\n    /**\\n     * @dev Moves `amount` tokens from `from` to `to` using the\\n     * allowance mechanism. `amount` 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 amount) external returns (bool);\\n}\\n\",\"keccak256\":\"0x287b55befed2961a7eabd7d7b1b2839cbca8a5b80ef8dcbb25ed3d4c2002c305\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n *\\n * ==== Security Considerations\\n *\\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\\n * generally recommended is:\\n *\\n * ```solidity\\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\\n *     doThing(..., value);\\n * }\\n *\\n * function doThing(..., uint256 value) public {\\n *     token.safeTransferFrom(msg.sender, address(this), value);\\n *     ...\\n * }\\n * ```\\n *\\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\\n * {SafeERC20-safeTransferFrom}).\\n *\\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\\n * contracts should have entry points that don't rely on permit.\\n */\\ninterface IERC20Permit {\\n    /**\\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n     * given ``owner``'s signed approval.\\n     *\\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n     * ordering also apply here.\\n     *\\n     * Emits an {Approval} event.\\n     *\\n     * Requirements:\\n     *\\n     * - `spender` cannot be the zero address.\\n     * - `deadline` must be a timestamp in the future.\\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n     * over the EIP712-formatted function arguments.\\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\\n     *\\n     * For more information on the signature format, see the\\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n     * section].\\n     *\\n     * CAUTION: See Security Considerations above.\\n     */\\n    function permit(\\n        address owner,\\n        address spender,\\n        uint256 value,\\n        uint256 deadline,\\n        uint8 v,\\n        bytes32 r,\\n        bytes32 s\\n    ) external;\\n\\n    /**\\n     * @dev Returns the current nonce for `owner`. This value must be\\n     * included whenever a signature is generated for {permit}.\\n     *\\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n     * prevents a signature from being used multiple times.\\n     */\\n    function nonces(address owner) external view returns (uint256);\\n\\n    /**\\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n     */\\n    // solhint-disable-next-line func-name-mixedcase\\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xb264c03a3442eb37a68ad620cefd1182766b58bee6cec40343480392d6b14d69\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\\n * contract returns false). Tokens that return no value (and instead revert or\\n * throw on failure) are also supported, non-reverting calls are assumed to be\\n * successful.\\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n    using Address for address;\\n\\n    /**\\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\\n     * non-reverting calls are assumed to be successful.\\n     */\\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n    }\\n\\n    /**\\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\\n     */\\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n    }\\n\\n    /**\\n     * @dev Deprecated. This function has issues similar to the ones found in\\n     * {IERC20-approve}, and its usage is discouraged.\\n     *\\n     * Whenever possible, use {safeIncreaseAllowance} and\\n     * {safeDecreaseAllowance} instead.\\n     */\\n    function safeApprove(IERC20 token, address spender, uint256 value) internal {\\n        // safeApprove should only be called when setting an initial allowance,\\n        // or when resetting it to zero. To increase and decrease it, use\\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\\n        require(\\n            (value == 0) || (token.allowance(address(this), spender) == 0),\\n            \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n        );\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n    }\\n\\n    /**\\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n     * non-reverting calls are assumed to be successful.\\n     */\\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n        uint256 oldAllowance = token.allowance(address(this), spender);\\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\\n    }\\n\\n    /**\\n     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\\n     * non-reverting calls are assumed to be successful.\\n     */\\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\\n        unchecked {\\n            uint256 oldAllowance = token.allowance(address(this), spender);\\n            require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\\n        }\\n    }\\n\\n    /**\\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\\n     * to be set to zero before setting it to a non-zero value, such as USDT.\\n     */\\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\\n        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\\n\\n        if (!_callOptionalReturnBool(token, approvalCall)) {\\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\\n            _callOptionalReturn(token, approvalCall);\\n        }\\n    }\\n\\n    /**\\n     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\\n     * Revert on invalid signature.\\n     */\\n    function safePermit(\\n        IERC20Permit token,\\n        address owner,\\n        address spender,\\n        uint256 value,\\n        uint256 deadline,\\n        uint8 v,\\n        bytes32 r,\\n        bytes32 s\\n    ) internal {\\n        uint256 nonceBefore = token.nonces(owner);\\n        token.permit(owner, spender, value, deadline, v, r, s);\\n        uint256 nonceAfter = token.nonces(owner);\\n        require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\n    }\\n\\n    /**\\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\\n     * @param token The token targeted by the call.\\n     * @param data The call data (encoded using abi.encode or one of its variants).\\n     */\\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\\n        // the target address contains contract code and also asserts for success in the low-level call.\\n\\n        bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n        require(returndata.length == 0 || abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n    }\\n\\n    /**\\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\\n     * @param token The token targeted by the call.\\n     * @param data The call data (encoded using abi.encode or one of its variants).\\n     *\\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\\n     */\\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\\n        // and not revert is the subcall reverts.\\n\\n        (bool success, bytes memory returndata) = address(token).call(data);\\n        return\\n            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\\n    }\\n}\\n\",\"keccak256\":\"0xabefac93435967b4d36a4fabcbdbb918d1f0b7ae3c3d85bc30923b326c927ed1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n    /**\\n     * @dev Returns true if `account` is a contract.\\n     *\\n     * [IMPORTANT]\\n     * ====\\n     * It is unsafe to assume that an address for which this function returns\\n     * false is an externally-owned account (EOA) and not a contract.\\n     *\\n     * Among others, `isContract` will return false for the following\\n     * types of addresses:\\n     *\\n     *  - an externally-owned account\\n     *  - a contract in construction\\n     *  - an address where a contract will be created\\n     *  - an address where a contract lived, but was destroyed\\n     *\\n     * Furthermore, `isContract` will also return true if the target contract within\\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\\n     * which only has an effect at the end of a transaction.\\n     * ====\\n     *\\n     * [IMPORTANT]\\n     * ====\\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n     *\\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n     * constructor.\\n     * ====\\n     */\\n    function isContract(address account) internal view returns (bool) {\\n        // This method relies on extcodesize/address.code.length, which returns 0\\n        // for contracts in construction, since the code is only stored at the end\\n        // of the constructor execution.\\n\\n        return account.code.length > 0;\\n    }\\n\\n    /**\\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n     * `recipient`, forwarding all available gas and reverting on errors.\\n     *\\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n     * imposed by `transfer`, making them unable to receive funds via\\n     * `transfer`. {sendValue} removes this limitation.\\n     *\\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n     *\\n     * IMPORTANT: because control is transferred to `recipient`, care must be\\n     * taken to not create reentrancy vulnerabilities. Consider using\\n     * {ReentrancyGuard} or the\\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n     */\\n    function sendValue(address payable recipient, uint256 amount) internal {\\n        require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n        (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n        require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n    }\\n\\n    /**\\n     * @dev Performs a Solidity function call using a low level `call`. A\\n     * plain `call` is an unsafe replacement for a function call: use this\\n     * function instead.\\n     *\\n     * If `target` reverts with a revert reason, it is bubbled up by this\\n     * function (like regular Solidity function calls).\\n     *\\n     * Returns the raw returned data. To convert to the expected return value,\\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n     *\\n     * Requirements:\\n     *\\n     * - `target` must be a contract.\\n     * - calling `target` with `data` must not revert.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n        return functionCallWithValue(target, data, 0, \\\"Address: low-level call failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n     * `errorMessage` as a fallback revert reason when `target` reverts.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCall(\\n        address target,\\n        bytes memory data,\\n        string memory errorMessage\\n    ) internal returns (bytes memory) {\\n        return functionCallWithValue(target, data, 0, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n     * but also transferring `value` wei to `target`.\\n     *\\n     * Requirements:\\n     *\\n     * - the calling contract must have an ETH balance of at least `value`.\\n     * - the called Solidity function must be `payable`.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n        return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\\n     *\\n     * _Available since v3.1._\\n     */\\n    function functionCallWithValue(\\n        address target,\\n        bytes memory data,\\n        uint256 value,\\n        string memory errorMessage\\n    ) internal returns (bytes memory) {\\n        require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n     * but performing a static call.\\n     *\\n     * _Available since v3.3._\\n     */\\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n        return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n     * but performing a static call.\\n     *\\n     * _Available since v3.3._\\n     */\\n    function functionStaticCall(\\n        address target,\\n        bytes memory data,\\n        string memory errorMessage\\n    ) internal view returns (bytes memory) {\\n        (bool success, bytes memory returndata) = target.staticcall(data);\\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n     * but performing a delegate call.\\n     *\\n     * _Available since v3.4._\\n     */\\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n        return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n    }\\n\\n    /**\\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n     * but performing a delegate call.\\n     *\\n     * _Available since v3.4._\\n     */\\n    function functionDelegateCall(\\n        address target,\\n        bytes memory data,\\n        string memory errorMessage\\n    ) internal returns (bytes memory) {\\n        (bool success, bytes memory returndata) = target.delegatecall(data);\\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n    }\\n\\n    /**\\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n     *\\n     * _Available since v4.8._\\n     */\\n    function verifyCallResultFromTarget(\\n        address target,\\n        bool success,\\n        bytes memory returndata,\\n        string memory errorMessage\\n    ) internal view returns (bytes memory) {\\n        if (success) {\\n            if (returndata.length == 0) {\\n                // only check isContract if the call was successful and the return data is empty\\n                // otherwise we already know that it was a contract\\n                require(isContract(target), \\\"Address: call to non-contract\\\");\\n            }\\n            return returndata;\\n        } else {\\n            _revert(returndata, errorMessage);\\n        }\\n    }\\n\\n    /**\\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n     * revert reason or using the provided one.\\n     *\\n     * _Available since v4.3._\\n     */\\n    function verifyCallResult(\\n        bool success,\\n        bytes memory returndata,\\n        string memory errorMessage\\n    ) internal pure returns (bytes memory) {\\n        if (success) {\\n            return returndata;\\n        } else {\\n            _revert(returndata, errorMessage);\\n        }\\n    }\\n\\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\\n        // Look for revert reason and bubble it up if present\\n        if (returndata.length > 0) {\\n            // The easiest way to bubble the revert reason is using memory via assembly\\n            /// @solidity memory-safe-assembly\\n            assembly {\\n                let returndata_size := mload(returndata)\\n                revert(add(32, returndata), returndata_size)\\n            }\\n        } else {\\n            revert(errorMessage);\\n        }\\n    }\\n}\\n\",\"keccak256\":\"0x006dd67219697fe68d7fbfdea512e7c4cb64a43565ed86171d67e844982da6fa\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\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    function _contextSuffixLength() internal view virtual returns (uint256) {\\n        return 0;\\n    }\\n}\\n\",\"keccak256\":\"0xa92e4fa126feb6907daa0513ddd816b2eb91f30a808de54f63c17d0e162c3439\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/Math.sol\\\";\\nimport \\\"./math/SignedMath.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n    bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n    uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n    /**\\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n     */\\n    function toString(uint256 value) internal pure returns (string memory) {\\n        unchecked {\\n            uint256 length = Math.log10(value) + 1;\\n            string memory buffer = new string(length);\\n            uint256 ptr;\\n            /// @solidity memory-safe-assembly\\n            assembly {\\n                ptr := add(buffer, add(32, length))\\n            }\\n            while (true) {\\n                ptr--;\\n                /// @solidity memory-safe-assembly\\n                assembly {\\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n                }\\n                value /= 10;\\n                if (value == 0) break;\\n            }\\n            return buffer;\\n        }\\n    }\\n\\n    /**\\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\\n     */\\n    function toString(int256 value) internal pure returns (string memory) {\\n        return string(abi.encodePacked(value < 0 ? \\\"-\\\" : \\\"\\\", toString(SignedMath.abs(value))));\\n    }\\n\\n    /**\\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n     */\\n    function toHexString(uint256 value) internal pure returns (string memory) {\\n        unchecked {\\n            return toHexString(value, Math.log256(value) + 1);\\n        }\\n    }\\n\\n    /**\\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n     */\\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n        bytes memory buffer = new bytes(2 * length + 2);\\n        buffer[0] = \\\"0\\\";\\n        buffer[1] = \\\"x\\\";\\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\\n            buffer[i] = _SYMBOLS[value & 0xf];\\n            value >>= 4;\\n        }\\n        require(value == 0, \\\"Strings: hex length insufficient\\\");\\n        return string(buffer);\\n    }\\n\\n    /**\\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n     */\\n    function toHexString(address addr) internal pure returns (string memory) {\\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n    }\\n\\n    /**\\n     * @dev Returns true if the two strings are equal.\\n     */\\n    function equal(string memory a, string memory b) internal pure returns (bool) {\\n        return keccak256(bytes(a)) == keccak256(bytes(b));\\n    }\\n}\\n\",\"keccak256\":\"0x3088eb2868e8d13d89d16670b5f8612c4ab9ff8956272837d8e90106c59c14a0\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n    /**\\n     * @dev See {IERC165-supportsInterface}.\\n     */\\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n        return interfaceId == type(IERC165).interfaceId;\\n    }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\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\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n    enum Rounding {\\n        Down, // Toward negative infinity\\n        Up, // Toward infinity\\n        Zero // Toward zero\\n    }\\n\\n    /**\\n     * @dev Returns the largest of two numbers.\\n     */\\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n        return a > b ? a : b;\\n    }\\n\\n    /**\\n     * @dev Returns the smallest of two numbers.\\n     */\\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n        return a < b ? a : b;\\n    }\\n\\n    /**\\n     * @dev Returns the average of two numbers. The result is rounded towards\\n     * zero.\\n     */\\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n        // (a + b) / 2 can overflow.\\n        return (a & b) + (a ^ b) / 2;\\n    }\\n\\n    /**\\n     * @dev Returns the ceiling of the division of two numbers.\\n     *\\n     * This differs from standard division with `/` in that it rounds up instead\\n     * of rounding down.\\n     */\\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n        // (a + b - 1) / b can overflow on addition, so we distribute.\\n        return a == 0 ? 0 : (a - 1) / b + 1;\\n    }\\n\\n    /**\\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n     * with further edits by Uniswap Labs also under MIT license.\\n     */\\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\\n        unchecked {\\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n            // variables such that product = prod1 * 2^256 + prod0.\\n            uint256 prod0; // Least significant 256 bits of the product\\n            uint256 prod1; // Most significant 256 bits of the product\\n            assembly {\\n                let mm := mulmod(x, y, not(0))\\n                prod0 := mul(x, y)\\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n            }\\n\\n            // Handle non-overflow cases, 256 by 256 division.\\n            if (prod1 == 0) {\\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\\n                // The surrounding unchecked block does not change this fact.\\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\\n                return prod0 / denominator;\\n            }\\n\\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n            require(denominator > prod1, \\\"Math: mulDiv overflow\\\");\\n\\n            ///////////////////////////////////////////////\\n            // 512 by 256 division.\\n            ///////////////////////////////////////////////\\n\\n            // Make division exact by subtracting the remainder from [prod1 prod0].\\n            uint256 remainder;\\n            assembly {\\n                // Compute remainder using mulmod.\\n                remainder := mulmod(x, y, denominator)\\n\\n                // Subtract 256 bit number from 512 bit number.\\n                prod1 := sub(prod1, gt(remainder, prod0))\\n                prod0 := sub(prod0, remainder)\\n            }\\n\\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n            // See https://cs.stackexchange.com/q/138556/92363.\\n\\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\\n            uint256 twos = denominator & (~denominator + 1);\\n            assembly {\\n                // Divide denominator by twos.\\n                denominator := div(denominator, twos)\\n\\n                // Divide [prod1 prod0] by twos.\\n                prod0 := div(prod0, twos)\\n\\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n                twos := add(div(sub(0, twos), twos), 1)\\n            }\\n\\n            // Shift in bits from prod1 into prod0.\\n            prod0 |= prod1 * twos;\\n\\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n            // four bits. That is, denominator * inv = 1 mod 2^4.\\n            uint256 inverse = (3 * denominator) ^ 2;\\n\\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n            // in modular arithmetic, doubling the correct bits in each step.\\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n            // is no longer required.\\n            result = prod0 * inverse;\\n            return result;\\n        }\\n    }\\n\\n    /**\\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n     */\\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\\n        uint256 result = mulDiv(x, y, denominator);\\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n            result += 1;\\n        }\\n        return result;\\n    }\\n\\n    /**\\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n     *\\n     * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n     */\\n    function sqrt(uint256 a) internal pure returns (uint256) {\\n        if (a == 0) {\\n            return 0;\\n        }\\n\\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n        //\\n        // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n        //\\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n        // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n        // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n        //\\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n        uint256 result = 1 << (log2(a) >> 1);\\n\\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n        // into the expected uint128 result.\\n        unchecked {\\n            result = (result + a / result) >> 1;\\n            result = (result + a / result) >> 1;\\n            result = (result + a / result) >> 1;\\n            result = (result + a / result) >> 1;\\n            result = (result + a / result) >> 1;\\n            result = (result + a / result) >> 1;\\n            result = (result + a / result) >> 1;\\n            return min(result, a / result);\\n        }\\n    }\\n\\n    /**\\n     * @notice Calculates sqrt(a), following the selected rounding direction.\\n     */\\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n        unchecked {\\n            uint256 result = sqrt(a);\\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n        }\\n    }\\n\\n    /**\\n     * @dev Return the log in base 2, rounded down, of a positive value.\\n     * Returns 0 if given 0.\\n     */\\n    function log2(uint256 value) internal pure returns (uint256) {\\n        uint256 result = 0;\\n        unchecked {\\n            if (value >> 128 > 0) {\\n                value >>= 128;\\n                result += 128;\\n            }\\n            if (value >> 64 > 0) {\\n                value >>= 64;\\n                result += 64;\\n            }\\n            if (value >> 32 > 0) {\\n                value >>= 32;\\n                result += 32;\\n            }\\n            if (value >> 16 > 0) {\\n                value >>= 16;\\n                result += 16;\\n            }\\n            if (value >> 8 > 0) {\\n                value >>= 8;\\n                result += 8;\\n            }\\n            if (value >> 4 > 0) {\\n                value >>= 4;\\n                result += 4;\\n            }\\n            if (value >> 2 > 0) {\\n                value >>= 2;\\n                result += 2;\\n            }\\n            if (value >> 1 > 0) {\\n                result += 1;\\n            }\\n        }\\n        return result;\\n    }\\n\\n    /**\\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n     * Returns 0 if given 0.\\n     */\\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n        unchecked {\\n            uint256 result = log2(value);\\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n        }\\n    }\\n\\n    /**\\n     * @dev Return the log in base 10, rounded down, of a positive value.\\n     * Returns 0 if given 0.\\n     */\\n    function log10(uint256 value) internal pure returns (uint256) {\\n        uint256 result = 0;\\n        unchecked {\\n            if (value >= 10 ** 64) {\\n                value /= 10 ** 64;\\n                result += 64;\\n            }\\n            if (value >= 10 ** 32) {\\n                value /= 10 ** 32;\\n                result += 32;\\n            }\\n            if (value >= 10 ** 16) {\\n                value /= 10 ** 16;\\n                result += 16;\\n            }\\n            if (value >= 10 ** 8) {\\n                value /= 10 ** 8;\\n                result += 8;\\n            }\\n            if (value >= 10 ** 4) {\\n                value /= 10 ** 4;\\n                result += 4;\\n            }\\n            if (value >= 10 ** 2) {\\n                value /= 10 ** 2;\\n                result += 2;\\n            }\\n            if (value >= 10 ** 1) {\\n                result += 1;\\n            }\\n        }\\n        return result;\\n    }\\n\\n    /**\\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n     * Returns 0 if given 0.\\n     */\\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n        unchecked {\\n            uint256 result = log10(value);\\n            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\\n        }\\n    }\\n\\n    /**\\n     * @dev Return the log in base 256, rounded down, of a positive value.\\n     * Returns 0 if given 0.\\n     *\\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n     */\\n    function log256(uint256 value) internal pure returns (uint256) {\\n        uint256 result = 0;\\n        unchecked {\\n            if (value >> 128 > 0) {\\n                value >>= 128;\\n                result += 16;\\n            }\\n            if (value >> 64 > 0) {\\n                value >>= 64;\\n                result += 8;\\n            }\\n            if (value >> 32 > 0) {\\n                value >>= 32;\\n                result += 4;\\n            }\\n            if (value >> 16 > 0) {\\n                value >>= 16;\\n                result += 2;\\n            }\\n            if (value >> 8 > 0) {\\n                result += 1;\\n            }\\n        }\\n        return result;\\n    }\\n\\n    /**\\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\\n     * Returns 0 if given 0.\\n     */\\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n        unchecked {\\n            uint256 result = log256(value);\\n            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\\n        }\\n    }\\n}\\n\",\"keccak256\":\"0xe4455ac1eb7fc497bb7402579e7b4d64d928b846fce7d2b6fde06d366f21c2b3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n    /**\\n     * @dev Returns the largest of two signed numbers.\\n     */\\n    function max(int256 a, int256 b) internal pure returns (int256) {\\n        return a > b ? a : b;\\n    }\\n\\n    /**\\n     * @dev Returns the smallest of two signed numbers.\\n     */\\n    function min(int256 a, int256 b) internal pure returns (int256) {\\n        return a < b ? a : b;\\n    }\\n\\n    /**\\n     * @dev Returns the average of two signed numbers without overflow.\\n     * The result is rounded towards zero.\\n     */\\n    function average(int256 a, int256 b) internal pure returns (int256) {\\n        // Formula from the book \\\"Hacker's Delight\\\"\\n        int256 x = (a & b) + ((a ^ b) >> 1);\\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\\n    }\\n\\n    /**\\n     * @dev Returns the absolute unsigned value of a signed value.\\n     */\\n    function abs(int256 n) internal pure returns (uint256) {\\n        unchecked {\\n            // must be unchecked in order to support `n = type(int256).min`\\n            return uint256(n >= 0 ? n : -n);\\n        }\\n    }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"},\"contracts/MasaStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\n/**\\n * @dev Implementation of a staking contract for MasaToken. This contract allows\\n * users to stake their MasaTokens for a specified period and earn interest\\n * based on the staking period. The contract includes functionalities for\\n * staking, unstaking, and querying staked balances and earned interest.\\n */\\ncontract MasaStaking is ReentrancyGuard, AccessControl, Pausable {\\n    using SafeERC20 for IERC20;\\n\\n    /**\\n     * @dev Struct to store information about each stake including amount,\\n     * start timestamp, period, and interest rate.\\n     */\\n    struct Stake {\\n        uint256 amount; // The amount of tokens staked.\\n        uint256 startTime; // The timestamp when the stake was initiated.\\n        uint256 unlockTime; // The timestamp when the stake was unlocked.\\n        uint256 period; // The period of the stake.\\n        uint256 interestRate; // The interest rate applicable to the stake.\\n    }\\n\\n    /**\\n     * @dev Struct to store details about each stake including amount,\\n     * start timestamp, unlock timestamp, period, interest rate, and eligibility\\n     * for unlocking and claiming. Used for querying stake details.\\n     */\\n    struct StakeDetails {\\n        Stake stake;\\n        bool canUnlock;\\n        bool canClaim;\\n    }\\n\\n    /* ========== STATE VARIABLES =========================================== */\\n\\n    uint256 public constant INTEREST_PRECISSION = 1_000_000;\\n\\n    IERC20 public immutable masaToken;\\n    uint256 public immutable secondsForPeriod; // seconds for each period\\n\\n    uint256 public cooldownPeriod; // period for unstaking\\n\\n    mapping(address => Stake[]) public stakes;\\n    mapping(uint256 => uint256) public interestRates; // period => interest rate\\n    // array with all the periods\\n    uint256[] public periods;\\n\\n    uint256 public rewardsNotReserved; // rewards not reserved for staking\\n    uint256 public rewardsReserved; // rewards reserved for staking (not yet claimed)\\n    uint256 public totalStaked;\\n    mapping(uint256 => uint256) public totalStakedForPeriod;\\n\\n    /// @dev State variable to control the availability of staking functionality.\\n    bool public stakingEnabled;\\n\\n    /* ========== EVENTS ==================================================== */\\n\\n    event StakingEnabled(address indexed by);\\n    event StakingDisabled(address indexed by);\\n    event InterestRateUpdated(address indexed by, uint256 period, uint256 rate);\\n    event CooldownPeriodUpdated(address indexed by, uint256 cooldownPeriod);\\n    event Staked(\\n        address indexed user,\\n        uint256 amount,\\n        uint256 startTime,\\n        uint256 period,\\n        uint256 interestRate,\\n        uint256 index\\n    );\\n    event Unlocked(address indexed user, uint256 amount, uint256 index);\\n    event Claimed(\\n        address indexed user,\\n        uint256 amount,\\n        uint256 reward,\\n        uint256 index\\n    );\\n\\n    /* ========== INITIALIZE ================================================ */\\n\\n    /**\\n     * @dev Sets the initial values for the MasaToken address and initializes\\n     * roles and default interest rates for different periods.\\n     * @param _masaTokenAddress The address of the MasaToken contract.\\n     * @param _admin The address of the admin account.\\n     * @param _secondsForPeriod The number of seconds for each staking period.\\n     * @param _cooldownPeriod The period for unstaking in seconds.\\n     */\\n    constructor(\\n        address _masaTokenAddress,\\n        address _admin,\\n        uint256 _secondsForPeriod,\\n        uint256 _cooldownPeriod\\n    ) {\\n        require(_secondsForPeriod > 0, \\\"Invalid seconds for period\\\");\\n\\n        masaToken = IERC20(_masaTokenAddress);\\n        secondsForPeriod = _secondsForPeriod;\\n        cooldownPeriod = _cooldownPeriod;\\n\\n        // set staking enabled default\\n        stakingEnabled = true;\\n\\n        _setupRole(DEFAULT_ADMIN_ROLE, _admin);\\n    }\\n\\n    /* ========== RESTRICTED FUNCTIONS ====================================== */\\n\\n    /**\\n     * @notice Disables the staking functionality.\\n     * @dev This function can only be called by an account with the DEFAULT_ADMIN_ROLE.\\n     * It sets the `stakingEnabled` state variable to false.\\n     */\\n    function disableStaking() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(stakingEnabled, \\\"Staking is already disabled\\\");\\n        stakingEnabled = false;\\n        emit StakingDisabled(msg.sender);\\n    }\\n\\n    /**\\n     * @notice Enables the staking functionality.\\n     * @dev This function can only be called by an account with the DEFAULT_ADMIN_ROLE.\\n     * It sets the `stakingEnabled` state variable to true.\\n     */\\n    function enableStaking() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(!stakingEnabled, \\\"Staking is already enabled\\\");\\n        stakingEnabled = true;\\n        emit StakingEnabled(msg.sender);\\n    }\\n\\n    /**\\n     * @dev Pauses all staking and unstaking functions. Only callable by accounts\\n     * with the DEFAULT_ADMIN_ROLE.\\n     */\\n    function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        _pause();\\n        emit Paused(msg.sender);\\n    }\\n\\n    /**\\n     * @dev Unpauses all staking and unstaking functions. Only callable by accounts\\n     * with the DEFAULT_ADMIN_ROLE.\\n     */\\n    function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        _unpause();\\n        emit Unpaused(msg.sender);\\n    }\\n\\n    /**\\n     * @dev Updates the interest rate for a specific staking period.\\n     * Only callable by accounts with the DEFAULT_ADMIN_ROLE.\\n     * @param _period The staking period to update the interest rate for.\\n     * @param _rate The new interest rate for the specified staking period.\\n     */\\n    function setInterestRate(\\n        uint256 _period,\\n        uint256 _rate\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(interestRates[_period] != _rate, \\\"Rate is the same\\\");\\n        interestRates[_period] = _rate;\\n\\n        // Add the period to the periods array if it doesn't already exist\\n        bool periodExists = false;\\n\\n        uint periodsLength = periods.length;\\n        for (uint256 i = 0; i < periodsLength; i++) {\\n            if (periods[i] == _period) {\\n                periodExists = true;\\n                break;\\n            }\\n        }\\n        if (!periodExists) {\\n            periods.push(_period);\\n        }\\n\\n        emit InterestRateUpdated(msg.sender, _period, _rate);\\n    }\\n\\n    /**\\n     * @dev Updates the cooldown period for unstaking.\\n     * Only callable by accounts with the DEFAULT_ADMIN_ROLE.\\n     * @param _cooldownPeriod The new cooldown period in seconds.\\n     */\\n    function setCooldownPeriod(\\n        uint256 _cooldownPeriod\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(\\n            cooldownPeriod != _cooldownPeriod,\\n            \\\"Cooldown period is the same\\\"\\n        );\\n        cooldownPeriod = _cooldownPeriod;\\n        emit CooldownPeriodUpdated(msg.sender, _cooldownPeriod);\\n    }\\n\\n    /* ========== MUTATIVE FUNCTIONS ======================================== */\\n\\n    /**\\n     * @dev Allows the admin to add MasaToken to the reward pool.\\n     * @param _amount The amount of MasaToken to add to the reward pool.\\n     */\\n    function addRewards(uint256 _amount) external nonReentrant whenNotPaused {\\n        require(_amount > 0, \\\"Invalid amount\\\");\\n        rewardsNotReserved += _amount;\\n        masaToken.safeTransferFrom(msg.sender, address(this), _amount);\\n    }\\n\\n    /**\\n     * @dev Allows users to stake a specified amount of MasaToken for a specified period. Stakes are recorded\\n     * in the stakes mapping, and users are added to the allStakers array if they haven't staked before.\\n     * @param _amount The amount of MasaToken to be staked.\\n     * @param _period The period for which the MasaToken is staked, in months.\\n     */\\n    function stake(\\n        uint256 _amount,\\n        uint256 _period\\n    ) external nonReentrant whenNotPaused {\\n        require(stakingEnabled, \\\"Staking is currently disabled\\\");\\n        require(interestRates[_period] > 0, \\\"Invalid staking period\\\");\\n        require(_amount > 0, \\\"Invalid amount\\\");\\n\\n        // Calculate the reward based on the staked amount and the interest rate\\n        uint256 reward = (_amount * interestRates[_period]) /\\n            (100 * INTEREST_PRECISSION);\\n\\n        require(\\n            rewardsNotReserved >= reward,\\n            \\\"Not enough rewards to reserve for staking\\\"\\n        );\\n\\n        totalStaked += _amount;\\n        totalStakedForPeriod[_period] += _amount;\\n\\n        // decrease the rewards not reserved for staking\\n        rewardsNotReserved -= reward;\\n        // increase the rewards reserved for staking\\n        rewardsReserved += reward;\\n\\n        stakes[msg.sender].push(\\n            Stake({\\n                amount: _amount,\\n                startTime: block.timestamp,\\n                unlockTime: 0,\\n                period: _period,\\n                interestRate: interestRates[_period]\\n            })\\n        );\\n\\n        masaToken.safeTransferFrom(msg.sender, address(this), _amount);\\n\\n        emit Staked(\\n            msg.sender,\\n            _amount,\\n            block.timestamp,\\n            _period,\\n            interestRates[_period],\\n            stakes[msg.sender].length - 1\\n        );\\n    }\\n\\n    /**\\n     * @dev Allows users to unlock a specific stake identified by its index after the staking period has fully elapsed.\\n     * @param _index The index of the stake within the user's array of stakes to be unlocked.\\n     */\\n    function unlock(uint256 _index) external nonReentrant whenNotPaused {\\n        require(_index < stakes[msg.sender].length, \\\"Invalid index\\\");\\n        Stake memory stakeData = stakes[msg.sender][_index];\\n\\n        // Ensure the current timestamp is beyond the unlock timestamp\\n        require(\\n            canUnlockStake(msg.sender, _index),\\n            \\\"Staking period has not yet elapsed\\\"\\n        );\\n\\n        stakes[msg.sender][_index].unlockTime = block.timestamp;\\n\\n        emit Unlocked(msg.sender, stakeData.amount, _index);\\n    }\\n\\n    /**\\n     * @dev Allows users to claim a specific stake identified by its index after the cooldown period has fully elapsed.\\n     * @param _index The index of the stake within the user's array of stakes to be claimed.\\n     */\\n    function claim(uint256 _index) external nonReentrant whenNotPaused {\\n        require(_index < stakes[msg.sender].length, \\\"Invalid index\\\");\\n        Stake memory stakeData = stakes[msg.sender][_index];\\n\\n        // Ensure the current timestamp is beyond the cooldown period\\n        require(\\n            canClaimStake(msg.sender, _index),\\n            \\\"Cooldown period has not yet elapsed\\\"\\n        );\\n\\n        // Calculate the reward based on the staked amount and the interest rate\\n        uint256 reward = (stakeData.amount * stakeData.interestRate) /\\n            (100 * INTEREST_PRECISSION);\\n\\n        // Remove the stake from the user's stakes array\\n        _removeStake(msg.sender, _index);\\n\\n        // decrease the rewards reserved for staking\\n        rewardsReserved -= reward;\\n\\n        // Transfer the staked amount plus the reward back to the user\\n        masaToken.safeTransfer(msg.sender, stakeData.amount + reward);\\n\\n        emit Claimed(msg.sender, stakeData.amount, reward, _index);\\n    }\\n\\n    /* ========== VIEWS ===================================================== */\\n\\n    /**\\n     * @dev Returns the periods for which interest rates have been set.\\n     * @return An array of periods.\\n     */\\n    function getPeriods() external view returns (uint256[] memory) {\\n        return periods;\\n    }\\n\\n    /**\\n     * @dev Returns the number of stakes a user has made.\\n     * @param _user The address of the user.\\n     * @return The number of stakes.\\n     */\\n    function getUserStakeCount(address _user) external view returns (uint256) {\\n        return stakes[_user].length;\\n    }\\n\\n    /**\\n     * @dev Returns details of a specific stake for a user, including whether it can be unstaked.\\n     * @param _user The address of the user.\\n     * @param _index The index of the stake in the user's stakes array.\\n     * @return StakeDetails The details of the stake.\\n     */\\n    function getUserStake(\\n        address _user,\\n        uint256 _index\\n    ) external view returns (StakeDetails memory) {\\n        require(_index < stakes[_user].length, \\\"Invalid index\\\");\\n        Stake memory stakeData = stakes[_user][_index];\\n\\n        return\\n            StakeDetails({\\n                stake: stakeData,\\n                canUnlock: canUnlockStake(_user, _index),\\n                canClaim: canClaimStake(_user, _index)\\n            });\\n    }\\n\\n    /**\\n     * @dev Returns the total staked balance of a user by summing up the amounts in all their stakes.\\n     * @param _user The address of the user whose total staked balance is being queried.\\n     * @return uint256 The total staked balance of the user.\\n     */\\n    function getUserStakedBalance(\\n        address _user\\n    ) external view returns (uint256) {\\n        uint256 totalBalance = 0;\\n        for (uint256 i = 0; i < stakes[_user].length; i++) {\\n            totalBalance += stakes[_user][i].amount;\\n        }\\n        return totalBalance;\\n    }\\n\\n    /**\\n     * @dev Returns the principal amounts and interest earned for each stake of a user\\n     * This function calculates the interest based on the elapsed time since each stake was made.\\n     * @param _user The address of the user whose stakes and interest are being queried.\\n     * @return principalAmounts An array of the principal amounts for each stake of the user.\\n     * @return interestEarned An array of the interest earned for each stake of the user.\\n     */\\n    function getUserStakesWithInterest(\\n        address _user\\n    )\\n        external\\n        view\\n        returns (\\n            uint256[] memory principalAmounts,\\n            uint256[] memory interestEarned\\n        )\\n    {\\n        uint256 stakeCount = stakes[_user].length;\\n        principalAmounts = new uint256[](stakeCount);\\n        interestEarned = new uint256[](stakeCount);\\n\\n        for (uint256 i = 0; i < stakeCount; i++) {\\n            Stake memory stakeData = stakes[_user][i];\\n            principalAmounts[i] = stakeData.amount;\\n\\n            // Calculate seconds elapsed since the stake started\\n            uint256 secondsElapsed = block.timestamp - stakeData.startTime;\\n\\n            // Calculate the fraction of the staking period that has elapsed\\n            uint256 secondsInPeriod = stakeData.period * secondsForPeriod;\\n\\n            if (secondsElapsed > secondsInPeriod) {\\n                secondsElapsed = secondsInPeriod;\\n            }\\n\\n            // Multiply by 1e18 for precision\\n            uint256 elapsedFraction = secondsInPeriod > 0\\n                ? (secondsElapsed * 1e18) / secondsInPeriod\\n                : 0;\\n\\n            // Calculate prorated interest based on the elapsed fraction of the period\\n            uint256 interestFraction = (stakeData.amount *\\n                stakeData.interestRate);\\n\\n            // Note: We divide by 100 and then multiply by elapsedFraction and divide by 1e18 for precision\\n            interestEarned[i] =\\n                (interestFraction * elapsedFraction) /\\n                (100 * INTEREST_PRECISSION * 1e18);\\n        }\\n\\n        return (principalAmounts, interestEarned);\\n    }\\n\\n    /**\\n     * @dev Determines if a stake is eligible for unlocking based on the current timestamp.\\n     * @param _user The address of the user querying unlock eligibility.\\n     * @param _index The index of the stake within the user's array of stakes.\\n     * @return canUnlock True if the stake can be unlocked, false otherwise.\\n     */\\n    function canUnlockStake(\\n        address _user,\\n        uint256 _index\\n    ) public view returns (bool canUnlock) {\\n        require(_index < stakes[_user].length, \\\"Invalid index\\\");\\n\\n        Stake memory stakeData = stakes[_user][_index];\\n\\n        if (stakeData.unlockTime > 0) {\\n            canUnlock = false;\\n        } else {\\n            uint256 secondsInPeriod = stakeData.period * secondsForPeriod;\\n            uint256 unlockTime = stakeData.startTime + secondsInPeriod;\\n\\n            canUnlock = block.timestamp >= unlockTime;\\n        }\\n\\n        return canUnlock;\\n    }\\n\\n    /**\\n     * @dev Determines if a stake is eligible for claiming based on the current timestamp.\\n     * @param _user The address of the user querying claim eligibility.\\n     * @param _index The index of the stake within the user's array of stakes.\\n     * @return canClaim True if the stake can be claimed, false otherwise.\\n     */\\n    function canClaimStake(\\n        address _user,\\n        uint256 _index\\n    ) public view returns (bool canClaim) {\\n        require(_index < stakes[_user].length, \\\"Invalid index\\\");\\n\\n        Stake memory stakeData = stakes[_user][_index];\\n        canClaim =\\n            stakeData.unlockTime > 0 &&\\n            block.timestamp >= stakeData.unlockTime + cooldownPeriod;\\n        return canClaim;\\n    }\\n\\n    /* ========== PRIVATE FUNCTIONS ========================================= */\\n\\n    /**\\n     * @dev Removes a stake from the stakes array for a user by index.\\n     * This is a private function used internally by the unstake function.\\n     * @param _user The address of the user from whom the stake is removed.\\n     * @param _index The index of the stake within the user's stakes array to remove.\\n     */\\n    function _removeStake(address _user, uint256 _index) private {\\n        require(_index < stakes[_user].length, \\\"Invalid index\\\");\\n\\n        totalStaked -= stakes[_user][_index].amount;\\n        totalStakedForPeriod[stakes[_user][_index].period] -= stakes[_user][\\n            _index\\n        ].amount;\\n\\n        stakes[_user][_index] = stakes[_user][stakes[_user].length - 1];\\n        stakes[_user].pop();\\n    }\\n\\n    /// @notice Transfer native tokens.\\n    /// @param _amount Token amount\\n    /// @param _receiver Receiver address\\n    function rescueNativeToken(\\n        uint256 _amount,\\n        address _receiver\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        Address.sendValue(payable(_receiver), _amount);\\n    }\\n\\n    /// @notice Transfer tokens.\\n    /// @param _token Token contract address\\n    /// @param _amount Token amount\\n    /// @param _receiver Receiver address\\n    function rescueERC20Token(\\n        address _token,\\n        uint256 _amount,\\n        address _receiver\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        // Ensure the contract doesn't allow rescuing the staking token in a way that affects the staked or reserved funds\\n        if (_token == address(masaToken)) {\\n            uint256 masaBalance = masaToken.balanceOf(address(this));\\n            uint256 totalProtected = rewardsReserved + totalStaked; // This is the amount that must remain in the contract\\n            uint256 notAllocated = masaBalance -\\n                totalProtected -\\n                rewardsNotReserved;\\n\\n            require(\\n                masaBalance - _amount >= totalProtected,\\n                \\\"Operation would affect staked or reserved funds\\\"\\n            );\\n\\n            // If rescuing the masaToken, adjust the not reserved rewards\\n            if (_amount > notAllocated) {\\n                rewardsNotReserved -= (_amount - notAllocated);\\n            }\\n        }\\n\\n        // Perform the transfer\\n        IERC20(_token).safeTransfer(_receiver, _amount);\\n    }\\n}\\n\",\"keccak256\":\"0xbb767fc0e32c559bdfc34bf9c1b6989c7e42a6e9143b8d1483481b2218ff5091\",\"license\":\"MIT\"},\"contracts/MasaStakingV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.18;\\n\\nimport {ReentrancyGuard} from \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport {AccessControl} from \\\"@openzeppelin/contracts/access/AccessControl.sol\\\";\\nimport {Pausable} from \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {SafeERC20} from \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport {Address} from \\\"@openzeppelin/contracts/utils/Address.sol\\\";\\n\\nimport {MasaStaking as MasaStakingV1} from \\\"./MasaStaking.sol\\\";\\n\\n/**\\n * @dev Implementation of a staking contract V2 for MasaToken. This contract allows\\n * users to stake their MasaTokens for a specified period and earn interest\\n * based on the staking period. The contract includes functionalities for\\n * staking, unstaking, and querying staked balances and earned interest.\\n *\\n * Provides backward compatibility to query pre-migration stakes from MasaStakingV1.\\n * Supports new stakes after migration and a query function for historical stakes\\n * based on the pause timestamp of V1 contract.\\n */\\ncontract MasaStakingV2 is ReentrancyGuard, AccessControl, Pausable {\\n    using SafeERC20 for IERC20;\\n\\n    /**\\n     * @dev Struct to store information about each stake including amount,\\n     * start timestamp, period, and interest rate.\\n     */\\n    struct Stake {\\n        uint256 amount; // The amount of tokens staked.\\n        uint256 startTime; // The timestamp when the stake was initiated.\\n        uint256 unlockTime; // The timestamp when the stake was unlocked.\\n        uint256 period; // The period of the stake.\\n        uint256 interestRate; // The interest rate applicable to the stake.\\n        bool imported; // Flag to indicate if the stake was imported from V1.\\n        uint256 importedIndex; // Index of the stake in V1.\\n    }\\n\\n    /**\\n     * @dev Struct to store details about each stake including amount,\\n     * start timestamp, unlock timestamp, period, interest rate, and eligibility\\n     * for unlocking and claiming. Used for querying stake details.\\n     */\\n    struct StakeDetails {\\n        Stake stake;\\n        bool canUnlock;\\n        bool canClaim;\\n    }\\n\\n    /* ========== STATE VARIABLES =========================================== */\\n\\n    uint256 public constant INTEREST_PRECISSION = 1_000_000;\\n\\n    IERC20 public immutable masaToken;\\n    uint256 public immutable secondsForPeriod; // seconds for each period\\n\\n    uint256 public cooldownPeriod; // period for unstaking\\n\\n    mapping(address => Stake[]) public stakes;\\n    mapping(uint256 => uint256) public interestRates; // period => interest rate\\n    // array with all the periods\\n    uint256[] public periods;\\n\\n    uint256 public rewardsReserved; // rewards reserved for staking (not yet claimed)\\n    uint256 public totalStaked;\\n    mapping(uint256 => uint256) public totalStakedForPeriod;\\n\\n    /// @dev State variable to control the availability of staking functionality.\\n    bool public stakingEnabled;\\n\\n    // Reference to the old MasaStakingV1 contract\\n    MasaStakingV1 public masaStakingV1;\\n    // Timestamp when V1 is considered outdated\\n    uint256 public stakingV1Timestamp;\\n    // Imported stake indexes from V1\\n    mapping(address => mapping(uint256 => bool)) public importedStakes;\\n\\n    /* ========== EVENTS ==================================================== */\\n\\n    event StakingEnabled(address indexed by);\\n    event StakingDisabled(address indexed by);\\n    event InterestRateUpdated(address indexed by, uint256 period, uint256 rate);\\n    event CooldownPeriodUpdated(address indexed by, uint256 cooldownPeriod);\\n    event Staked(\\n        address indexed user,\\n        uint256 amount,\\n        uint256 startTime,\\n        uint256 period,\\n        uint256 interestRate,\\n        uint256 index\\n    );\\n    event Unlocked(address indexed user, uint256 amount, uint256 index);\\n    event Claimed(\\n        address indexed user,\\n        uint256 amount,\\n        uint256 reward,\\n        uint256 index\\n    );\\n\\n    /* ========== INITIALIZE ================================================ */\\n\\n    /**\\n     * @dev Sets the initial values for the MasaToken address and initializes\\n     * roles and default interest rates for different periods.\\n     * @param _masaTokenAddress The address of the MasaToken contract.\\n     * @param _admin The address of the admin account.\\n     * @param _secondsForPeriod The number of seconds for each staking period.\\n     * @param _cooldownPeriod The period for unstaking in seconds.\\n     * @param _masaStakingV1 The address of the MasaStakingV1 contract.\\n     * @param _stakingV1Timestamp The timestamp when V1 is considered outdated.\\n     * @param _rewardsReserved The rewards reserved for staking.\\n     * @param _totalStaked The total staked amount.\\n     * @param _periods An array of periods for which interest rates are set.\\n     * @param _totalStakedForPeriod An array of total staked amounts for each period.\\n     */\\n    constructor(\\n        address _masaTokenAddress,\\n        address _admin,\\n        uint256 _secondsForPeriod,\\n        uint256 _cooldownPeriod,\\n        address _masaStakingV1,\\n        uint256 _stakingV1Timestamp,\\n        uint256 _rewardsReserved,\\n        uint256 _totalStaked,\\n        uint256[] memory _periods,\\n        uint256[] memory _totalStakedForPeriod\\n    ) {\\n        require(_secondsForPeriod > 0, \\\"Invalid seconds for period\\\");\\n        require(\\n            _periods.length == _totalStakedForPeriod.length,\\n            \\\"Invalid periods\\\"\\n        );\\n\\n        masaToken = IERC20(_masaTokenAddress);\\n        secondsForPeriod = _secondsForPeriod;\\n        cooldownPeriod = _cooldownPeriod;\\n        masaStakingV1 = MasaStakingV1(_masaStakingV1);\\n        if (_masaStakingV1 != address(0)) {\\n            stakingV1Timestamp = _stakingV1Timestamp;\\n            rewardsReserved = _rewardsReserved;\\n            totalStaked = _totalStaked;\\n            for (uint256 i = 0; i < _periods.length; i++) {\\n                totalStakedForPeriod[_periods[i]] = _totalStakedForPeriod[i];\\n            }\\n        }\\n\\n        // set staking enabled default\\n        stakingEnabled = true;\\n\\n        _setupRole(DEFAULT_ADMIN_ROLE, _admin);\\n    }\\n\\n    /* ========== RESTRICTED FUNCTIONS ====================================== */\\n\\n    /**\\n     * @notice Disables the staking functionality.\\n     * @dev This function can only be called by an account with the DEFAULT_ADMIN_ROLE.\\n     * It sets the `stakingEnabled` state variable to false.\\n     */\\n    function disableStaking() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(stakingEnabled, \\\"Staking is already disabled\\\");\\n        stakingEnabled = false;\\n        emit StakingDisabled(msg.sender);\\n    }\\n\\n    /**\\n     * @notice Enables the staking functionality.\\n     * @dev This function can only be called by an account with the DEFAULT_ADMIN_ROLE.\\n     * It sets the `stakingEnabled` state variable to true.\\n     */\\n    function enableStaking() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(!stakingEnabled, \\\"Staking is already enabled\\\");\\n        stakingEnabled = true;\\n        emit StakingEnabled(msg.sender);\\n    }\\n\\n    /**\\n     * @dev Pauses all staking and unstaking functions. Only callable by accounts\\n     * with the DEFAULT_ADMIN_ROLE.\\n     */\\n    function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        _pause();\\n        emit Paused(msg.sender);\\n    }\\n\\n    /**\\n     * @dev Unpauses all staking and unstaking functions. Only callable by accounts\\n     * with the DEFAULT_ADMIN_ROLE.\\n     */\\n    function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        _unpause();\\n        emit Unpaused(msg.sender);\\n    }\\n\\n    /**\\n     * @dev Updates the interest rate for a specific staking period.\\n     * Only callable by accounts with the DEFAULT_ADMIN_ROLE.\\n     * @param _period The staking period to update the interest rate for.\\n     * @param _rate The new interest rate for the specified staking period.\\n     */\\n    function setInterestRate(\\n        uint256 _period,\\n        uint256 _rate\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(interestRates[_period] != _rate, \\\"Rate is the same\\\");\\n        require(_period > 0, \\\"Invalid period\\\");\\n        interestRates[_period] = _rate;\\n\\n        // Add the period to the periods array if it doesn't already exist\\n        bool periodExists = false;\\n\\n        uint periodsLength = periods.length;\\n        for (uint256 i = 0; i < periodsLength; i++) {\\n            if (periods[i] == _period) {\\n                periodExists = true;\\n                break;\\n            }\\n        }\\n        if (!periodExists) {\\n            periods.push(_period);\\n        }\\n\\n        emit InterestRateUpdated(msg.sender, _period, _rate);\\n    }\\n\\n    /**\\n     * @dev Updates the cooldown period for unstaking.\\n     * Only callable by accounts with the DEFAULT_ADMIN_ROLE.\\n     * @param _cooldownPeriod The new cooldown period in seconds.\\n     */\\n    function setCooldownPeriod(\\n        uint256 _cooldownPeriod\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        require(\\n            cooldownPeriod != _cooldownPeriod,\\n            \\\"Cooldown period is the same\\\"\\n        );\\n        cooldownPeriod = _cooldownPeriod;\\n        emit CooldownPeriodUpdated(msg.sender, _cooldownPeriod);\\n    }\\n\\n    /**\\n     * @dev Updates the reference to the MasaStakingV1 contract and the paused timestamp.\\n     * Only callable by accounts with the DEFAULT_ADMIN_ROLE.\\n     * @param _masaStakingV1 The address of the MasaStakingV1 contract.\\n     * @param _stakingV1Timestamp The timestamp when V1 is considered outdated\\n     */\\n    function setMasaStakingV1(\\n        address _masaStakingV1,\\n        uint256 _stakingV1Timestamp\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        masaStakingV1 = MasaStakingV1(_masaStakingV1);\\n        stakingV1Timestamp = _stakingV1Timestamp;\\n    }\\n\\n    /* ========== MUTATIVE FUNCTIONS ======================================== */\\n\\n    /**\\n     * @dev Allows users to stake a specified amount of MasaToken for a specified period. Stakes are recorded\\n     * in the stakes mapping, and users are added to the allStakers array if they haven't staked before.\\n     * @param _amount The amount of MasaToken to be staked.\\n     * @param _period The period for which the MasaToken is staked, in months.\\n     */\\n    function stake(\\n        uint256 _amount,\\n        uint256 _period\\n    ) external nonReentrant whenNotPaused {\\n        require(stakingEnabled, \\\"Staking is currently disabled\\\");\\n        require(interestRates[_period] > 0, \\\"Invalid staking period\\\");\\n        require(_amount > 0, \\\"Invalid amount\\\");\\n\\n        // Calculate the reward based on the staked amount and the interest rate\\n        uint256 reward = (_amount * interestRates[_period]) /\\n            (100 * INTEREST_PRECISSION);\\n\\n        require(\\n            rewardsNotReserved() >= reward,\\n            \\\"Not enough rewards to reserve for staking\\\"\\n        );\\n\\n        totalStaked += _amount;\\n        totalStakedForPeriod[_period] += _amount;\\n\\n        // increase the rewards reserved for staking\\n        rewardsReserved += reward;\\n\\n        stakes[msg.sender].push(\\n            Stake({\\n                amount: _amount,\\n                startTime: block.timestamp,\\n                unlockTime: 0,\\n                period: _period,\\n                interestRate: interestRates[_period],\\n                imported: false,\\n                importedIndex: 0\\n            })\\n        );\\n\\n        masaToken.safeTransferFrom(msg.sender, address(this), _amount);\\n\\n        emit Staked(\\n            msg.sender,\\n            _amount,\\n            block.timestamp,\\n            _period,\\n            interestRates[_period],\\n            stakes[msg.sender].length - 1\\n        );\\n    }\\n\\n    /**\\n     * @dev Allows users to unlock a specific stake identified by its index after the staking period has fully elapsed.\\n     * @param _index The index of the stake within the user's array of stakes to be unlocked.\\n     */\\n    function unlock(uint256 _index) external nonReentrant whenNotPaused {\\n        require(_index < getUserStakeCount(msg.sender), \\\"Invalid index\\\");\\n        Stake[] memory userStakes = getUserStakes(msg.sender);\\n        Stake memory stakeData = userStakes[_index];\\n\\n        // Ensure the current timestamp is beyond the unlock timestamp\\n        require(\\n            canUnlockStake(msg.sender, _index),\\n            \\\"Staking period has not yet elapsed\\\"\\n        );\\n\\n        if (!stakeData.imported) {\\n            // index is the same as in stakes array because stake array is returned\\n            // first in the function getUserStakes\\n            stakes[msg.sender][_index].unlockTime = block.timestamp;\\n        } else {\\n            // we need to import the stake from V1\\n            stakes[msg.sender].push(\\n                Stake({\\n                    amount: stakeData.amount,\\n                    startTime: stakeData.startTime,\\n                    unlockTime: block.timestamp,\\n                    period: stakeData.period,\\n                    interestRate: stakeData.interestRate,\\n                    imported: stakeData.imported,\\n                    importedIndex: stakeData.importedIndex\\n                })\\n            );\\n            // mark the stake as imported\\n            importedStakes[msg.sender][stakeData.importedIndex] = true;\\n        }\\n\\n        emit Unlocked(msg.sender, stakeData.amount, _index);\\n    }\\n\\n    /**\\n     * @dev Allows users to claim a specific stake identified by its index after the cooldown period has fully elapsed.\\n     * @param _index The index of the stake within the user's array of stakes to be claimed.\\n     */\\n    function claim(uint256 _index) external nonReentrant whenNotPaused {\\n        require(_index < getUserStakeCount(msg.sender), \\\"Invalid index\\\");\\n        Stake[] memory userStakes = getUserStakes(msg.sender);\\n        Stake memory stakeData = userStakes[_index];\\n\\n        // Ensure the current timestamp is beyond the cooldown period\\n        require(\\n            canClaimStake(msg.sender, _index),\\n            \\\"Cooldown period has not yet elapsed\\\"\\n        );\\n\\n        // Calculate the reward based on the staked amount and the interest rate\\n        uint256 reward = (stakeData.amount * stakeData.interestRate) /\\n            (100 * INTEREST_PRECISSION);\\n\\n        // Remove the stake from the user's stakes array.\\n        // Index is the same as in stakes array because stake array is returned\\n        // first in the function getUserStakes\\n        if (_index < stakes[msg.sender].length) {\\n            _removeStake(msg.sender, _index);\\n        }\\n\\n        totalStaked -= stakeData.amount;\\n        totalStakedForPeriod[stakeData.period] -= stakeData.amount;\\n\\n        if (stakeData.imported) {\\n            // mark the stake as imported.\\n            // With this, this stake can't be claimed again\\n            importedStakes[msg.sender][stakeData.importedIndex] = true;\\n        }\\n\\n        // decrease the rewards reserved for staking\\n        rewardsReserved -= reward;\\n\\n        // Transfer the staked amount plus the reward back to the user\\n        masaToken.safeTransfer(msg.sender, stakeData.amount + reward);\\n\\n        emit Claimed(msg.sender, stakeData.amount, reward, _index);\\n    }\\n\\n    /* ========== VIEWS ===================================================== */\\n\\n    /**\\n     * @dev Returns the periods for which interest rates have been set.\\n     * @return An array of periods.\\n     */\\n    function getPeriods() external view returns (uint256[] memory) {\\n        return periods;\\n    }\\n\\n    /**\\n     * @dev Returns the stakes of a user.\\n     * @param _user The address of the user.\\n     * @return An array of stakes.\\n     */\\n    function getUserStakes(address _user) public view returns (Stake[] memory) {\\n        if (address(masaStakingV1) == address(0) || !masaStakingV1.paused()) {\\n            return stakes[_user];\\n        } else {\\n            // get number of stakes in v2\\n            uint256 numStakes = stakes[_user].length;\\n            // get number of stakes in v1\\n            uint256 userStakeCount = masaStakingV1.getUserStakeCount(_user);\\n            for (uint256 i = 0; i < userStakeCount; i++) {\\n                MasaStakingV1.StakeDetails memory stakeDetails = masaStakingV1\\n                    .getUserStake(_user, i);\\n                // check if stake is before migration\\n                // and stake is not imported\\n                if (\\n                    stakeDetails.stake.startTime < stakingV1Timestamp &&\\n                    !importedStakes[_user][i]\\n                ) {\\n                    numStakes++;\\n                }\\n            }\\n\\n            Stake[] memory userStakes = new Stake[](numStakes);\\n\\n            uint256 index = 0;\\n            // get stakes in v2\\n            for (uint256 i = 0; i < stakes[_user].length; i++) {\\n                userStakes[index] = stakes[_user][i];\\n                index++;\\n            }\\n            // get stakes in v1\\n            for (uint256 i = 0; i < userStakeCount; i++) {\\n                MasaStakingV1.StakeDetails memory stakeDetails = masaStakingV1\\n                    .getUserStake(_user, i);\\n                // check if stake is before migration\\n                // and stake is not imported\\n                if (\\n                    stakeDetails.stake.startTime < stakingV1Timestamp &&\\n                    !importedStakes[_user][i]\\n                ) {\\n                    userStakes[index] = Stake({\\n                        amount: stakeDetails.stake.amount,\\n                        startTime: stakeDetails.stake.startTime,\\n                        unlockTime: stakeDetails.stake.unlockTime,\\n                        period: stakeDetails.stake.period,\\n                        interestRate: stakeDetails.stake.interestRate,\\n                        imported: true,\\n                        importedIndex: i\\n                    });\\n                    index++;\\n                }\\n            }\\n\\n            return userStakes;\\n        }\\n    }\\n\\n    /**\\n     * @dev Returns the number of stakes a user has made.\\n     * @param _user The address of the user.\\n     * @return The number of stakes.\\n     */\\n    function getUserStakeCount(address _user) public view returns (uint256) {\\n        if (address(masaStakingV1) == address(0)) {\\n            return stakes[_user].length;\\n        } else {\\n            return getUserStakes(_user).length;\\n        }\\n    }\\n\\n    /**\\n     * @dev Returns details of a specific stake for a user, including whether it can be unstaked.\\n     * @param _user The address of the user.\\n     * @param _index The index of the stake in the user's stakes array.\\n     * @return StakeDetails The details of the stake.\\n     */\\n    function getUserStake(\\n        address _user,\\n        uint256 _index\\n    ) external view returns (MasaStakingV1.StakeDetails memory) {\\n        require(_index < getUserStakeCount(_user), \\\"Invalid index\\\");\\n\\n        Stake[] memory userStakes = getUserStakes(_user);\\n        Stake memory stakeData = userStakes[_index];\\n\\n        MasaStakingV1.Stake memory stakeDataV1 = MasaStakingV1.Stake({\\n            amount: stakeData.amount,\\n            startTime: stakeData.startTime,\\n            unlockTime: stakeData.unlockTime,\\n            period: stakeData.period,\\n            interestRate: stakeData.interestRate\\n        });\\n\\n        return\\n            MasaStakingV1.StakeDetails({\\n                stake: stakeDataV1,\\n                canUnlock: canUnlockStake(_user, _index),\\n                canClaim: canClaimStake(_user, _index)\\n            });\\n    }\\n\\n    /**\\n     * @dev Returns the total staked balance of a user by summing up the amounts in all their stakes.\\n     * @param _user The address of the user whose total staked balance is being queried.\\n     * @return uint256 The total staked balance of the user.\\n     */\\n    function getUserStakedBalance(\\n        address _user\\n    ) external view returns (uint256) {\\n        uint256 totalBalance = 0;\\n        Stake[] memory userStakes = getUserStakes(_user);\\n        for (uint256 i = 0; i < userStakes.length; i++) {\\n            totalBalance += userStakes[i].amount;\\n        }\\n        return totalBalance;\\n    }\\n\\n    /**\\n     * @dev Returns the principal amounts and interest earned for each stake of a user\\n     * This function calculates the interest based on the elapsed time since each stake was made.\\n     * @param _user The address of the user whose stakes and interest are being queried.\\n     * @return principalAmounts An array of the principal amounts for each stake of the user.\\n     * @return interestEarned An array of the interest earned for each stake of the user.\\n     */\\n    function getUserStakesWithInterest(\\n        address _user\\n    )\\n        external\\n        view\\n        returns (\\n            uint256[] memory principalAmounts,\\n            uint256[] memory interestEarned\\n        )\\n    {\\n        Stake[] memory userStakes = getUserStakes(_user);\\n        uint256 stakeCount = userStakes.length;\\n        principalAmounts = new uint256[](stakeCount);\\n        interestEarned = new uint256[](stakeCount);\\n\\n        for (uint256 i = 0; i < stakeCount; i++) {\\n            Stake memory stakeData = userStakes[i];\\n            principalAmounts[i] = stakeData.amount;\\n\\n            // Calculate seconds elapsed since the stake started\\n            uint256 secondsElapsed = block.timestamp - stakeData.startTime;\\n\\n            // Calculate the fraction of the staking period that has elapsed\\n            uint256 secondsInPeriod = stakeData.period * secondsForPeriod;\\n\\n            if (secondsElapsed > secondsInPeriod) {\\n                secondsElapsed = secondsInPeriod;\\n            }\\n\\n            // Multiply by 1e18 for precision\\n            uint256 elapsedFraction = secondsInPeriod > 0\\n                ? (secondsElapsed * 1e18) / secondsInPeriod\\n                : 0;\\n\\n            // Calculate prorated interest based on the elapsed fraction of the period\\n            uint256 interestFraction = (stakeData.amount *\\n                stakeData.interestRate);\\n\\n            // Note: We divide by 100 and then multiply by elapsedFraction and divide by 1e18 for precision\\n            interestEarned[i] =\\n                (interestFraction * elapsedFraction) /\\n                (100 * INTEREST_PRECISSION * 1e18);\\n        }\\n\\n        return (principalAmounts, interestEarned);\\n    }\\n\\n    /**\\n     * @dev Determines if a stake is eligible for unlocking based on the current timestamp.\\n     * @param _user The address of the user querying unlock eligibility.\\n     * @param _index The index of the stake within the user's array of stakes.\\n     * @return canUnlock True if the stake can be unlocked, false otherwise.\\n     */\\n    function canUnlockStake(\\n        address _user,\\n        uint256 _index\\n    ) public view returns (bool canUnlock) {\\n        require(_index < getUserStakeCount(_user), \\\"Invalid index\\\");\\n\\n        Stake[] memory userStakes = getUserStakes(_user);\\n        Stake memory stakeData = userStakes[_index];\\n\\n        if (stakeData.unlockTime > 0) {\\n            canUnlock = false;\\n        } else {\\n            uint256 secondsInPeriod = stakeData.period * secondsForPeriod;\\n            uint256 unlockTime = stakeData.startTime + secondsInPeriod;\\n\\n            canUnlock = block.timestamp >= unlockTime;\\n        }\\n\\n        return canUnlock;\\n    }\\n\\n    /**\\n     * @dev Determines if a stake is eligible for claiming based on the current timestamp.\\n     * @param _user The address of the user querying claim eligibility.\\n     * @param _index The index of the stake within the user's array of stakes.\\n     * @return canClaim True if the stake can be claimed, false otherwise.\\n     */\\n    function canClaimStake(\\n        address _user,\\n        uint256 _index\\n    ) public view returns (bool canClaim) {\\n        require(_index < getUserStakeCount(_user), \\\"Invalid index\\\");\\n\\n        Stake[] memory userStakes = getUserStakes(_user);\\n        Stake memory stakeData = userStakes[_index];\\n        canClaim =\\n            stakeData.unlockTime > 0 &&\\n            block.timestamp >= stakeData.unlockTime + cooldownPeriod;\\n        return canClaim;\\n    }\\n\\n    /**\\n     * @dev Returns the amount of rewards not reserved for staking.\\n     * @return uint256 The amount of rewards not reserved for staking.\\n     */\\n    function rewardsNotReserved() public view returns (uint256) {\\n        uint256 masaBalance = masaToken.balanceOf(address(this));\\n        uint256 totalProtected = rewardsReserved + totalStaked; // This is the amount that must remain in the contract\\n\\n        if (masaBalance <= totalProtected) {\\n            return 0;\\n        } else {\\n            return masaBalance - totalProtected;\\n        }\\n    }\\n\\n    /* ========== PRIVATE FUNCTIONS ========================================= */\\n\\n    /**\\n     * @dev Removes a stake from the stakes array for a user by index.\\n     * This is a private function used internally by the unstake function.\\n     * @param _user The address of the user from whom the stake is removed.\\n     * @param _index The index of the stake within the user's stakes array to remove.\\n     */\\n    function _removeStake(address _user, uint256 _index) private {\\n        require(_index < stakes[_user].length, \\\"Invalid index\\\");\\n\\n        stakes[_user][_index] = stakes[_user][stakes[_user].length - 1];\\n        stakes[_user].pop();\\n    }\\n\\n    /// @notice Transfer native tokens.\\n    /// @param _amount Token amount\\n    /// @param _receiver Receiver address\\n    function rescueNativeToken(\\n        uint256 _amount,\\n        address _receiver\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        Address.sendValue(payable(_receiver), _amount);\\n    }\\n\\n    /// @notice Transfer tokens.\\n    /// @param _token Token contract address\\n    /// @param _amount Token amount\\n    /// @param _receiver Receiver address\\n    function rescueERC20Token(\\n        address _token,\\n        uint256 _amount,\\n        address _receiver\\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n        // Ensure the contract doesn't allow rescuing the staking token in a way that affects the staked or reserved funds\\n        if (_token == address(masaToken)) {\\n            uint256 masaBalance = masaToken.balanceOf(address(this));\\n            uint256 totalProtected = rewardsReserved + totalStaked; // This is the amount that must remain in the contract\\n\\n            require(\\n                masaBalance - _amount >= totalProtected,\\n                \\\"Operation would affect staked or reserved funds\\\"\\n            );\\n        }\\n\\n        // Perform the transfer\\n        IERC20(_token).safeTransfer(_receiver, _amount);\\n    }\\n}\\n\",\"keccak256\":\"0xa5977b5f720e6d59f02b0b9a3501a89b339c3fe47abe2b7bbbc5e18dfdfff3ff\",\"license\":\"MIT\"}},\"version\":1}",
  "bytecode": "0x60c06040523480156200001157600080fd5b5060405162003b2338038062003b23833981016040819052620000349162000393565b60016000556002805460ff19169055876200006c5760405162461bcd60e51b81526004016200006390620004f4565b60405180910390fd5b8051825114620000905760405162461bcd60e51b815260040162000063906200052d565b6001600160a01b038a811660805260a08990526003889055600a8054610100600160a81b031916610100928916928302179055156200014d57600b8590556007849055600883905560005b82518110156200014b57818181518110620000fa57620000fa6200053f565b6020026020010151600960008584815181106200011b576200011b6200053f565b6020026020010151815260200190815260200160002081905550808062000142906200056b565b915050620000db565b505b600a805460ff191660011790556200016760008a62000177565b5050505050505050505062000588565b62000183828262000187565b5050565b620001938282620001f5565b620001835760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b60006001600160a01b0382166200021c565b6200023f8162000222565b81146200024b57600080fd5b50565b80516200021c8162000234565b806200023f565b80516200021c816200025b565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681018181106001600160401b0382111715620002ad57620002ad6200026f565b6040525050565b6000620002c060405190565b9050620002ce828262000285565b919050565b60006001600160401b03821115620002ef57620002ef6200026f565b5060209081020190565b6000620003106200030a84620002d3565b620002b4565b83815290506020808201908402830185811115620003315762000331600080fd5b835b8181101562000359578062000349888262000262565b8452506020928301920162000333565b5050509392505050565b600082601f830112620003795762000379600080fd5b81516200038b848260208601620002f9565b949350505050565b6000806000806000806000806000806101408b8d031215620003b857620003b8600080fd5b6000620003c68d8d6200024e565b9a50506020620003d98d828e016200024e565b9950506040620003ec8d828e0162000262565b9850506060620003ff8d828e0162000262565b9750506080620004128d828e016200024e565b96505060a0620004258d828e0162000262565b95505060c0620004388d828e0162000262565b94505060e06200044b8d828e0162000262565b9350506101008b01516001600160401b038111156200046d576200046d600080fd5b6200047b8d828e0162000363565b9250506101208b01516001600160401b038111156200049d576200049d600080fd5b620004ab8d828e0162000363565b9150509295989b9194979a5092959850565b601a81526000602082017f496e76616c6964207365636f6e647320666f7220706572696f64000000000000815291505b5060200190565b602080825281016200021c81620004bd565b600f81526000602082016e496e76616c696420706572696f647360881b81529150620004ed565b602080825281016200021c8162000506565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019820362000581576200058162000555565b5060010190565b60805160a051613544620005df6000396000818161027d015281816119b40152611ced01526000818161054a015281816105bb0152818161095b015281816110b901528181611b3b0152611b8c01526135446000f3fe608060405234801561001057600080fd5b50600436106101f95760003560e01c806301ffc9a7146101fe57806304646a4914610227578063067cf7aa1461023d5780631b545a17146102455780631cfff51b14610258578063248a9ca31461026557806324d629ec14610278578063250284a81461029f57806328696de2146102a95780632e502e53146102b35780632f2ff15d146102e157806336568abe146102f4578063375d912514610307578063379607f51461031a5780633abac4671461032d5780633f4ba83a1461034057806345c9a55814610348578063584b62a11461035d5780635b9dac89146103835780635c975abb146103965780635ffc4fea146103a15780636198e339146103c15780636763c958146103d45780637418c300146103dd5780637713b578146103f05780637b0472f0146103f957806380ea3de11461040c578063817b1cd21461041f578063842e2981146104285780638456cb591461044857806391d14854146104505780639a4d8ba1146104635780639ae3269c14610483578063a217fddf146104a8578063cec695fa146104b0578063cf91ada0146104d0578063d0489c3a146104e3578063d11aca6214610504578063d547741f1461050c578063de05e7121461051f578063ea4a110414610532578063ebda439614610545578063f09a89d41461056c575b600080fd5b61021161020c36600461258b565b61057f565b60405161021e91906125b6565b60405180910390f35b61023060035481565b60405161021e91906125ca565b6102306105b6565b610230610253366004612603565b61067d565b600a546102119060ff1681565b610230610273366004612635565b6106c6565b6102307f000000000000000000000000000000000000000000000000000000000000000081565b610230620f424081565b6102b16106dc565b005b6102116102c1366004612656565b600c60209081526000928352604080842090915290825290205460ff1681565b6102b16102ef366004612693565b61074a565b6102b1610302366004612693565b61076b565b6102b1610315366004612656565b6107a1565b6102b1610328366004612635565b6107d9565b61023061033b366004612603565b6109d1565b6102b1610a32565b610350610a6d565b60405161021e9190612723565b61037061036b366004612656565b610ac5565b60405161021e9796959493929190612734565b6102b161039136600461279c565b610b25565b60025460ff16610211565b6102306103af366004612635565b60096020526000908152604090205481565b6102b16103cf366004612635565b610c61565b610230600b5481565b6102116103eb366004612656565b610e52565b61023060075481565b6102b161040736600461279c565b610ed4565b6102b161041a366004612635565b61115a565b61023060085481565b61043b610436366004612603565b6111c9565b60405161021e9190612893565b6102b1611772565b61021161045e366004612693565b6117a2565b610230610471366004612635565b60056020526000908152604090205481565b600a5461049b9061010090046001600160a01b031681565b60405161021e91906128dc565b610230600081565b6104c36104be366004612656565b6117cd565b60405161021e919061297e565b6102b16104de366004612693565b6118a0565b6104f66104f1366004612603565b6118b5565b60405161021e92919061298c565b6102b1611aa9565b6102b161051a366004612693565b611b12565b6102b161052d3660046129b1565b611b2e565b610230610540366004612635565b611c5e565b61049b7f000000000000000000000000000000000000000000000000000000000000000081565b61021161057a366004612656565b611c7f565b60006001600160e01b03198216637965db0b60e01b14806105b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016106059190612a0a565b602060405180830381865afa158015610622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106469190612a23565b9050600060085460075461065a9190612a5a565b905080821161066c5760009250505090565b6106768183612a6d565b9250505090565b600a5460009061010090046001600160a01b03166106b157506001600160a01b031660009081526004602052604090205490565b6106ba826111c9565b5192915050565b919050565b6000908152600160208190526040909120015490565b60006106e781611d3f565b600a5460ff166107125760405162461bcd60e51b815260040161070990612ab5565b60405180910390fd5b600a805460ff1916905560405133907f9235e601663aec0db4f23459c059a6aadd04045aaf55631e7765d8999b0e31b090600090a250565b610753826106c6565b61075c81611d3f565b6107668383611d49565b505050565b6001600160a01b03811633146107935760405162461bcd60e51b815260040161070990612b14565b61079d8282611db4565b5050565b60006107ac81611d3f565b50600a80546001600160a01b0390931661010002610100600160a81b031990931692909217909155600b55565b6107e1611e1b565b6107e9611e44565b6107f23361067d565b81106108105760405162461bcd60e51b815260040161070990612b48565b600061081b336111c9565b9050600081838151811061083157610831612b58565b602002602001015190506108453384610e52565b6108615760405162461bcd60e51b815260040161070990612bae565b6000610871620f42406064612bbe565b608083015183516108829190612bbe565b61088c9190612bf3565b336000908152600460205260409020549091508410156108b0576108b03385611e69565b8151600880546000906108c4908490612a6d565b909155505081516060830151600090815260096020526040812080549091906108ee908490612a6d565b909155505060a08201511561092757336000908152600c6020908152604080832060c086015184529091529020805460ff191660011790555b80600760008282546109399190612a6d565b90915550508151610982903390610951908490612a5a565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190611fee565b815160405133917f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e916109b9919085908990612c07565b60405180910390a25050506109ce6001600055565b50565b600080806109de846111c9565b905060005b8151811015610a29578181815181106109fe576109fe612b58565b60200260200101516000015183610a159190612a5a565b925080610a2181612c2f565b9150506109e3565b50909392505050565b6000610a3d81611d3f565b610a45612044565b6000805160206134cf83398151915233604051610a629190612a0a565b60405180910390a150565b60606006805480602002602001604051908101604052809291908181526020018280548015610abb57602002820191906000526020600020905b815481526020019060010190808311610aa7575b5050505050905090565b60046020528160005260406000208181548110610ae157600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601549497509295509093909260ff9091169087565b6000610b3081611d3f565b600083815260056020526040902054829003610b5e5760405162461bcd60e51b815260040161070990612c70565b60008311610b7e5760405162461bcd60e51b815260040161070990612ca5565b6000838152600560205260408120839055600654815b81811015610bdb578560068281548110610bb057610bb0612b58565b906000526020600020015403610bc95760019250610bdb565b80610bd381612c2f565b915050610b94565b5081610c1757600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018590555b336001600160a01b03167f3aebbb85b9698ba4e1588e9f25e8e3bb8d3c5fb5199f6b36b362e6775947b3838686604051610c52929190612cb5565b60405180910390a25050505050565b610c69611e1b565b610c71611e44565b610c7a3361067d565b8110610c985760405162461bcd60e51b815260040161070990612b48565b6000610ca3336111c9565b90506000818381518110610cb957610cb9612b58565b60200260200101519050610ccd3384611c7f565b610ce95760405162461bcd60e51b815260040161070990612d0f565b8060a00151610d3057336000908152600460205260409020805442919085908110610d1657610d16612b58565b906000526020600020906007020160020181905550610e09565b336000818152600460208181526040808420815160e0810183528751815287840151818501908152428285019081526060808b01519084019081526080808c015190850190815260a0808d0151151590860190815260c0808e018051918801918252885460018181018b55998e528b8e209851600790910290980197885595518789015593516002870155915160038601555197840197909755955160058301805491151560ff199283161790559551600690920191909155958552600c83528185209551855294909152909120805490911690911790555b805160405133917f3f2f29fa02cc34566ac167b446be0be9e0254cac18eda93b2dfe6a7a7c8affb991610e3e91908790612cb5565b60405180910390a250506109ce6001600055565b6000610e5d8361067d565b8210610e7b5760405162461bcd60e51b815260040161070990612b48565b6000610e86846111c9565b90506000818481518110610e9c57610e9c612b58565b6020026020010151905060008160400151118015610ecb57506003548160400151610ec79190612a5a565b4210155b95945050505050565b610edc611e1b565b610ee4611e44565b600a5460ff16610f065760405162461bcd60e51b815260040161070990612d53565b600081815260056020526040902054610f315760405162461bcd60e51b815260040161070990612d90565b60008211610f515760405162461bcd60e51b815260040161070990612dc5565b6000610f61620f42406064612bbe565b600083815260056020526040902054610f7a9085612bbe565b610f849190612bf3565b905080610f8f6105b6565b1015610fad5760405162461bcd60e51b815260040161070990612e1b565b8260086000828254610fbf9190612a5a565b909155505060008281526009602052604081208054859290610fe2908490612a5a565b925050819055508060076000828254610ffb9190612a5a565b9091555050336000818152600460208181526040808420815160e08101835289815242818501908152818401878152606083018b81528b89526005808852958920546080850190815260a085018a815260c086018b8152875460018082018a55988d5299909b2095516007909902909501978855925194870194909455516002860155915160038501559051938301939093559151918101805460ff19169215159290921790915590516006909101556110e1906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690308661207e565b60008281526005602090815260408083205433808552600490935292205490917f6381ea17a5324d29cc015352644672ead5185c1c61a0d3a521eda97e35cec97e918691429187919061113690600190612a6d565b604051611147959493929190612e2b565b60405180910390a25061079d6001600055565b600061116581611d3f565b81600354036111865760405162461bcd60e51b815260040161070990612ea9565b600382905560405133907f9304c247b6a1da4f8ed290a9b1016a028a06c48d17d9f174b32c546c531220b4906111bd9085906125ca565b60405180910390a25050565b600a5460609061010090046001600160a01b0316158061125d5750600a60019054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125b9190612ecc565b155b15611317576001600160a01b038216600090815260046020908152604080832080548251818502810185019093528083529193909284015b8282101561130c5760008481526020908190206040805160e0810182526007860290920180548352600180820154848601526002820154928401929092526003810154606084015260048101546080840152600581015460ff16151560a08401526006015460c08301529083529092019101611295565b505050509050919050565b6001600160a01b03808316600090815260046020819052604080832054600a549151631b545a1760e01b8152909461010090920490911691631b545a179161136191889101612a0a565b602060405180830381865afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a29190612a23565b905060005b8181101561148d57600a546040516367634afd60e11b815260009161010090046001600160a01b03169063cec695fa906113e79089908690600401612eed565b60e060405180830381865afa158015611404573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114289190613043565b9050600b5481600001516020015110801561146757506001600160a01b0386166000908152600c6020908152604080832085845290915290205460ff16155b1561147a578361147681612c2f565b9450505b508061148581612c2f565b9150506113a7565b506000826001600160401b038111156114a8576114a8612f05565b60405190808252806020026020018201604052801561151b57816020015b6115086040518060e001604052806000815260200160008152602001600081526020016000815260200160008152602001600015158152602001600081525090565b8152602001906001900390816114c65790505b5090506000805b6001600160a01b038716600090815260046020526040902054811015611610576001600160a01b038716600090815260046020526040902080548290811061156c5761156c612b58565b60009182526020918290206040805160e0810182526007909302909101805483526001810154938301939093526002830154908201526003820154606082015260048201546080820152600582015460ff16151560a082015260069091015460c082015283518490849081106115e4576115e4612b58565b602002602001018190525081806115fa90612c2f565b925050808061160890612c2f565b915050611522565b5060005b8381101561176757600a546040516367634afd60e11b815260009161010090046001600160a01b03169063cec695fa90611654908b908690600401612eed565b60e060405180830381865afa158015611671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116959190613043565b9050600b548160000151602001511080156116d457506001600160a01b0388166000908152600c6020908152604080832085845290915290205460ff16155b15611754576040805160e0810182528251518152825160209081015190820152825182015191810191909152815160609081015190820152815160809081015190820152600160a082015260c08101839052845185908590811061173a5761173a612b58565b6020026020010181905250828061175090612c2f565b9350505b508061175f81612c2f565b915050611614565b509095945050505050565b600061177d81611d3f565b61178561209f565b6000805160206134ef83398151915233604051610a629190612a0a565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6117d5612518565b6117de8361067d565b82106117fc5760405162461bcd60e51b815260040161070990612b48565b6000611807846111c9565b9050600081848151811061181d5761181d612b58565b6020026020010151905060006040518060a00160405280836000015181526020018360200151815260200183604001518152602001836060015181526020018360800151815250905060405180606001604052808281526020016118818888611c7f565b151581526020016118928888610e52565b151590529695505050505050565b60006118ab81611d3f565b61076682846120ca565b60608060006118c3846111c9565b8051909150806001600160401b038111156118e0576118e0612f05565b604051908082528060200260200182016040528015611909578160200160208202803683370190505b509350806001600160401b0381111561192457611924612f05565b60405190808252806020026020018201604052801561194d578160200160208202803683370190505b50925060005b81811015611aa157600083828151811061196f5761196f612b58565b60200260200101519050806000015186838151811061199057611990612b58565b60200260200101818152505060008160200151426119ae9190612a6d565b905060007f000000000000000000000000000000000000000000000000000000000000000083606001516119e29190612bbe565b9050808211156119f0578091505b6000808211611a00576000611a1d565b81611a1384670de0b6b3a7640000612bbe565b611a1d9190612bf3565b9050600084608001518560000151611a359190612bbe565b9050611a45620f42406064612bbe565b611a5790670de0b6b3a7640000612bbe565b611a618383612bbe565b611a6b9190612bf3565b898781518110611a7d57611a7d612b58565b60200260200101818152505050505050508080611a9990612c2f565b915050611953565b505050915091565b6000611ab481611d3f565b600a5460ff1615611ad75760405162461bcd60e51b815260040161070990613095565b600a805460ff1916600117905560405133907fe260bbe81911ea5292accc26c8b035d1ffcb9b2e98cedf068d68cf42f5efef6490600090a250565b611b1b826106c6565b611b2481611d3f565b6107668383611db4565b6000611b3981611d3f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031603611c44576040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611bc1903090600401612a0a565b602060405180830381865afa158015611bde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c029190612a23565b90506000600854600754611c169190612a5a565b905080611c238684612a6d565b1015611c415760405162461bcd60e51b8152600401610709906130f1565b50505b611c586001600160a01b0385168385611fee565b50505050565b60068181548110611c6e57600080fd5b600091825260209091200154905081565b6000611c8a8361067d565b8210611ca85760405162461bcd60e51b815260040161070990612b48565b6000611cb3846111c9565b90506000818481518110611cc957611cc9612b58565b60200260200101519050600081604001511115611ce95760009250611d37565b60007f00000000000000000000000000000000000000000000000000000000000000008260600151611d1b9190612bbe565b90506000818360200151611d2f9190612a5a565b421015945050505b505092915050565b6109ce8133612166565b611d5382826117a2565b61079d5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611dbe82826117a2565b1561079d5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600260005403611e3d5760405162461bcd60e51b815260040161070990613135565b6002600055565b60025460ff1615611e675760405162461bcd60e51b81526004016107099061316c565b565b6001600160a01b0382166000908152600460205260409020548110611ea05760405162461bcd60e51b815260040161070990612b48565b6001600160a01b03821660009081526004602052604090208054611ec690600190612a6d565b81548110611ed657611ed6612b58565b906000526020600020906007020160046000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110611f1a57611f1a612b58565b6000918252602080832084546007939093020191825560018085015490830155600280850154908301556003808501549083015560048085015481840155600580860154908401805460ff191660ff909216151591909117905560069485015494909201939093556001600160a01b038516825290915260409020805480611fa457611fa461317c565b6000828152602081206007600019909301928302018181556001810182905560028101829055600381018290556004810182905560058101805460ff191690556006015590555050565b6107668363a9059cbb60e01b848460405160240161200d929190612eed565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526121bf565b61204c612251565b6002805460ff191690556000805160206134cf833981519152335b6040516120749190612a0a565b60405180910390a1565b611c58846323b872dd60e01b85858560405160240161200d93929190613192565b6120a7611e44565b6002805460ff191660011790556000805160206134ef8339815191526120673390565b804710156120ea5760405162461bcd60e51b8152600401610709906131e1565b6000826001600160a01b031682604051612103906131f1565b60006040518083038185875af1925050503d8060008114612140576040519150601f19603f3d011682016040523d82523d6000602084013e612145565b606091505b50509050806107665760405162461bcd60e51b815260040161070990613253565b61217082826117a2565b61079d5761217d81612273565b612188836020612285565b6040516020016121999291906132a9565b60408051601f198184030181529082905262461bcd60e51b82526107099160040161332f565b6000612214826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123f79092919063ffffffff16565b90508051600014806122355750808060200190518101906122359190612ecc565b6107665760405162461bcd60e51b815260040161070990613387565b60025460ff16611e675760405162461bcd60e51b8152600401610709906133c2565b60606105b06001600160a01b03831660145b60606000612294836002612bbe565b61229f906002612a5a565b6001600160401b038111156122b6576122b6612f05565b6040519080825280601f01601f1916602001820160405280156122e0576020820181803683370190505b509050600360fc1b816000815181106122fb576122fb612b58565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061232a5761232a612b58565b60200101906001600160f81b031916908160001a905350600061234e846002612bbe565b612359906001612a5a565b90505b60018111156123d1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061238d5761238d612b58565b1a60f81b8282815181106123a3576123a3612b58565b60200101906001600160f81b031916908160001a90535060049490941c936123ca816133d2565b905061235c565b5083156123f05760405162461bcd60e51b81526004016107099061341b565b9392505050565b6060612406848460008561240e565b949350505050565b6060824710156124305760405162461bcd60e51b81526004016107099061346e565b600080866001600160a01b0316858760405161244c919061347e565b60006040518083038185875af1925050503d8060008114612489576040519150601f19603f3d011682016040523d82523d6000602084013e61248e565b606091505b509150915061249f878383876124aa565b979650505050505050565b606083156124e95782516000036124e2576001600160a01b0385163b6124e25760405162461bcd60e51b8152600401610709906134be565b5081612406565b61240683838151156124fe5781518083602001fd5b8060405162461bcd60e51b8152600401610709919061332f565b60405180606001604052806125556040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b815260006020820181905260409091015290565b6001600160e01b031981165b81146109ce57600080fd5b80356105b081612569565b6000602082840312156125a0576125a0600080fd5b60006124068484612580565b8015155b82525050565b602081016105b082846125ac565b806125b0565b602081016105b082846125c4565b6001600160a01b031690565b60006105b0826125d8565b612575816125e4565b80356105b0816125ef565b60006020828403121561261857612618600080fd5b600061240684846125f8565b80612575565b80356105b081612624565b60006020828403121561264a5761264a600080fd5b6000612406848461262a565b6000806040838503121561266c5761266c600080fd5b600061267885856125f8565b92505060206126898582860161262a565b9150509250929050565b600080604083850312156126a9576126a9600080fd5b60006126b5858561262a565b9250506020612689858286016125f8565b60006126d283836125c4565b505060200190565b60006126e4825190565b80845260209384019383018060005b8381101561271857815161270788826126c6565b9750602083019250506001016126f3565b509495945050505050565b602080825281016123f081846126da565b60e08101612742828a6125c4565b61274f60208301896125c4565b61275c60408301886125c4565b61276960608301876125c4565b61277660808301866125c4565b61278360a08301856125ac565b61279060c08301846125c4565b98975050505050505050565b600080604083850312156127b2576127b2600080fd5b6000612678858561262a565b805160e08301906127cf84826125c4565b5060208201516127e260208501826125c4565b5060408201516127f560408501826125c4565b50606082015161280860608501826125c4565b50608082015161281b60808501826125c4565b5060a082015161282e60a08501826125ac565b5060c0820151611c5860c08501826125c4565b600061284d83836127be565b505060e00190565b600061285f825190565b80845260209384019383018060005b838110156127185781516128828882612841565b97506020830192505060010161286e565b602080825281016123f08184612855565b60006105b06128b86128b5846125d8565b90565b6125d8565b60006105b0826128a4565b60006105b0826128bd565b6125b0816128c8565b602081016105b082846128d3565b805160a08301906128fb84826125c4565b50602082015161290e60208501826125c4565b50604082015161292160408501826125c4565b50606082015161293460608501826125c4565b506080820151611c5860808501826125c4565b805160e083019061295884826128ea565b50602082015161296b60a08501826125ac565b506040820151611c5860c08501826125ac565b60e081016105b08284612947565b6040808252810161299d81856126da565b9050818103602083015261240681846126da565b6000806000606084860312156129c9576129c9600080fd5b60006129d586866125f8565b93505060206129e68682870161262a565b92505060406129f7868287016125f8565b9150509250925092565b6125b0816125e4565b602081016105b08284612a01565b80516105b081612624565b600060208284031215612a3857612a38600080fd5b60006124068484612a18565b634e487b7160e01b600052601160045260246000fd5b808201808211156105b0576105b0612a44565b818103818111156105b0576105b0612a44565b601b81526000602082017a14dd185ada5b99c81a5cc8185b1c9958591e48191a5cd8589b1959602a1b815291505b5060200190565b602080825281016105b081612a80565b602f81526000602082017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581526e103937b632b9903337b91039b2b63360891b602082015291505b5060400190565b602080825281016105b081612ac5565b600d81526000602082016c092dcecc2d8d2c840d2dcc8caf609b1b81529150612aae565b602080825281016105b081612b24565b634e487b7160e01b600052603260045260246000fd5b602381526000602082017f436f6f6c646f776e20706572696f6420686173206e6f742079657420656c61708152621cd95960ea1b60208201529150612b0d565b602080825281016105b081612b6e565b818102808215838204851417612bd657612bd6612a44565b5092915050565b634e487b7160e01b600052601260045260246000fd5b600082612c0257612c02612bdd565b500490565b60608101612c1582866125c4565b612c2260208301856125c4565b61240660408301846125c4565b60006000198203612c4257612c42612a44565b5060010190565b601081526000602082016f52617465206973207468652073616d6560801b81529150612aae565b602080825281016105b081612c49565b600e81526000602082016d125b9d985b1a59081c195c9a5bd960921b81529150612aae565b602080825281016105b081612c80565b60408101612cc382856125c4565b6123f060208301846125c4565b602281526000602082017f5374616b696e6720706572696f6420686173206e6f742079657420656c617073815261195960f21b60208201529150612b0d565b602080825281016105b081612cd0565b601d81526000602082017f5374616b696e672069732063757272656e746c792064697361626c656400000081529150612aae565b602080825281016105b081612d1f565b6016815260006020820175125b9d985b1a59081cdd185ada5b99c81c195c9a5bd960521b81529150612aae565b602080825281016105b081612d63565b600e81526000602082016d125b9d985b1a5908185b5bdd5b9d60921b81529150612aae565b602080825281016105b081612da0565b602981526000602082017f4e6f7420656e6f756768207265776172647320746f207265736572766520666f81526872207374616b696e6760b81b60208201529150612b0d565b602080825281016105b081612dd5565b60a08101612e3982886125c4565b612e4660208301876125c4565b612e5360408301866125c4565b612e6060608301856125c4565b612e6d60808301846125c4565b9695505050505050565b601b81526000602082017a436f6f6c646f776e20706572696f64206973207468652073616d6560281b81529150612aae565b602080825281016105b081612e77565b801515612575565b80516105b081612eb9565b600060208284031215612ee157612ee1600080fd5b60006124068484612ec1565b60408101612cc38285612a01565b601f01601f191690565b634e487b7160e01b600052604160045260246000fd5b612f2482612efb565b81018181106001600160401b0382111715612f4157612f41612f05565b6040525050565b6000612f5360405190565b90506106c18282612f1b565b600060a08284031215612f7457612f74600080fd5b612f7e60a0612f48565b90506000612f8c8484612a18565b8252506020612f9d84848301612a18565b6020830152506040612fb184828501612a18565b6040830152506060612fc584828501612a18565b6060830152506080612fd984828501612a18565b60808301525092915050565b600060e08284031215612ffa57612ffa600080fd5b6130046060612f48565b905060006130128484612f5f565b82525060a061302384848301612ec1565b60208301525060c061303784828501612ec1565b60408301525092915050565b600060e0828403121561305857613058600080fd5b60006124068484612fe5565b601a81526000602082017914dd185ada5b99c81a5cc8185b1c9958591e48195b98589b195960321b81529150612aae565b602080825281016105b081613064565b602f81526000602082017f4f7065726174696f6e20776f756c6420616666656374207374616b6564206f7281526e2072657365727665642066756e647360881b60208201529150612b0d565b602080825281016105b0816130a5565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081529150612aae565b602080825281016105b081613101565b601081526000602082016f14185d5cd8589b194e881c185d5cd95960821b81529150612aae565b602080825281016105b081613145565b634e487b7160e01b600052603160045260246000fd5b606081016131a08286612a01565b612c226020830185612a01565b601d81526000602082017f416464726573733a20696e73756666696369656e742062616c616e636500000081529150612aae565b602080825281016105b0816131ad565b60006105b0826128b5565b603a81526000602082017f416464726573733a20756e61626c6520746f2073656e642076616c75652c20728152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b60208201529150612b0d565b602080825281016105b0816131fc565b60005b8381101561327e578181015183820152602001613266565b50506000910152565b6000613291825190565b61329f818560208601613263565b9290920192915050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260170160006132d58285613287565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110191506124068284613287565b6000613305825190565b80845260208401935061331c818560208601613263565b61332581612efb565b9093019392505050565b602080825281016123f081846132fb565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b60208201529150612b0d565b602080825281016105b081613340565b601481526000602082017314185d5cd8589b194e881b9bdd081c185d5cd95960621b81529150612aae565b602080825281016105b081613397565b6000816133e1576133e1612a44565b506000190190565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e7491019081526000612aae565b602080825281016105b0816133e9565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b60208201529150612b0d565b602080825281016105b08161342b565b60006123f08284613287565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081529150612aae565b602080825281016105b08161348a56fe5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258a26469706673582212208bab8796a51c948db1bcc808f2271ef40343e82ac0ac49b0c9f3943ea4ee4b5664736f6c63430008120033",
  "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101f95760003560e01c806301ffc9a7146101fe57806304646a4914610227578063067cf7aa1461023d5780631b545a17146102455780631cfff51b14610258578063248a9ca31461026557806324d629ec14610278578063250284a81461029f57806328696de2146102a95780632e502e53146102b35780632f2ff15d146102e157806336568abe146102f4578063375d912514610307578063379607f51461031a5780633abac4671461032d5780633f4ba83a1461034057806345c9a55814610348578063584b62a11461035d5780635b9dac89146103835780635c975abb146103965780635ffc4fea146103a15780636198e339146103c15780636763c958146103d45780637418c300146103dd5780637713b578146103f05780637b0472f0146103f957806380ea3de11461040c578063817b1cd21461041f578063842e2981146104285780638456cb591461044857806391d14854146104505780639a4d8ba1146104635780639ae3269c14610483578063a217fddf146104a8578063cec695fa146104b0578063cf91ada0146104d0578063d0489c3a146104e3578063d11aca6214610504578063d547741f1461050c578063de05e7121461051f578063ea4a110414610532578063ebda439614610545578063f09a89d41461056c575b600080fd5b61021161020c36600461258b565b61057f565b60405161021e91906125b6565b60405180910390f35b61023060035481565b60405161021e91906125ca565b6102306105b6565b610230610253366004612603565b61067d565b600a546102119060ff1681565b610230610273366004612635565b6106c6565b6102307f000000000000000000000000000000000000000000000000000000000000000081565b610230620f424081565b6102b16106dc565b005b6102116102c1366004612656565b600c60209081526000928352604080842090915290825290205460ff1681565b6102b16102ef366004612693565b61074a565b6102b1610302366004612693565b61076b565b6102b1610315366004612656565b6107a1565b6102b1610328366004612635565b6107d9565b61023061033b366004612603565b6109d1565b6102b1610a32565b610350610a6d565b60405161021e9190612723565b61037061036b366004612656565b610ac5565b60405161021e9796959493929190612734565b6102b161039136600461279c565b610b25565b60025460ff16610211565b6102306103af366004612635565b60096020526000908152604090205481565b6102b16103cf366004612635565b610c61565b610230600b5481565b6102116103eb366004612656565b610e52565b61023060075481565b6102b161040736600461279c565b610ed4565b6102b161041a366004612635565b61115a565b61023060085481565b61043b610436366004612603565b6111c9565b60405161021e9190612893565b6102b1611772565b61021161045e366004612693565b6117a2565b610230610471366004612635565b60056020526000908152604090205481565b600a5461049b9061010090046001600160a01b031681565b60405161021e91906128dc565b610230600081565b6104c36104be366004612656565b6117cd565b60405161021e919061297e565b6102b16104de366004612693565b6118a0565b6104f66104f1366004612603565b6118b5565b60405161021e92919061298c565b6102b1611aa9565b6102b161051a366004612693565b611b12565b6102b161052d3660046129b1565b611b2e565b610230610540366004612635565b611c5e565b61049b7f000000000000000000000000000000000000000000000000000000000000000081565b61021161057a366004612656565b611c7f565b60006001600160e01b03198216637965db0b60e01b14806105b057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016106059190612a0a565b602060405180830381865afa158015610622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106469190612a23565b9050600060085460075461065a9190612a5a565b905080821161066c5760009250505090565b6106768183612a6d565b9250505090565b600a5460009061010090046001600160a01b03166106b157506001600160a01b031660009081526004602052604090205490565b6106ba826111c9565b5192915050565b919050565b6000908152600160208190526040909120015490565b60006106e781611d3f565b600a5460ff166107125760405162461bcd60e51b815260040161070990612ab5565b60405180910390fd5b600a805460ff1916905560405133907f9235e601663aec0db4f23459c059a6aadd04045aaf55631e7765d8999b0e31b090600090a250565b610753826106c6565b61075c81611d3f565b6107668383611d49565b505050565b6001600160a01b03811633146107935760405162461bcd60e51b815260040161070990612b14565b61079d8282611db4565b5050565b60006107ac81611d3f565b50600a80546001600160a01b0390931661010002610100600160a81b031990931692909217909155600b55565b6107e1611e1b565b6107e9611e44565b6107f23361067d565b81106108105760405162461bcd60e51b815260040161070990612b48565b600061081b336111c9565b9050600081838151811061083157610831612b58565b602002602001015190506108453384610e52565b6108615760405162461bcd60e51b815260040161070990612bae565b6000610871620f42406064612bbe565b608083015183516108829190612bbe565b61088c9190612bf3565b336000908152600460205260409020549091508410156108b0576108b03385611e69565b8151600880546000906108c4908490612a6d565b909155505081516060830151600090815260096020526040812080549091906108ee908490612a6d565b909155505060a08201511561092757336000908152600c6020908152604080832060c086015184529091529020805460ff191660011790555b80600760008282546109399190612a6d565b90915550508151610982903390610951908490612a5a565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190611fee565b815160405133917f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e916109b9919085908990612c07565b60405180910390a25050506109ce6001600055565b50565b600080806109de846111c9565b905060005b8151811015610a29578181815181106109fe576109fe612b58565b60200260200101516000015183610a159190612a5a565b925080610a2181612c2f565b9150506109e3565b50909392505050565b6000610a3d81611d3f565b610a45612044565b6000805160206134cf83398151915233604051610a629190612a0a565b60405180910390a150565b60606006805480602002602001604051908101604052809291908181526020018280548015610abb57602002820191906000526020600020905b815481526020019060010190808311610aa7575b5050505050905090565b60046020528160005260406000208181548110610ae157600080fd5b600091825260209091206007909102018054600182015460028301546003840154600485015460058601546006909601549497509295509093909260ff9091169087565b6000610b3081611d3f565b600083815260056020526040902054829003610b5e5760405162461bcd60e51b815260040161070990612c70565b60008311610b7e5760405162461bcd60e51b815260040161070990612ca5565b6000838152600560205260408120839055600654815b81811015610bdb578560068281548110610bb057610bb0612b58565b906000526020600020015403610bc95760019250610bdb565b80610bd381612c2f565b915050610b94565b5081610c1757600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018590555b336001600160a01b03167f3aebbb85b9698ba4e1588e9f25e8e3bb8d3c5fb5199f6b36b362e6775947b3838686604051610c52929190612cb5565b60405180910390a25050505050565b610c69611e1b565b610c71611e44565b610c7a3361067d565b8110610c985760405162461bcd60e51b815260040161070990612b48565b6000610ca3336111c9565b90506000818381518110610cb957610cb9612b58565b60200260200101519050610ccd3384611c7f565b610ce95760405162461bcd60e51b815260040161070990612d0f565b8060a00151610d3057336000908152600460205260409020805442919085908110610d1657610d16612b58565b906000526020600020906007020160020181905550610e09565b336000818152600460208181526040808420815160e0810183528751815287840151818501908152428285019081526060808b01519084019081526080808c015190850190815260a0808d0151151590860190815260c0808e018051918801918252885460018181018b55998e528b8e209851600790910290980197885595518789015593516002870155915160038601555197840197909755955160058301805491151560ff199283161790559551600690920191909155958552600c83528185209551855294909152909120805490911690911790555b805160405133917f3f2f29fa02cc34566ac167b446be0be9e0254cac18eda93b2dfe6a7a7c8affb991610e3e91908790612cb5565b60405180910390a250506109ce6001600055565b6000610e5d8361067d565b8210610e7b5760405162461bcd60e51b815260040161070990612b48565b6000610e86846111c9565b90506000818481518110610e9c57610e9c612b58565b6020026020010151905060008160400151118015610ecb57506003548160400151610ec79190612a5a565b4210155b95945050505050565b610edc611e1b565b610ee4611e44565b600a5460ff16610f065760405162461bcd60e51b815260040161070990612d53565b600081815260056020526040902054610f315760405162461bcd60e51b815260040161070990612d90565b60008211610f515760405162461bcd60e51b815260040161070990612dc5565b6000610f61620f42406064612bbe565b600083815260056020526040902054610f7a9085612bbe565b610f849190612bf3565b905080610f8f6105b6565b1015610fad5760405162461bcd60e51b815260040161070990612e1b565b8260086000828254610fbf9190612a5a565b909155505060008281526009602052604081208054859290610fe2908490612a5a565b925050819055508060076000828254610ffb9190612a5a565b9091555050336000818152600460208181526040808420815160e08101835289815242818501908152818401878152606083018b81528b89526005808852958920546080850190815260a085018a815260c086018b8152875460018082018a55988d5299909b2095516007909902909501978855925194870194909455516002860155915160038501559051938301939093559151918101805460ff19169215159290921790915590516006909101556110e1906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690308661207e565b60008281526005602090815260408083205433808552600490935292205490917f6381ea17a5324d29cc015352644672ead5185c1c61a0d3a521eda97e35cec97e918691429187919061113690600190612a6d565b604051611147959493929190612e2b565b60405180910390a25061079d6001600055565b600061116581611d3f565b81600354036111865760405162461bcd60e51b815260040161070990612ea9565b600382905560405133907f9304c247b6a1da4f8ed290a9b1016a028a06c48d17d9f174b32c546c531220b4906111bd9085906125ca565b60405180910390a25050565b600a5460609061010090046001600160a01b0316158061125d5750600a60019054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125b9190612ecc565b155b15611317576001600160a01b038216600090815260046020908152604080832080548251818502810185019093528083529193909284015b8282101561130c5760008481526020908190206040805160e0810182526007860290920180548352600180820154848601526002820154928401929092526003810154606084015260048101546080840152600581015460ff16151560a08401526006015460c08301529083529092019101611295565b505050509050919050565b6001600160a01b03808316600090815260046020819052604080832054600a549151631b545a1760e01b8152909461010090920490911691631b545a179161136191889101612a0a565b602060405180830381865afa15801561137e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a29190612a23565b905060005b8181101561148d57600a546040516367634afd60e11b815260009161010090046001600160a01b03169063cec695fa906113e79089908690600401612eed565b60e060405180830381865afa158015611404573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114289190613043565b9050600b5481600001516020015110801561146757506001600160a01b0386166000908152600c6020908152604080832085845290915290205460ff16155b1561147a578361147681612c2f565b9450505b508061148581612c2f565b9150506113a7565b506000826001600160401b038111156114a8576114a8612f05565b60405190808252806020026020018201604052801561151b57816020015b6115086040518060e001604052806000815260200160008152602001600081526020016000815260200160008152602001600015158152602001600081525090565b8152602001906001900390816114c65790505b5090506000805b6001600160a01b038716600090815260046020526040902054811015611610576001600160a01b038716600090815260046020526040902080548290811061156c5761156c612b58565b60009182526020918290206040805160e0810182526007909302909101805483526001810154938301939093526002830154908201526003820154606082015260048201546080820152600582015460ff16151560a082015260069091015460c082015283518490849081106115e4576115e4612b58565b602002602001018190525081806115fa90612c2f565b925050808061160890612c2f565b915050611522565b5060005b8381101561176757600a546040516367634afd60e11b815260009161010090046001600160a01b03169063cec695fa90611654908b908690600401612eed565b60e060405180830381865afa158015611671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116959190613043565b9050600b548160000151602001511080156116d457506001600160a01b0388166000908152600c6020908152604080832085845290915290205460ff16155b15611754576040805160e0810182528251518152825160209081015190820152825182015191810191909152815160609081015190820152815160809081015190820152600160a082015260c08101839052845185908590811061173a5761173a612b58565b6020026020010181905250828061175090612c2f565b9350505b508061175f81612c2f565b915050611614565b509095945050505050565b600061177d81611d3f565b61178561209f565b6000805160206134ef83398151915233604051610a629190612a0a565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6117d5612518565b6117de8361067d565b82106117fc5760405162461bcd60e51b815260040161070990612b48565b6000611807846111c9565b9050600081848151811061181d5761181d612b58565b6020026020010151905060006040518060a00160405280836000015181526020018360200151815260200183604001518152602001836060015181526020018360800151815250905060405180606001604052808281526020016118818888611c7f565b151581526020016118928888610e52565b151590529695505050505050565b60006118ab81611d3f565b61076682846120ca565b60608060006118c3846111c9565b8051909150806001600160401b038111156118e0576118e0612f05565b604051908082528060200260200182016040528015611909578160200160208202803683370190505b509350806001600160401b0381111561192457611924612f05565b60405190808252806020026020018201604052801561194d578160200160208202803683370190505b50925060005b81811015611aa157600083828151811061196f5761196f612b58565b60200260200101519050806000015186838151811061199057611990612b58565b60200260200101818152505060008160200151426119ae9190612a6d565b905060007f000000000000000000000000000000000000000000000000000000000000000083606001516119e29190612bbe565b9050808211156119f0578091505b6000808211611a00576000611a1d565b81611a1384670de0b6b3a7640000612bbe565b611a1d9190612bf3565b9050600084608001518560000151611a359190612bbe565b9050611a45620f42406064612bbe565b611a5790670de0b6b3a7640000612bbe565b611a618383612bbe565b611a6b9190612bf3565b898781518110611a7d57611a7d612b58565b60200260200101818152505050505050508080611a9990612c2f565b915050611953565b505050915091565b6000611ab481611d3f565b600a5460ff1615611ad75760405162461bcd60e51b815260040161070990613095565b600a805460ff1916600117905560405133907fe260bbe81911ea5292accc26c8b035d1ffcb9b2e98cedf068d68cf42f5efef6490600090a250565b611b1b826106c6565b611b2481611d3f565b6107668383611db4565b6000611b3981611d3f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031603611c44576040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611bc1903090600401612a0a565b602060405180830381865afa158015611bde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c029190612a23565b90506000600854600754611c169190612a5a565b905080611c238684612a6d565b1015611c415760405162461bcd60e51b8152600401610709906130f1565b50505b611c586001600160a01b0385168385611fee565b50505050565b60068181548110611c6e57600080fd5b600091825260209091200154905081565b6000611c8a8361067d565b8210611ca85760405162461bcd60e51b815260040161070990612b48565b6000611cb3846111c9565b90506000818481518110611cc957611cc9612b58565b60200260200101519050600081604001511115611ce95760009250611d37565b60007f00000000000000000000000000000000000000000000000000000000000000008260600151611d1b9190612bbe565b90506000818360200151611d2f9190612a5a565b421015945050505b505092915050565b6109ce8133612166565b611d5382826117a2565b61079d5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611dbe82826117a2565b1561079d5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600260005403611e3d5760405162461bcd60e51b815260040161070990613135565b6002600055565b60025460ff1615611e675760405162461bcd60e51b81526004016107099061316c565b565b6001600160a01b0382166000908152600460205260409020548110611ea05760405162461bcd60e51b815260040161070990612b48565b6001600160a01b03821660009081526004602052604090208054611ec690600190612a6d565b81548110611ed657611ed6612b58565b906000526020600020906007020160046000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110611f1a57611f1a612b58565b6000918252602080832084546007939093020191825560018085015490830155600280850154908301556003808501549083015560048085015481840155600580860154908401805460ff191660ff909216151591909117905560069485015494909201939093556001600160a01b038516825290915260409020805480611fa457611fa461317c565b6000828152602081206007600019909301928302018181556001810182905560028101829055600381018290556004810182905560058101805460ff191690556006015590555050565b6107668363a9059cbb60e01b848460405160240161200d929190612eed565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526121bf565b61204c612251565b6002805460ff191690556000805160206134cf833981519152335b6040516120749190612a0a565b60405180910390a1565b611c58846323b872dd60e01b85858560405160240161200d93929190613192565b6120a7611e44565b6002805460ff191660011790556000805160206134ef8339815191526120673390565b804710156120ea5760405162461bcd60e51b8152600401610709906131e1565b6000826001600160a01b031682604051612103906131f1565b60006040518083038185875af1925050503d8060008114612140576040519150601f19603f3d011682016040523d82523d6000602084013e612145565b606091505b50509050806107665760405162461bcd60e51b815260040161070990613253565b61217082826117a2565b61079d5761217d81612273565b612188836020612285565b6040516020016121999291906132a9565b60408051601f198184030181529082905262461bcd60e51b82526107099160040161332f565b6000612214826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123f79092919063ffffffff16565b90508051600014806122355750808060200190518101906122359190612ecc565b6107665760405162461bcd60e51b815260040161070990613387565b60025460ff16611e675760405162461bcd60e51b8152600401610709906133c2565b60606105b06001600160a01b03831660145b60606000612294836002612bbe565b61229f906002612a5a565b6001600160401b038111156122b6576122b6612f05565b6040519080825280601f01601f1916602001820160405280156122e0576020820181803683370190505b509050600360fc1b816000815181106122fb576122fb612b58565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061232a5761232a612b58565b60200101906001600160f81b031916908160001a905350600061234e846002612bbe565b612359906001612a5a565b90505b60018111156123d1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061238d5761238d612b58565b1a60f81b8282815181106123a3576123a3612b58565b60200101906001600160f81b031916908160001a90535060049490941c936123ca816133d2565b905061235c565b5083156123f05760405162461bcd60e51b81526004016107099061341b565b9392505050565b6060612406848460008561240e565b949350505050565b6060824710156124305760405162461bcd60e51b81526004016107099061346e565b600080866001600160a01b0316858760405161244c919061347e565b60006040518083038185875af1925050503d8060008114612489576040519150601f19603f3d011682016040523d82523d6000602084013e61248e565b606091505b509150915061249f878383876124aa565b979650505050505050565b606083156124e95782516000036124e2576001600160a01b0385163b6124e25760405162461bcd60e51b8152600401610709906134be565b5081612406565b61240683838151156124fe5781518083602001fd5b8060405162461bcd60e51b8152600401610709919061332f565b60405180606001604052806125556040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b815260006020820181905260409091015290565b6001600160e01b031981165b81146109ce57600080fd5b80356105b081612569565b6000602082840312156125a0576125a0600080fd5b60006124068484612580565b8015155b82525050565b602081016105b082846125ac565b806125b0565b602081016105b082846125c4565b6001600160a01b031690565b60006105b0826125d8565b612575816125e4565b80356105b0816125ef565b60006020828403121561261857612618600080fd5b600061240684846125f8565b80612575565b80356105b081612624565b60006020828403121561264a5761264a600080fd5b6000612406848461262a565b6000806040838503121561266c5761266c600080fd5b600061267885856125f8565b92505060206126898582860161262a565b9150509250929050565b600080604083850312156126a9576126a9600080fd5b60006126b5858561262a565b9250506020612689858286016125f8565b60006126d283836125c4565b505060200190565b60006126e4825190565b80845260209384019383018060005b8381101561271857815161270788826126c6565b9750602083019250506001016126f3565b509495945050505050565b602080825281016123f081846126da565b60e08101612742828a6125c4565b61274f60208301896125c4565b61275c60408301886125c4565b61276960608301876125c4565b61277660808301866125c4565b61278360a08301856125ac565b61279060c08301846125c4565b98975050505050505050565b600080604083850312156127b2576127b2600080fd5b6000612678858561262a565b805160e08301906127cf84826125c4565b5060208201516127e260208501826125c4565b5060408201516127f560408501826125c4565b50606082015161280860608501826125c4565b50608082015161281b60808501826125c4565b5060a082015161282e60a08501826125ac565b5060c0820151611c5860c08501826125c4565b600061284d83836127be565b505060e00190565b600061285f825190565b80845260209384019383018060005b838110156127185781516128828882612841565b97506020830192505060010161286e565b602080825281016123f08184612855565b60006105b06128b86128b5846125d8565b90565b6125d8565b60006105b0826128a4565b60006105b0826128bd565b6125b0816128c8565b602081016105b082846128d3565b805160a08301906128fb84826125c4565b50602082015161290e60208501826125c4565b50604082015161292160408501826125c4565b50606082015161293460608501826125c4565b506080820151611c5860808501826125c4565b805160e083019061295884826128ea565b50602082015161296b60a08501826125ac565b506040820151611c5860c08501826125ac565b60e081016105b08284612947565b6040808252810161299d81856126da565b9050818103602083015261240681846126da565b6000806000606084860312156129c9576129c9600080fd5b60006129d586866125f8565b93505060206129e68682870161262a565b92505060406129f7868287016125f8565b9150509250925092565b6125b0816125e4565b602081016105b08284612a01565b80516105b081612624565b600060208284031215612a3857612a38600080fd5b60006124068484612a18565b634e487b7160e01b600052601160045260246000fd5b808201808211156105b0576105b0612a44565b818103818111156105b0576105b0612a44565b601b81526000602082017a14dd185ada5b99c81a5cc8185b1c9958591e48191a5cd8589b1959602a1b815291505b5060200190565b602080825281016105b081612a80565b602f81526000602082017f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636581526e103937b632b9903337b91039b2b63360891b602082015291505b5060400190565b602080825281016105b081612ac5565b600d81526000602082016c092dcecc2d8d2c840d2dcc8caf609b1b81529150612aae565b602080825281016105b081612b24565b634e487b7160e01b600052603260045260246000fd5b602381526000602082017f436f6f6c646f776e20706572696f6420686173206e6f742079657420656c61708152621cd95960ea1b60208201529150612b0d565b602080825281016105b081612b6e565b818102808215838204851417612bd657612bd6612a44565b5092915050565b634e487b7160e01b600052601260045260246000fd5b600082612c0257612c02612bdd565b500490565b60608101612c1582866125c4565b612c2260208301856125c4565b61240660408301846125c4565b60006000198203612c4257612c42612a44565b5060010190565b601081526000602082016f52617465206973207468652073616d6560801b81529150612aae565b602080825281016105b081612c49565b600e81526000602082016d125b9d985b1a59081c195c9a5bd960921b81529150612aae565b602080825281016105b081612c80565b60408101612cc382856125c4565b6123f060208301846125c4565b602281526000602082017f5374616b696e6720706572696f6420686173206e6f742079657420656c617073815261195960f21b60208201529150612b0d565b602080825281016105b081612cd0565b601d81526000602082017f5374616b696e672069732063757272656e746c792064697361626c656400000081529150612aae565b602080825281016105b081612d1f565b6016815260006020820175125b9d985b1a59081cdd185ada5b99c81c195c9a5bd960521b81529150612aae565b602080825281016105b081612d63565b600e81526000602082016d125b9d985b1a5908185b5bdd5b9d60921b81529150612aae565b602080825281016105b081612da0565b602981526000602082017f4e6f7420656e6f756768207265776172647320746f207265736572766520666f81526872207374616b696e6760b81b60208201529150612b0d565b602080825281016105b081612dd5565b60a08101612e3982886125c4565b612e4660208301876125c4565b612e5360408301866125c4565b612e6060608301856125c4565b612e6d60808301846125c4565b9695505050505050565b601b81526000602082017a436f6f6c646f776e20706572696f64206973207468652073616d6560281b81529150612aae565b602080825281016105b081612e77565b801515612575565b80516105b081612eb9565b600060208284031215612ee157612ee1600080fd5b60006124068484612ec1565b60408101612cc38285612a01565b601f01601f191690565b634e487b7160e01b600052604160045260246000fd5b612f2482612efb565b81018181106001600160401b0382111715612f4157612f41612f05565b6040525050565b6000612f5360405190565b90506106c18282612f1b565b600060a08284031215612f7457612f74600080fd5b612f7e60a0612f48565b90506000612f8c8484612a18565b8252506020612f9d84848301612a18565b6020830152506040612fb184828501612a18565b6040830152506060612fc584828501612a18565b6060830152506080612fd984828501612a18565b60808301525092915050565b600060e08284031215612ffa57612ffa600080fd5b6130046060612f48565b905060006130128484612f5f565b82525060a061302384848301612ec1565b60208301525060c061303784828501612ec1565b60408301525092915050565b600060e0828403121561305857613058600080fd5b60006124068484612fe5565b601a81526000602082017914dd185ada5b99c81a5cc8185b1c9958591e48195b98589b195960321b81529150612aae565b602080825281016105b081613064565b602f81526000602082017f4f7065726174696f6e20776f756c6420616666656374207374616b6564206f7281526e2072657365727665642066756e647360881b60208201529150612b0d565b602080825281016105b0816130a5565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081529150612aae565b602080825281016105b081613101565b601081526000602082016f14185d5cd8589b194e881c185d5cd95960821b81529150612aae565b602080825281016105b081613145565b634e487b7160e01b600052603160045260246000fd5b606081016131a08286612a01565b612c226020830185612a01565b601d81526000602082017f416464726573733a20696e73756666696369656e742062616c616e636500000081529150612aae565b602080825281016105b0816131ad565b60006105b0826128b5565b603a81526000602082017f416464726573733a20756e61626c6520746f2073656e642076616c75652c20728152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b60208201529150612b0d565b602080825281016105b0816131fc565b60005b8381101561327e578181015183820152602001613266565b50506000910152565b6000613291825190565b61329f818560208601613263565b9290920192915050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260170160006132d58285613287565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110191506124068284613287565b6000613305825190565b80845260208401935061331c818560208601613263565b61332581612efb565b9093019392505050565b602080825281016123f081846132fb565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e8152691bdd081cdd58d8d9595960b21b60208201529150612b0d565b602080825281016105b081613340565b601481526000602082017314185d5cd8589b194e881b9bdd081c185d5cd95960621b81529150612aae565b602080825281016105b081613397565b6000816133e1576133e1612a44565b506000190190565b60208082527f537472696e67733a20686578206c656e67746820696e73756666696369656e7491019081526000612aae565b602080825281016105b0816133e9565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f8152651c8818d85b1b60d21b60208201529150612b0d565b602080825281016105b08161342b565b60006123f08284613287565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081529150612aae565b602080825281016105b08161348a56fe5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258a26469706673582212208bab8796a51c948db1bcc808f2271ef40343e82ac0ac49b0c9f3943ea4ee4b5664736f6c63430008120033",
  "devdoc": {
    "details": "Implementation of a staking contract V2 for MasaToken. This contract allows users to stake their MasaTokens for a specified period and earn interest based on the staking period. The contract includes functionalities for staking, unstaking, and querying staked balances and earned interest. Provides backward compatibility to query pre-migration stakes from MasaStakingV1. Supports new stakes after migration and a query function for historical stakes based on the pause timestamp of V1 contract.",
    "events": {
      "Paused(address)": {
        "details": "Emitted when the pause is triggered by `account`."
      },
      "RoleAdminChanged(bytes32,bytes32,bytes32)": {
        "details": "Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite {RoleAdminChanged} not being emitted signaling this. _Available since v3.1._"
      },
      "RoleGranted(bytes32,address,address)": {
        "details": "Emitted when `account` is granted `role`. `sender` is the account that originated the contract call, an admin role bearer except when using {AccessControl-_setupRole}."
      },
      "RoleRevoked(bytes32,address,address)": {
        "details": "Emitted when `account` is revoked `role`. `sender` is the account that originated the contract call:   - if using `revokeRole`, it is the admin role bearer   - if using `renounceRole`, it is the role bearer (i.e. `account`)"
      },
      "Unpaused(address)": {
        "details": "Emitted when the pause is lifted by `account`."
      }
    },
    "kind": "dev",
    "methods": {
      "canClaimStake(address,uint256)": {
        "details": "Determines if a stake is eligible for claiming based on the current timestamp.",
        "params": {
          "_index": "The index of the stake within the user's array of stakes.",
          "_user": "The address of the user querying claim eligibility."
        },
        "returns": {
          "canClaim": "True if the stake can be claimed, false otherwise."
        }
      },
      "canUnlockStake(address,uint256)": {
        "details": "Determines if a stake is eligible for unlocking based on the current timestamp.",
        "params": {
          "_index": "The index of the stake within the user's array of stakes.",
          "_user": "The address of the user querying unlock eligibility."
        },
        "returns": {
          "canUnlock": "True if the stake can be unlocked, false otherwise."
        }
      },
      "claim(uint256)": {
        "details": "Allows users to claim a specific stake identified by its index after the cooldown period has fully elapsed.",
        "params": {
          "_index": "The index of the stake within the user's array of stakes to be claimed."
        }
      },
      "constructor": {
        "details": "Sets the initial values for the MasaToken address and initializes roles and default interest rates for different periods.",
        "params": {
          "_admin": "The address of the admin account.",
          "_cooldownPeriod": "The period for unstaking in seconds.",
          "_masaStakingV1": "The address of the MasaStakingV1 contract.",
          "_masaTokenAddress": "The address of the MasaToken contract.",
          "_periods": "An array of periods for which interest rates are set.",
          "_rewardsReserved": "The rewards reserved for staking.",
          "_secondsForPeriod": "The number of seconds for each staking period.",
          "_stakingV1Timestamp": "The timestamp when V1 is considered outdated.",
          "_totalStaked": "The total staked amount.",
          "_totalStakedForPeriod": "An array of total staked amounts for each period."
        }
      },
      "disableStaking()": {
        "details": "This function can only be called by an account with the DEFAULT_ADMIN_ROLE. It sets the `stakingEnabled` state variable to false."
      },
      "enableStaking()": {
        "details": "This function can only be called by an account with the DEFAULT_ADMIN_ROLE. It sets the `stakingEnabled` state variable to true."
      },
      "getPeriods()": {
        "details": "Returns the periods for which interest rates have been set.",
        "returns": {
          "_0": "An array of periods."
        }
      },
      "getRoleAdmin(bytes32)": {
        "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}."
      },
      "getUserStake(address,uint256)": {
        "details": "Returns details of a specific stake for a user, including whether it can be unstaked.",
        "params": {
          "_index": "The index of the stake in the user's stakes array.",
          "_user": "The address of the user."
        },
        "returns": {
          "_0": "StakeDetails The details of the stake."
        }
      },
      "getUserStakeCount(address)": {
        "details": "Returns the number of stakes a user has made.",
        "params": {
          "_user": "The address of the user."
        },
        "returns": {
          "_0": "The number of stakes."
        }
      },
      "getUserStakedBalance(address)": {
        "details": "Returns the total staked balance of a user by summing up the amounts in all their stakes.",
        "params": {
          "_user": "The address of the user whose total staked balance is being queried."
        },
        "returns": {
          "_0": "uint256 The total staked balance of the user."
        }
      },
      "getUserStakes(address)": {
        "details": "Returns the stakes of a user.",
        "params": {
          "_user": "The address of the user."
        },
        "returns": {
          "_0": "An array of stakes."
        }
      },
      "getUserStakesWithInterest(address)": {
        "details": "Returns the principal amounts and interest earned for each stake of a user This function calculates the interest based on the elapsed time since each stake was made.",
        "params": {
          "_user": "The address of the user whose stakes and interest are being queried."
        },
        "returns": {
          "interestEarned": "An array of the interest earned for each stake of the user.",
          "principalAmounts": "An array of the principal amounts for each stake of the user."
        }
      },
      "grantRole(bytes32,address)": {
        "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event."
      },
      "hasRole(bytes32,address)": {
        "details": "Returns `true` if `account` has been granted `role`."
      },
      "pause()": {
        "details": "Pauses all staking and unstaking functions. Only callable by accounts with the DEFAULT_ADMIN_ROLE."
      },
      "paused()": {
        "details": "Returns true if the contract is paused, and false otherwise."
      },
      "renounceRole(bytes32,address)": {
        "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event."
      },
      "rescueERC20Token(address,uint256,address)": {
        "params": {
          "_amount": "Token amount",
          "_receiver": "Receiver address",
          "_token": "Token contract address"
        }
      },
      "rescueNativeToken(uint256,address)": {
        "params": {
          "_amount": "Token amount",
          "_receiver": "Receiver address"
        }
      },
      "revokeRole(bytes32,address)": {
        "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event."
      },
      "rewardsNotReserved()": {
        "details": "Returns the amount of rewards not reserved for staking.",
        "returns": {
          "_0": "uint256 The amount of rewards not reserved for staking."
        }
      },
      "setCooldownPeriod(uint256)": {
        "details": "Updates the cooldown period for unstaking. Only callable by accounts with the DEFAULT_ADMIN_ROLE.",
        "params": {
          "_cooldownPeriod": "The new cooldown period in seconds."
        }
      },
      "setInterestRate(uint256,uint256)": {
        "details": "Updates the interest rate for a specific staking period. Only callable by accounts with the DEFAULT_ADMIN_ROLE.",
        "params": {
          "_period": "The staking period to update the interest rate for.",
          "_rate": "The new interest rate for the specified staking period."
        }
      },
      "setMasaStakingV1(address,uint256)": {
        "details": "Updates the reference to the MasaStakingV1 contract and the paused timestamp. Only callable by accounts with the DEFAULT_ADMIN_ROLE.",
        "params": {
          "_masaStakingV1": "The address of the MasaStakingV1 contract.",
          "_stakingV1Timestamp": "The timestamp when V1 is considered outdated"
        }
      },
      "stake(uint256,uint256)": {
        "details": "Allows users to stake a specified amount of MasaToken for a specified period. Stakes are recorded in the stakes mapping, and users are added to the allStakers array if they haven't staked before.",
        "params": {
          "_amount": "The amount of MasaToken to be staked.",
          "_period": "The period for which the MasaToken is staked, in months."
        }
      },
      "supportsInterface(bytes4)": {
        "details": "See {IERC165-supportsInterface}."
      },
      "unlock(uint256)": {
        "details": "Allows users to unlock a specific stake identified by its index after the staking period has fully elapsed.",
        "params": {
          "_index": "The index of the stake within the user's array of stakes to be unlocked."
        }
      },
      "unpause()": {
        "details": "Unpauses all staking and unstaking functions. Only callable by accounts with the DEFAULT_ADMIN_ROLE."
      }
    },
    "stateVariables": {
      "stakingEnabled": {
        "details": "State variable to control the availability of staking functionality."
      }
    },
    "version": 1
  },
  "userdoc": {
    "kind": "user",
    "methods": {
      "disableStaking()": {
        "notice": "Disables the staking functionality."
      },
      "enableStaking()": {
        "notice": "Enables the staking functionality."
      },
      "rescueERC20Token(address,uint256,address)": {
        "notice": "Transfer tokens."
      },
      "rescueNativeToken(uint256,address)": {
        "notice": "Transfer native tokens."
      }
    },
    "version": 1
  },
  "storageLayout": {
    "storage": [
      {
        "astId": 507,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "_status",
        "offset": 0,
        "slot": "0",
        "type": "t_uint256"
      },
      {
        "astId": 24,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "_roles",
        "offset": 0,
        "slot": "1",
        "type": "t_mapping(t_bytes32,t_struct(RoleData)19_storage)"
      },
      {
        "astId": 406,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "_paused",
        "offset": 0,
        "slot": "2",
        "type": "t_bool"
      },
      {
        "astId": 3878,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "cooldownPeriod",
        "offset": 0,
        "slot": "3",
        "type": "t_uint256"
      },
      {
        "astId": 3884,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "stakes",
        "offset": 0,
        "slot": "4",
        "type": "t_mapping(t_address,t_array(t_struct(Stake)3860_storage)dyn_storage)"
      },
      {
        "astId": 3888,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "interestRates",
        "offset": 0,
        "slot": "5",
        "type": "t_mapping(t_uint256,t_uint256)"
      },
      {
        "astId": 3891,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "periods",
        "offset": 0,
        "slot": "6",
        "type": "t_array(t_uint256)dyn_storage"
      },
      {
        "astId": 3893,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "rewardsReserved",
        "offset": 0,
        "slot": "7",
        "type": "t_uint256"
      },
      {
        "astId": 3895,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "totalStaked",
        "offset": 0,
        "slot": "8",
        "type": "t_uint256"
      },
      {
        "astId": 3899,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "totalStakedForPeriod",
        "offset": 0,
        "slot": "9",
        "type": "t_mapping(t_uint256,t_uint256)"
      },
      {
        "astId": 3902,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "stakingEnabled",
        "offset": 0,
        "slot": "10",
        "type": "t_bool"
      },
      {
        "astId": 3905,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "masaStakingV1",
        "offset": 1,
        "slot": "10",
        "type": "t_contract(MasaStaking)3818"
      },
      {
        "astId": 3907,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "stakingV1Timestamp",
        "offset": 0,
        "slot": "11",
        "type": "t_uint256"
      },
      {
        "astId": 3913,
        "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
        "label": "importedStakes",
        "offset": 0,
        "slot": "12",
        "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))"
      }
    ],
    "types": {
      "t_address": {
        "encoding": "inplace",
        "label": "address",
        "numberOfBytes": "20"
      },
      "t_array(t_struct(Stake)3860_storage)dyn_storage": {
        "base": "t_struct(Stake)3860_storage",
        "encoding": "dynamic_array",
        "label": "struct MasaStakingV2.Stake[]",
        "numberOfBytes": "32"
      },
      "t_array(t_uint256)dyn_storage": {
        "base": "t_uint256",
        "encoding": "dynamic_array",
        "label": "uint256[]",
        "numberOfBytes": "32"
      },
      "t_bool": {
        "encoding": "inplace",
        "label": "bool",
        "numberOfBytes": "1"
      },
      "t_bytes32": {
        "encoding": "inplace",
        "label": "bytes32",
        "numberOfBytes": "32"
      },
      "t_contract(MasaStaking)3818": {
        "encoding": "inplace",
        "label": "contract MasaStaking",
        "numberOfBytes": "20"
      },
      "t_mapping(t_address,t_array(t_struct(Stake)3860_storage)dyn_storage)": {
        "encoding": "mapping",
        "key": "t_address",
        "label": "mapping(address => struct MasaStakingV2.Stake[])",
        "numberOfBytes": "32",
        "value": "t_array(t_struct(Stake)3860_storage)dyn_storage"
      },
      "t_mapping(t_address,t_bool)": {
        "encoding": "mapping",
        "key": "t_address",
        "label": "mapping(address => bool)",
        "numberOfBytes": "32",
        "value": "t_bool"
      },
      "t_mapping(t_address,t_mapping(t_uint256,t_bool))": {
        "encoding": "mapping",
        "key": "t_address",
        "label": "mapping(address => mapping(uint256 => bool))",
        "numberOfBytes": "32",
        "value": "t_mapping(t_uint256,t_bool)"
      },
      "t_mapping(t_bytes32,t_struct(RoleData)19_storage)": {
        "encoding": "mapping",
        "key": "t_bytes32",
        "label": "mapping(bytes32 => struct AccessControl.RoleData)",
        "numberOfBytes": "32",
        "value": "t_struct(RoleData)19_storage"
      },
      "t_mapping(t_uint256,t_bool)": {
        "encoding": "mapping",
        "key": "t_uint256",
        "label": "mapping(uint256 => bool)",
        "numberOfBytes": "32",
        "value": "t_bool"
      },
      "t_mapping(t_uint256,t_uint256)": {
        "encoding": "mapping",
        "key": "t_uint256",
        "label": "mapping(uint256 => uint256)",
        "numberOfBytes": "32",
        "value": "t_uint256"
      },
      "t_struct(RoleData)19_storage": {
        "encoding": "inplace",
        "label": "struct AccessControl.RoleData",
        "members": [
          {
            "astId": 16,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "members",
            "offset": 0,
            "slot": "0",
            "type": "t_mapping(t_address,t_bool)"
          },
          {
            "astId": 18,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "adminRole",
            "offset": 0,
            "slot": "1",
            "type": "t_bytes32"
          }
        ],
        "numberOfBytes": "64"
      },
      "t_struct(Stake)3860_storage": {
        "encoding": "inplace",
        "label": "struct MasaStakingV2.Stake",
        "members": [
          {
            "astId": 3847,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "amount",
            "offset": 0,
            "slot": "0",
            "type": "t_uint256"
          },
          {
            "astId": 3849,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "startTime",
            "offset": 0,
            "slot": "1",
            "type": "t_uint256"
          },
          {
            "astId": 3851,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "unlockTime",
            "offset": 0,
            "slot": "2",
            "type": "t_uint256"
          },
          {
            "astId": 3853,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "period",
            "offset": 0,
            "slot": "3",
            "type": "t_uint256"
          },
          {
            "astId": 3855,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "interestRate",
            "offset": 0,
            "slot": "4",
            "type": "t_uint256"
          },
          {
            "astId": 3857,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "imported",
            "offset": 0,
            "slot": "5",
            "type": "t_bool"
          },
          {
            "astId": 3859,
            "contract": "contracts/MasaStakingV2.sol:MasaStakingV2",
            "label": "importedIndex",
            "offset": 0,
            "slot": "6",
            "type": "t_uint256"
          }
        ],
        "numberOfBytes": "224"
      },
      "t_uint256": {
        "encoding": "inplace",
        "label": "uint256",
        "numberOfBytes": "32"
      }
    }
  }
}