-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Staking Contract #192
Comments
Hi @julio4, I would like to work on this issue if possible ! I have been learning and experimenting with cairo and starknet as I have been more and more interested in those techs, and would love to contribute to the community and gain some hands-on experience by taking a shot at addressing this issue :) |
Please I would love to handle this issue |
I assigned @hudem1, good luck! |
@julio4 if there are more issues I would love to it. |
I can do this |
@julio4, I think the rewardRate cannot be set in the constructor of the contract because we need to make sure the contract has indeed the reward amount (used for computing the rewardRate) in its rewardToken balance. And as we are in the constructor, the contract cannot have beforehand received reward tokens as we didn't know its address before. |
To allow anyone to join and exit at any time while receiving their portion of the reward, we need to handle the "out of reward" scenario. It's a bit complex, because we need to ensure that everyone who deposited before the "out of reward" time can still withdraw their share at any time. An alternative, simpler approach is to set a fixed reward with an end date. The reward rate will determine the distribution of shares, but users can only claim their rewards after the end date, based on: userShares / totalShares. Feel free to adjust this if needed, but please ensure the mechanism is clearly explained! |
Description
In this example, we want to create a smart contract that allows users to deposit a
IERC20 stakingToken
and earn rewards in the form of aIERC20 rewardToken
. The contract will track user balances, and participants will be able to deposit and withdraw tokens at any time.Rewards will be distributed based on the
rewardRate
,rewardPerToken
, andfinishAt
variables, which are set during the contract's deployment. Users will be able to claim their rewards at any time.Criteria:
Resources:
ODHack
To be eligible for additional rewards, be sure to review and follow the ODHack Common Guidelines and Contributing Guidelines.
Be sure to join the telegram group and introduce yourself.
The text was updated successfully, but these errors were encountered: