I'm building a dapp where users must stake x amount of my token to use the dapp, but I'm stuck.

Do I have to create LP TOKEN and get LP pair address so all the staked token on my dapp will go to that LP?

Or do I have to create a staking contract that will just hold the token people stake, in this case thats a timelock contract not staking?

The staking mechanism I want to deploy is IDO platforms (Trustpad for example).

To be able to participate in any IDO you have to stake x amount of the platform token, and you will get 10% apr for example.

I have no problem with coding, but need to understand the logic behind this mechanism.

1 Answer 1


In your smart contract, you can create a mapping address->uint staked.

Whenever somebody calls the stake function, you move the necessary amount of tokens from the user to your contract (using ERC20 allowance mechanism), and then change the user's balance in "staked" accordingly.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.