4. Fund Me
Sending ETH through a function & reverts
contract FundMe {
// Smart Contracts can hold funds like wallets can
function fund() public payable {
// Want to be able to set a mininum fund amount in USD
// 1. How do we send ETH to this contract?
// require means this function needs this specific condition to fulfill to run
// else revert : undo any action before, and send remaining gas back
// 1e18 === 1 * 10 ** 18 === 1000000000000000000 === value in wei of 1 ethereum
require(msg.value > 1e18, "Didn't send enough!");
}
}Chainlinks & Oracles
Chainlink Price Feeds
Chainlink VRF (Verifiable Random Function)
Chainlink Automation (Chainlink Keepers)
Chainlink Any API
Interfaces and Price Feeds
Importing from GitHub & NPM
Floating Point Math in Solidity
Libraries
PriceConverter.sol
FundMe.sol
SafeMath, Overflow Checking, and the "unchecked" keyword
For Loops
Resetting an Array
Withdrawing Ethereum
Constructor
Modifiers
Advanced Solidity Concepts
Immutable & Constant
Custom Errors
Receive & Fallback
Final Contracts Samples
FundMe.sol
PriceConverter.sol
Last updated