Issue calling `contribute` function of Campaign contract

pragma solidity >=0.4.22 <0.7.0;

contract Campaign {
    address public manager;
    uint public minimumContribution;
    address[] public approvers;
    
    function Campa(uint minimum) public {
        manager = msg.sender;
        minimumContribution = minimum;
    }
    
    function contribute() public payable {
        require(msg.value > minimumContribution);
        
        approvers.push(msg.sender);
    }
}

1 Like

Hi @Mony,

Welcome to the community forum :wave:

Thanks for posting here.

I assume that you called contribute with either a value of zero or less than the minimumContribution.

I was able to do the following:
Compile with 0.6.4 of the Compiler
Deploy to a JavaScript VM
Call Campa function with parameter of 99
Call contribute function and set the value to 100. (Value is in wei and is set in the top left of the screen underneath Gas limit)

Let me know if you have any questions.

Hi @Mony,

Just checking to see how you got on with this?

Hi Andrew !!
I could not deduct how is the minimum contribution of my contract (100).
I also don’t know how to verify the manager address.
I broke my head to verify it.
So thank you very much for writing me so I ask you now.

1 Like

Hi @Mony,

When you deploy the contract, you provide the minimum contribution as a parameter to the constructor

I am not sure what you mean by verify? Do you want to restrict some functions to the manager?

Feel free to ask all the questions that you need.