# MineStatus

```solidity
 function MineStatus(address user)public view override returns(uint256){           
        uint256 start = blockStatus(_mineInfo[user][1]);
        uint256 end = blockStatus(block.number);       
        uint LEC_amount = start.sub(end);
        LEC_amount = LEC_amount.mul(_mineInfo[user][2]).div(_totalPower);
        return _mineInfo[user][3].add(LEC_amount);       
    }
```

**This function is to check the amount of LEC that an address  is currently mining**. Let's disassemble the code and explain how it is implemented step by step.

\
Let's first focus on the [`_mineInfo[user][1]`](https://to101380.gitbook.io/minerpunk/document/mine-interface/mineinfo) section below. [As mentioned earlier](https://to101380.gitbook.io/minerpunk/document/mine-interface/mineinfo), this is the mapping of the **block number** that will be stored when the token balance changes.

Then move your eyes to the `blockStatus`,  which can view the mining pool inventory of a certain block number.

If you forget what blockStatus is, you can click [here](https://to101380.gitbook.io/minerpunk/document/mine-interface/blockstatus).

It can be understood that `start` represents the mining pool inventory of the block number when the token balance changed last time. `end` is the mine pool inventory of the current block number.

<pre><code><strong>uint256 start = blockStatus(_mineInfo[user][1]);
</strong><strong>uint256 end = blockStatus(block.number); 
</strong></code></pre>

Know the inventory of the mining pool of these two block numbers, and subtract them to know how much LEC has been mined.

```
 uint LEC_amount = start. Sub(end);
```

These mined LECs are not necessarily all yours, but it depends on how much power you have within the scope. The LEC dug out is multiplied by your computing power percentage, which is the amount of LEC you get.

\*\*[`_mineInfo[user][2]`](https://to101380.gitbook.io/minerpunk/document/mine-interface/mineinfo)is the power held by address.\*\*

```
 LEC_amount = LEC_amount.mul(_mineInfo[user][2]).div(_totalPower);
```

Finally, add the currently mined LEC to the LEC number already stored in [`_mineInfo[user][3]`](https://to101380.gitbook.io/minerpunk/document/mine-interface/mineinfo) to get the currently mined LEC number.

```
_mineInfo[user][3].add(LEC_amount);
```
