Important: you need to have a very good idea of what you are doing, because there are some risks.
Use only test coins for test purposes. Your rewards or NFTs can get stuck in the staking pool if you use a wrong configuration, and you won't be able to withdraw them. First check that everything works on testnet and only then switch to the production environment! ⚠️
We have prepared a few integration examples in case you want to integrate staking contracts into your Move smart contracts.
Add as dependency
Add the Harvest package as a dependency to your project updating Move.toml:
Important: The following examples show how you can iterate with staking contracts in your smart contracts/product. The example is designed for educational purposes only; your code will probably be very different.
Let's say we want to register a pool that uses Liquidswap LP coins as staking coins and reward coins as an unknown generic. After that, we will immediately stake.
Register pool & stake
Harvest
If we want to harvest the rewards, we can extend the module above with the harvest function:
Harvest
Unstake
Once one week has elapsed from the moment of staking or once the established harvesting period is complete, you can unstake:
Unstake
Boost
To boost or remove a boost, look at the following example where we extract boost collection from config: