-
Notifications
You must be signed in to change notification settings - Fork 74
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
set minimun goal const #180
set minimun goal const #180
Conversation
@@ -5,4 +5,5 @@ pub mod FundConstants { | |||
pub const UP_VOTES_NEEDED: u32 = 100; | |||
pub const INITIAL_UP_VOTES: u32 = 0; | |||
pub const INITIAL_GOAL: u256 = 0; | |||
pub const MINIMUM_GOAL: u256 = 500_u256; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set this pub const MINIMUM_GOAL: u256 = 500;
contracts/src/fundManager.cairo
Outdated
@@ -33,6 +36,7 @@ pub mod FundManager { | |||
current_id: u128, | |||
funds: LegacyMap::<u128, ContractAddress>, | |||
fund_class_hash: ClassHash, | |||
minimum_goal_state: u256, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to add the constant in the constructor
contracts/src/fundManager.cairo
Outdated
@@ -71,6 +76,7 @@ pub mod FundManager { | |||
#[abi(embed_v0)] | |||
impl FundManagerImpl of super::IFundManager<ContractState> { | |||
fn newFund(ref self: ContractState, name: felt252, goal: u256) { | |||
assert(goal >= self.minimum_goal_state.read(), 'Goal must be at least 500'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have to call the constant here like this example FundConstants::INITIAL_UP_VOTES
contracts/src/fundManager.cairo
Outdated
@@ -22,6 +22,9 @@ pub mod FundManager { | |||
use starknet::class_hash::ClassHash; | |||
use starknet::get_caller_address; | |||
use openzeppelin::utils::serde::SerializedAppend; | |||
use gostarkme::constants::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use this please
use gostarkme::constants::{ funds::{fund_constants::FundConstants}, };
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Pull Request
Changes description
Describe what your changes will do and any TODOs there might be in the future related to the issue you are closing.
In the constants file create the new constant with the minimum required, import that constant to the fundManager file with its storage and constructor and use it
Current output
Give evidence like screenshots of what your job looks like.
Time spent breakdown
4 hours
Give a breakdown on the time you used to solve the issue you are closing.
Comments
Any other details you might want to share.