How Does Staking Smart Contract Work on Ethereum Blockchain?

In order to build a staking Token dApp on Ethereum using Solidity where users can stake x amount of your ERC20 tokens to use the dApp, you can create it without requiring to create LP Token and its pairs. One can start with a simple smart contract for just storing the token and then adding the mechanism to trigger staking. 

You can deploy it to Trustpad etc. for IDO, once you have staked the x amount of tokens on your platform for x % APR.

To include staking for a ERC20 staking dApp, mapping address is required i-e mapping(address => uint) staked.

Then when you want to check if the user is allowed to use your dApp, check what is his balance in the “staked” mapping.

So when a user calls the stake function, the x number of tokens from the user is moved to the owner’s contract(using ERC20 mechanism). Then convert the user’s balance to Staked. 

Here is the example of a staking smart contract on Github built with Solidity on top of the Ethereum Blockchain.