I was trying to fund a campaign created with a funding goal 10000000000000000000 and funding cap 10000000000000000000 by calling the payable method contributeMsgValue
with parameter["100000000000000000"]
and value 100000000000000000
but I am receiving this error in Remix.
transact to StandardCampaign.contributeMsgValue errored: VM error: revert. revert The transaction has been reverted to the initial state.
contract Campaign is Owned, Campaign { enum Stages { CrowdfundOperational, CrowdfundFailure, CrowdfundSuccess } modifier atStage(Stages _expectedStage) { if (stage() != uint256(_expectedStage)) { throw; } else { _; } } modifier validContribution() { if (msg.value == 0 || amountRaised + msg.value > fundingCap || amountRaised + msg.value = expiry && earlySuccess == false && amountRaised = expiry && amountRaised >= fundingGoal) || earlySuccess == true || amountRaised >= fundingCap) { return uint256(Stages.CrowdfundSuccess); } } function contributeMsgValue(uint256[] _amounts) public payable atStage(Stages.CrowdfundOperational) validContribution() returns (uint256 contributionID) { contributionID = contributions.length++; contributions[contributionID] = Contribution({ sender: msg.sender, value: msg.value, created: block.number }); contributionsBySender[msg.sender].push(contributionID); amountRaised += msg.value; ContributionMade(msg.sender); if (enhancer.notate(msg.sender, msg.value, block.number, _amounts)) { earlySuccess = true; } } function StandardCampaign(string _name, uint256 _expiry, uint256 _fundingGoal, uint256 _fundingCap, address _beneficiary, address _owner, address _enhancer) public { name = _name; expiry = _expiry; fundingGoal = _fundingGoal; fundingCap = _fundingCap; beneficiary = _beneficiary; owner = _owner; created = block.number; enhancer = Enhancer(_enhancer); } struct Contribution { address sender; uint256 value; uint256 created; } uint256[] defaultAmounts; Enhancer public enhancer; bool public earlySuccess; address public owner; uint256 public fundingGoal; uint256 public fundingCap; uint256 public amountRaised; uint256 public expiry; uint256 public created; address public beneficiary; Contribution[] public contributions; mapping(address => uint256[]) public contributionsBySender; mapping(uint256 => address) public refundClaimAddress; mapping(uint256 => bool) public refundsClaimed; string public name; }
Am I missing any code here or calling the function in a incorrect way?