Skip to content

EricBidopa/SimpleCrowdFunding-Contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

the contract does:

The contract has a minimumUsd variable which is set to 50 * 1e10 (or 50 USD * 10^10). This is the minimum amount of USD that someone has to deposit to participate in the contract. The contract keeps track of all the addresses that have deposited money into the contract using an array called funders and a mapping called addressToAmountFunded. The contract has a deposit() function which allows people to deposit money into the contract. It first checks if the amount sent is greater than or equal to the minimumUsd value, then adds the sender's address to the funders array and maps the sender's address to the amount they deposited using the addressToAmountFunded mapping. The contract has a getVersion() function which returns the version of the Chainlink price feed contract being used in the contract. The contract has a getPrice() function which returns the latest ETH to USD price from the Chainlink price feed contract. The contract has a getConversionRate() function which takes an amount of ETH as input and returns the equivalent USD value using the getPrice() function. The contract has a withdraw() function which allows the owner of the contract to withdraw all the funds from the contract. It transfers the contract balance to the owner's address and sets all the amounts in the addressToAmountFunded mapping to 0. It also resets the funders array to an empty array. The contract uses the AggregatorV3Interface interface from the Chainlink contract to get the latest ETH to USD price. The contract also uses a modifier called onlyOwner which restricts access to certain functions to the owner of the contract.

About

This project is write in solidity as a contract on Ethereum

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published