Does OpenZeppelin have staking pool contracts?

I am interested in developing a staking pool contract, along the lines of this one

from Illuvium. Does OpenZeppelin have any staking pool contracts along these lines?

I am also wondering if anyone knows to what extent the Illuvium staking pool contract is original. Did they use code from other existing staking pool contracts?

I do not think there is some stake contracts, but there are some talk about this, maybe you can have a look: Include a RewardDistribution Contract · Issue #2457 · OpenZeppelin/openzeppelin-contracts

1 Like

It actually looks like there was a vulnerability discovered in the Illuvium staking contracts, just one day after I made this post.

Maybe that's extra motivation for OpenZeppelin staking contracts!!

1 Like

We're looking into staking contracts but do not have one yet!

Can you describe the requirements that you'd be interested in? What are the primitive operations you would expect of a staking contract?

Assume we are staking MyToken (MTK) in return for MTK rewards. Here are some features I have in mind:

  • a staker (user) is assigned a weight, which increases as a function of the amount of MTK they stake and also increases as a function of the duration they choose to lock their MTK in the staking contract
  • a staker is continuously (however one wishes to interpret that on-chain) rewarded with MTK based on their weight as a fraction of the total pool weight
  • the total amount of MTK which is given out in rewards, per block (or more abstractly per second), is computed as some function of the MTK balance of a contract which holds the rewards
  • MTK rewards are classified as pending until the staker chooses to claim the rewards (so we are not making continuous MTK transfers)
  • the staking pool should last as long as the contract holding MTK rewards maintains positive balance (perhaps virtual positive balance, considering the notion of pending rewards)
2 Likes

This is great, thanks for sharing!

One of the biggest implementation challenges with this sort of contract seems to be enabling rewards with multiple tokens. In your requirements you specify a single MKR token for rewards, but have you considered this other possibility and do you think it could be important?