NethermindEth / StarknetByExample

A collection of examples of Cairo smart contracts for Starknet.
https://starknet-by-example.voyager.online/
MIT License
101 stars 77 forks source link

feat(staking): Add staking contract example #202

Closed hudem1 closed 1 month ago

hudem1 commented 1 month ago

Issue(s): Close #192

Description

The staking contract is complete and answers to the requested issue criterion except for the following note where I had to set up the reward amount as an entrypoint different to the constructor:

Special Note: Could not set rewards during the contract deployment (as requested in the issue criterion) because as stated in a comment I made on the issue, in order to set the reward amount, we need to make sure the contract indeed has those rewards. Yet, the contract could not have received any reward before its deployment (as it was not deployed yet). For that reason, we cannot set the reward amount in the contract deployment. We need to set the reward amount afterward the contract has been deployed, hence the entrypoint set_reward_amount (and set_reward_duration) available only to the owner of the contract.

Checklist