Hey guys.
What would would be the simplest logic to return apy to a user in a staking smart contract?

Lets suppose there is a erc20 token smart contract which has staking function.
If you buy some erc20 token and stake into the contract then you will get some percentage of APY interest after a week/month.

I am thinking of this solution.

1)developing ERC20 token using openzepplin and add a new staking function in it
2) when a msg sender calls the staking function then the tokens will be stored in a user mapping into the contract.
3) if the token owner is withdrawing the tokens after a month then he will get let say 5% APY for staking.

So the contract will calculate 5% of the staked amount and it will mint the calculated token and will add it into the user mapping.

Is this correct approach? Or please help me refine this idea

Oct 9, 2020, 1:38 PM
Maybe some more idea here: https://blog.chain.link/build-defi-yield-farming-application-with-chainlink/
Oct 9, 2020, 1:50 PM

© 2024 Draquery.com All rights reserved.