Comment on page
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 the Harvest package as a dependency to your project updating
git = 'https://github.com/pontem-network/harvest.git'
rev = 'latest version'
As we are going to use Liquidswap LP coins in the example (though it's not mandatory for harvest contracts), add another dependency:
git = 'https://github.com/pontem-network/liquidswap.git'
subdir = 'liquidswap_lp/'
rev = 'v0.4.4'
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
If we want to harvest the rewards, we can extend the module above with the harvest function:
Once one week has elapsed from the moment of staking or once the established harvesting period is complete, you can unstake:
To boost or remove a boost, look at the following example where we extract boost collection from config: