Skip to content

Commit

Permalink
Bump pragmas to 0.8.20 (#54)
Browse files Browse the repository at this point in the history
- Bump pragmas to 0.8.20
- Add keys to mappings
  • Loading branch information
alexkeating authored Sep 20, 2023
1 parent 66a5841 commit b6af8d4
Show file tree
Hide file tree
Showing 29 changed files with 34 additions and 32 deletions.
3 changes: 2 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[profile.default]
evm_version = "paris"
fs_permissions = [{ access = "read", path = "./broadcast" }]
optimizer = true
optimizer_runs = 10_000_000
Expand All @@ -7,7 +8,7 @@
"openzeppelin/=lib/openzeppelin-contracts/contracts",
"openzeppelin-flexible-voting/=lib/flexible-voting/lib/openzeppelin-contracts/contracts/",
]
solc_version = "0.8.16"
solc_version = "0.8.20"
verbosity = 3

[profile.ci]
Expand Down
2 changes: 1 addition & 1 deletion script/DeployFakeERC20.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Script} from "forge-std/Script.sol";
import {FakeERC20} from "src/FakeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/WormholeDeploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Script, stdJson} from "forge-std/Script.sol";
import {IGovernor} from "openzeppelin/governance/Governor.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/WormholeDeployGovernorMetadata.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Script, stdJson} from "forge-std/Script.sol";
import {IGovernor} from "openzeppelin/governance/Governor.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/WormholeDeployVoteAggregator.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Script, stdJson} from "forge-std/Script.sol";

Expand Down
2 changes: 1 addition & 1 deletion script/WormholeMintOnL2.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Script, stdJson} from "forge-std/Script.sol";
import {IERC20Mint} from "src/interfaces/IERC20Mint.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/WormholeSendProposalToL2.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Script, stdJson} from "forge-std/Script.sol";
import {IL1GovernorMetadataBridge} from "src/interfaces/IL1GovernorMetadataBridge.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/FakeERC20.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {ERC20VotesComp} from "openzeppelin/token/ERC20/extensions/ERC20VotesComp.sol";
import {ERC20Permit} from "openzeppelin/token/ERC20/extensions/ERC20Permit.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/L1Block.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {SafeCast} from "openzeppelin/utils/math/SafeCast.sol";
import {IL1Block} from "src/interfaces/IL1Block.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/L2GovernorMetadata.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

/// @notice This contract is used by an L2VoteAggregator to store proposal metadata.
/// It expects to receive proposal metadata from a valid L1 source.
Expand All @@ -12,7 +12,7 @@ abstract contract L2GovernorMetadata {
}

/// @notice The id of the proposal mapped to the proposal metadata.
mapping(uint256 => Proposal) _proposals;
mapping(uint256 proposalId => Proposal) _proposals;

/// @notice Add proposal to internal storage.
/// @param proposalId The id of the proposal.
Expand Down
7 changes: 4 additions & 3 deletions src/L2VoteAggregator.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {ERC20Votes} from "openzeppelin/token/ERC20/extensions/ERC20Votes.sol";
import {SafeCast} from "openzeppelin/utils/math/SafeCast.sol";
Expand Down Expand Up @@ -60,10 +60,11 @@ abstract contract L2VoteAggregator {

/// @notice A mapping of proposal to a mapping of voter address to boolean indicating whether a
/// voter has voted or not.
mapping(uint256 => mapping(address => bool)) private _proposalVotersHasVoted;
mapping(uint256 proposalId => mapping(address voterAddress => bool)) private
_proposalVotersHasVoted;

/// @notice A mapping of proposal id to proposal vote totals.
mapping(uint256 => ProposalVote) public proposalVotes;
mapping(uint256 proposalId => ProposalVote) public proposalVotes;

/// @dev Emitted when a vote is cast on L2.
event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight);
Expand Down
2 changes: 1 addition & 1 deletion src/WormholeBase.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {IWormholeRelayer} from "wormhole/interfaces/relayer/IWormholeRelayer.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/WormholeL1ERC20Bridge.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {SafeERC20} from "openzeppelin/token/ERC20/utils/SafeERC20.sol";
import {ERC20Votes} from "openzeppelin/token/ERC20/extensions/ERC20Votes.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/WormholeL1GovernorMetadataBridge.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {IGovernor} from "openzeppelin/governance/Governor.sol";
import {WormholeSender} from "src/WormholeSender.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/WormholeL2ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {ERC20} from "openzeppelin/token/ERC20/ERC20.sol";
import {ERC20Votes} from "openzeppelin/token/ERC20/extensions/ERC20Votes.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/WormholeL2GovernorMetadata.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {WormholeReceiver} from "src/WormholeReceiver.sol";
import {WormholeBase} from "src/WormholeBase.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/WormholeL2VoteAggregator.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {L2GovernorMetadata} from "src/WormholeL2GovernorMetadata.sol";
import {L2VoteAggregator} from "src/L2VoteAggregator.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/WormholeReceiver.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Ownable} from "openzeppelin/access/Ownable.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/WormholeSender.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {WormholeBase} from "src/WormholeBase.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IL1Block.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.0;

// interface is for contract defined at
// https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/contracts/L2/L1Block.sol
Expand Down
2 changes: 1 addition & 1 deletion test/WormholeBase.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/WormholeL1ERC20Bridge.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {IGovernor} from "openzeppelin/governance/Governor.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/WormholeL1GovernorMetadataBridge.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {Governor, IGovernor} from "openzeppelin/governance/Governor.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/WormholeL1VotePool.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Vm, Test} from "forge-std/Test.sol";
import {WormholeRelayerBasicTest} from "wormhole-solidity-sdk/testing/WormholeRelayerTest.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/WormholeL2ERC20.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {IGovernor} from "openzeppelin/governance/Governor.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/WormholeL2GovernorMetadata.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/WormholeL2VoteAggregator.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {WormholeRelayerBasicTest} from "wormhole-solidity-sdk/testing/WormholeRelayerTest.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/WormholeReceiver.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/WormholeSender.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma solidity ^0.8.20;

import {Test} from "forge-std/Test.sol";
import {IWormholeRelayer} from "wormhole/interfaces/relayer/IWormholeRelayer.sol";
Expand Down

0 comments on commit b6af8d4

Please sign in to comment.