diff --git a/.gitignore b/.gitignore index 85198aa..5ae7e3a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ docs/ # Dotenv file .env + +.DS_Store +zkout/ diff --git a/foundry.toml b/foundry.toml index e427eac..b68e952 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,6 +5,5 @@ libs = ["lib"] remappings = [ "@chainlink/contracts/=lib/chainlink-brownie-contracts/contracts/", ] -ffi = true # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/script/DeployFundMe.s.sol b/script/DeployFundMe.s.sol index b994310..e421b68 100644 --- a/script/DeployFundMe.s.sol +++ b/script/DeployFundMe.s.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.28; +pragma solidity ^0.8.18; import {Script} from "forge-std/Script.sol"; import {FundMe} from "../src/FundMe.sol"; diff --git a/script/HelperConfig.s.sol b/script/HelperConfig.s.sol index 087a507..250e60e 100644 --- a/script/HelperConfig.s.sol +++ b/script/HelperConfig.s.sol @@ -3,7 +3,7 @@ // Sepolia ETH/USD // Mainnet ETH/USD // SPDX-License-Identifier: MIT -pragma solidity ^0.8.28; +pragma solidity ^0.8.18; import {Script} from "forge-std/Script.sol"; import {MockV3Aggregator} from "../test/mocks/MockV3Aggregator.sol"; diff --git a/script/Interactions.s.sol b/script/Interactions.s.sol index d55570f..f524629 100644 --- a/script/Interactions.s.sol +++ b/script/Interactions.s.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier -pragma solidity ^0.8.28; +pragma solidity ^0.8.18; import {Script, console} from "forge-std/Script.sol"; import {FundMe} from "../src/FundMe.sol"; diff --git a/test/integration/InteractionsTest.t.sol b/test/integration/InteractionsTest.t.sol index 5915393..f9d4435 100644 --- a/test/integration/InteractionsTest.t.sol +++ b/test/integration/InteractionsTest.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier -pragma solidity ^0.8.28; +pragma solidity ^0.8.18; import {Test, console} from "forge-std/Test.sol"; import {FundMe} from "../../src/FundMe.sol"; @@ -10,8 +10,7 @@ contract InteractionsTest is Test { FundMe fundMe; address USER = makeAddr("me"); uint256 constant SEND_VALUE = 0.1 ether; - uint256 constant STARTING_BALANCE = 10 ether; - uint256 constant GAS_PRICE = 1; + uint256 constant STARTING_BALANCE = 1 ether; function setUp() external { DeployFundMe deployFundMe = new DeployFundMe(); @@ -21,6 +20,8 @@ contract InteractionsTest is Test { function testUserCandFundInteractions() public { FundFundMe fundFundMe = new FundFundMe(); + + vm.prank(USER); fundFundMe.fundFundMe(address(fundMe)); WithdrawFundMe withdrawFundMe = new WithdrawFundMe(); diff --git a/test/unit/FundMeTest.t.sol b/test/unit/FundMeTest.t.sol index a52127e..694c823 100644 --- a/test/unit/FundMeTest.t.sol +++ b/test/unit/FundMeTest.t.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier -pragma solidity ^0.8.28; +pragma solidity ^0.8.18; import {Test, console} from "forge-std/Test.sol"; import {FundMe} from "../../src/FundMe.sol"; diff --git a/test/unit/ZkSyncDevOps.t.sol b/test/unit/ZkSyncDevOps.t.sol new file mode 100644 index 0000000..4ef8cf3 --- /dev/null +++ b/test/unit/ZkSyncDevOps.t.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.18; + +import {Test, console} from "forge-std/Test.sol"; +import {ZkSyncChainChecker} from "lib/foundry-devops/src/ZkSyncChainChecker.sol"; +import {FoundryZkSyncChecker} from "lib/foundry-devops/src/FoundryZkSyncChecker.sol"; + +contract ZkSyncDevOps is Test, ZkSyncChainChecker, FoundryZkSyncChecker { + // Remove the `skipZkSync`, then run `forge test --mt testZkSyncChainFails --zksync` and this will fail! + function testZkSyncChainFails() public skipZkSync { + address ripemd = address(uint160(3)); + + bool success; + // Don't worry about what this "assembly" thing is for now + assembly { + success := call(gas(), ripemd, 0, 0, 0, 0, 0) + } + assert(success); + } + + // You'll need `ffi=true` in your foundry.toml to run this test + // // Remove the `onlyVanillaFoundry`, then run `foundryup-zksync` and then + // // `forge test --mt testZkSyncFoundryFails --zksync` + // // and this will fail! + // function testZkSyncFoundryFails() public onlyVanillaFoundry { + // bool exists = vm.keyExistsJson('{"hi": "true"}', ".hi"); + // assert(exists); + // } +}