This commit is contained in:
parent
8f8b7f880d
commit
10c4f306f6
33
contracts/SimpleStorage.sol
Normal file
33
contracts/SimpleStorage.sol
Normal file
@ -0,0 +1,33 @@
|
||||
// I'm a comment!
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity 0.8.19;
|
||||
|
||||
// pragma solidity ^0.8.0;
|
||||
// pragma solidity >=0.8.0 <0.9.0;
|
||||
|
||||
contract SimpleStorage {
|
||||
uint256 myFavoriteNumber;
|
||||
|
||||
struct Person {
|
||||
uint256 favoriteNumber;
|
||||
string name;
|
||||
}
|
||||
// uint256[] public anArray;
|
||||
Person[] public listOfPeople;
|
||||
|
||||
mapping(string => uint256) public nameToFavoriteNumber;
|
||||
|
||||
function store(uint256 _favoriteNumber) public {
|
||||
myFavoriteNumber = _favoriteNumber;
|
||||
}
|
||||
|
||||
function retrieve() public view returns (uint256) {
|
||||
return myFavoriteNumber;
|
||||
}
|
||||
|
||||
function addPerson(string memory _name, uint256 _favoriteNumber) public {
|
||||
listOfPeople.push(Person(_favoriteNumber, _name));
|
||||
nameToFavoriteNumber[_name] = _favoriteNumber;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
src = "contracts"
|
||||
out = "out"
|
||||
libs = ["lib"]
|
||||
#evm_version = "berlin" # for zksync only
|
||||
|
||||
remappings = [
|
||||
"foundry-devops/=lib/foundry-devops/src/",
|
||||
@ -16,4 +17,4 @@ sepolia = {key = "${ETHERSCAN_API_KEY}"}
|
||||
[rpc_endpoints]
|
||||
sepolia = "${SEPOLIA_RPC_URL}"
|
||||
|
||||
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
|
||||
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
|
||||
|
@ -101,7 +101,7 @@ module.exports = {
|
||||
solidity: {
|
||||
compilers: [
|
||||
{
|
||||
version: "0.8.18",
|
||||
version: "0.8.19",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
17
script/DeploySimpleStorage.s.sol
Normal file
17
script/DeploySimpleStorage.s.sol
Normal file
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity 0.8.19;
|
||||
|
||||
import {Script} from "forge-std/Script.sol";
|
||||
import {SimpleStorage} from "../contracts/SimpleStorage.sol";
|
||||
|
||||
contract DeploySimpleStorage is Script {
|
||||
function run() external returns (SimpleStorage) {
|
||||
vm.startBroadcast();
|
||||
|
||||
SimpleStorage simpleStorage = new SimpleStorage();
|
||||
|
||||
vm.stopBroadcast();
|
||||
return simpleStorage;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user