asking doubt #5768
-
function fund() public payable {
require(msg.value.getConversionRate() >= MINIMUM_USD, "You need to spend more ETH!");
// require(PriceConverter.getConversionRate(msg.value) >= MINIMUM_USD, "You need to spend more ETH!");
addressToAmountFunded[msg.sender] += msg.value;
funders.push(msg.sender);
} ```
**### can any help whats going on this function** |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@sivajisj |
Beta Was this translation helpful? Give feedback.
-
@sivajisj
|
Beta Was this translation helpful? Give feedback.
@sivajisj
The fund function is public means anyone can call it and it is payable that means eth can be sent through this function
in the require statement, "msg.value.getConversionRate()>=MINIMUM_USD" means the fund sent through the fund function needs to be greater than the minimum usd set in the contract
next, in the
addressToAmountFunded[msg.sender]+=msg.value;
the fund amount gets updated to the addressToAmountFunded variable.next, we see that whoever funds in this contract,their address gets pushed in the funders variable.