fix: Ensure only fund manager can modify goal in setGoal #156
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
Changes description
Steps to Resolve the Issue
fund_manager_constants.cairo
file incontracts/src/constants/funds/
:fund_manager_constants.cairo
.FUND_MANAGER_ADDRESS
with the fund manager's address.fund_manager_constants
module incontracts/src/constants/fund.cairo
:fund.cairo
to import the new fund manager constants module:contracts/src/fund.cairo
):use
statement to access the constants in the Fund contract:setGoal
function to add fund manager validation:fund_manager_address
to store the fund manager's address, converted to aContractAddress
.caller
is the fund manager. If not, throw an error with the message "You are not the fund manager".contract/tests/test_fund.cairo
):FUND_MANAGER()
function to return the fund manager’s address:test_set_goal
andtest_receive_donation_successful
):caller
address in these tests to be the fund manager's address:test_set_goal_unauthorized
):setGoal
function.Time spent breakdown
Development environment setup: 2 hours
Research and issue analysis: 1 hour
Solution development: 1 hour
fund_manager_constants.cairo
file, defining the constant, and modifying the contract to add validation in thesetGoal
function.Test modifications: 1 hour
Debugging and running tests: 30 minutes
Documentation and PR creation: 30 minutes
Total: 6 hours
Comments
Thank you very much for the opportunity to contribute to this project.