Skip to content
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

Merged
merged 4 commits into from
Nov 3, 2024

Conversation

mariocodecr
Copy link
Contributor

Pull Request

  • Closes #
  • Added tests (if necessary)
  • Run tests
  • Run formatting
  • Commented the code

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.
image
image

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.

@@ -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;
Copy link
Collaborator

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;

@@ -33,6 +36,7 @@ pub mod FundManager {
current_id: u128,
funds: LegacyMap::<u128, ContractAddress>,
fund_class_hash: ClassHash,
minimum_goal_state: u256,
Copy link
Collaborator

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

@@ -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');
Copy link
Collaborator

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

@@ -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::{
Copy link
Collaborator

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}, };

@adrianvrj adrianvrj linked an issue Nov 3, 2024 that may be closed by this pull request
Copy link
Collaborator

@EmmanuelAR EmmanuelAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@EmmanuelAR EmmanuelAR merged commit d410957 into undefinedorgcr:dev Nov 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[fix] Fund's goal general fixes
2 participants