Create Subscriptions
Subscribe to Products already available
Users & Investors will want to subscribe to staking products you have available, if a 5% yield for 1 month, 2 months or even a day, the below function explains how to set it up
This Function suppose that products already exist
Please go to Creating Products to see how to create your products
Create Subscription
Users/Investors can stake their tokens by subscribing to a product generated by the Admin, this way they are subject to the rules under the product
/* Approve Tx for ERC20 in the name of the contract - crucial/not optional */
await stakingContract.approveERC20Transfer();
/* Subscribe - when tokens are sent automatically */
await stakingContract.subscribeProduct({
address : // user/subscriber address,
product_id : // productId - ex : access via getProducts()[0],
amount : 100 // has to be smaller than individualMaximumAmount
});
Use of the approveERC20Transfer Function
For all contracts to interact with each other they have to respect IERC20 Interfaces, in this case the contract has to access and be able to use the investors/subscriber tokens prior to the subscribeProduct
Updated almost 4 years ago