Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
542 changes: 278 additions & 264 deletions addresses/Addresses.sol

Large diffs are not rendered by default.

51 changes: 32 additions & 19 deletions addresses/IAddresses.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @notice This is a contract that stores addresses for different networks.
Expand All @@ -11,20 +11,17 @@ interface IAddresses {

/// @notice get an address for a specific chainId
/// @param name the name of the address
function getAddress(
string memory name,
uint256 chainId
) external view returns (address);
function getAddress(string memory name, uint256 chainId)
external
view
returns (address);

/// @notice add an address for the current chainId
/// @param name the name of the address
/// @param addr the address to add
/// @param isContract whether the address is a contract
function addAddress(
string memory name,
address addr,
bool isContract
) external;
function addAddress(string memory name, address addr, bool isContract)
external;

/// @notice add an address for a specific chainId
/// @param name the name of the address
Expand All @@ -42,11 +39,8 @@ interface IAddresses {
/// @param name the name of the address
/// @param addr the address to change
/// @param isContract whether the address is a contract
function changeAddress(
string memory name,
address addr,
bool isContract
) external;
function changeAddress(string memory name, address addr, bool isContract)
external;

/// @notice change an address for a specific chainId
/// @param name the name of the address
Expand All @@ -60,12 +54,25 @@ interface IAddresses {
bool isContract
) external;

/// @notice remove an address for a specific chainId
/// @param name the name of the address
/// @param toRemove the address expected to be currently stored
/// @param chainId the chain id
function removeAddress(
string memory name,
address toRemove,
uint256 chainId
) external;

/// @notice remove recorded addresses
function resetRecordingAddresses() external;

/// @notice remove changed addresses
function resetChangedAddresses() external;

/// @notice remove removed addresses
function resetRemovedAddresses() external;

/// @notice get recorded addresses from a proposal's deployment
function getRecordedAddresses()
external
Expand All @@ -87,6 +94,12 @@ interface IAddresses {
address[] memory newAddresses
);

/// @notice get removed addresses from a proposal's deployment
function getRemovedAddresses()
external
view
returns (string[] memory names, uint256[] memory chainIds);

/// @notice check if an address is a contract
/// @param name the name of the address
function isAddressContract(string memory name) external view returns (bool);
Expand All @@ -98,8 +111,8 @@ interface IAddresses {
/// @notice check if an address is set for a specific chain id
/// @param name the name of the address
/// @param chainId the chain id
function isAddressSet(
string memory name,
uint256 chainId
) external view returns (bool);
function isAddressSet(string memory name, uint256 chainId)
external
view
returns (bool);
}
5 changes: 3 additions & 2 deletions mocks/MockAuction.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @notice This is a mock contract for testing purposes only, it SHOULD NOT be used in production.
contract MockAuction {
address public highestBidder;
uint public highestBid;
uint256 public highestBid;
address public owner;

constructor() {
Expand All @@ -18,7 +19,7 @@ contract MockAuction {
highestBid = msg.value;

if (previousBidder != address(0)) {
(bool success, ) = payable(previousBidder).call{value: msg.value}("");
(bool success,) = payable(previousBidder).call{value: msg.value}("");
assert(success);
}
}
Expand Down
12 changes: 7 additions & 5 deletions mocks/MockBravoProposal.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {GovernorBravoProposal} from "@proposals/GovernorBravoProposal.sol";
Expand Down Expand Up @@ -43,8 +43,9 @@ contract MockBravoProposal is GovernorBravoProposal {
buildModifier(addresses.getAddress("COMPOUND_TIMELOCK_BRAVO"))
{
/// STATICCALL -- not recorded for the run stage
ICompoundConfigurator configurator =
ICompoundConfigurator(addresses.getAddress("COMPOUND_CONFIGURATOR"));
ICompoundConfigurator configurator = ICompoundConfigurator(
addresses.getAddress("COMPOUND_CONFIGURATOR")
);
address comet = addresses.getAddress("COMPOUND_COMET");

/// CALLS -- mutative and recorded
Expand All @@ -53,8 +54,9 @@ contract MockBravoProposal is GovernorBravoProposal {
}

function validate() public view override {
ICompoundConfigurator configurator =
ICompoundConfigurator(addresses.getAddress("COMPOUND_CONFIGURATOR"));
ICompoundConfigurator configurator = ICompoundConfigurator(
addresses.getAddress("COMPOUND_CONFIGURATOR")
);
address comet = addresses.getAddress("COMPOUND_COMET");

ICompoundConfigurator.Configuration memory config =
Expand Down
7 changes: 4 additions & 3 deletions mocks/MockDuplicatedActionProposal.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {GovernorBravoProposal} from "@proposals/GovernorBravoProposal.sol";
Expand Down Expand Up @@ -39,8 +39,9 @@ contract MockDuplicatedActionProposal is GovernorBravoProposal {
{
/// STATICCALL -- not recorded for the run stage

ICompoundConfigurator configurator =
ICompoundConfigurator(addresses.getAddress("COMPOUND_CONFIGURATOR"));
ICompoundConfigurator configurator = ICompoundConfigurator(
addresses.getAddress("COMPOUND_CONFIGURATOR")
);
address comet = addresses.getAddress("COMPOUND_COMET");

/// CALLS -- mutative and recorded
Expand Down
6 changes: 4 additions & 2 deletions mocks/MockMultisigProposal.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Addresses} from "@addresses/Addresses.sol";
Expand Down Expand Up @@ -70,7 +70,9 @@ contract MockMultisigProposal is MultisigProposal {
vm.startPrank(addresses.getAddress("OPTIMISM_PROXY_ADMIN"));
require(
proxy.implementation()
== addresses.getAddress("OPTIMISM_L1_NFT_BRIDGE_IMPLEMENTATION"),
== addresses.getAddress(
"OPTIMISM_L1_NFT_BRIDGE_IMPLEMENTATION"
),
"Proxy implementation not set"
);
vm.stopPrank();
Expand Down
5 changes: 2 additions & 3 deletions mocks/MockOZGovernorProposal.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {OZGovernorProposal} from "@proposals/OZGovernorProposal.sol";
Expand All @@ -21,8 +21,7 @@ contract MockOZGovernorProposal is OZGovernorProposal {
}

function description() public pure override returns (string memory) {
return
"Call setController on the Root contract at root.ens.eth, passing in the address of the new DNS registrar";
return "Call setController on the Root contract at root.ens.eth, passing in the address of the new DNS registrar";
}

function run() public override {
Expand Down
13 changes: 7 additions & 6 deletions mocks/MockSavingContract.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @notice This is a mock contract for testing purposes only, it SHOULD NOT be used in production.
Expand All @@ -19,8 +20,7 @@ contract MockSavingContract {
function withdraw(uint256 depositIndex) public {
Deposit memory userDeposit = deposits[msg.sender][depositIndex];
require(
block.timestamp >= userDeposit.unlockTime,
"Deposit is still locked"
block.timestamp >= userDeposit.unlockTime, "Deposit is still locked"
);
require(userDeposit.amount > 0, "No funds to withdraw");

Expand All @@ -29,10 +29,11 @@ contract MockSavingContract {
payable(msg.sender).transfer(amount);
}

function getDeposit(
address user,
uint256 depositIndex
) public view returns (uint256 amount, uint256 unlockTime) {
function getDeposit(address user, uint256 depositIndex)
public
view
returns (uint256 amount, uint256 unlockTime)
{
return (
deposits[user][depositIndex].amount,
deposits[user][depositIndex].unlockTime
Expand Down
6 changes: 4 additions & 2 deletions mocks/MockTimelockProposal.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Addresses} from "@addresses/Addresses.sol";
Expand Down Expand Up @@ -120,7 +120,9 @@ contract MockTimelockProposal is TimelockProposal {
vm.startPrank(addresses.getAddress("ARBITRUM_L1_PROXY_ADMIN"));
require(
proxy.implementation()
== addresses.getAddress("ARBITRUM_L1_WETH_GATEWAY_IMPLEMENTATION"),
== addresses.getAddress(
"ARBITRUM_L1_WETH_GATEWAY_IMPLEMENTATION"
),
"Proxy implementation not set"
);
vm.stopPrank();
Expand Down
1 change: 1 addition & 0 deletions mocks/MockUpgrade.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract MockUpgrade {}
7 changes: 6 additions & 1 deletion mocks/MockVotingContract.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @notice This is a mock contract for testing purposes only, it SHOULD NOT be used in production.
Expand All @@ -13,7 +14,11 @@ contract MockVotingContract {
votesReceived[candidate] += 1;
}

function totalVotesFor(string memory candidate) public view returns (uint) {
function totalVotesFor(string memory candidate)
public
view
returns (uint256)
{
return votesReceived[candidate];
}
}
1 change: 1 addition & 0 deletions src/interface/ICompoundConfigurator.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ICompoundConfigurator {
Expand Down
2 changes: 1 addition & 1 deletion src/interface/IGovernor.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @notice OZ Governor interface
Expand Down
2 changes: 1 addition & 1 deletion src/interface/IGovernorBravo.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IGovernorBravo {
Expand Down
2 changes: 1 addition & 1 deletion src/interface/IProxy.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IProxy {
Expand Down
2 changes: 1 addition & 1 deletion src/interface/IProxyAdmin.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IProxyAdmin {
Expand Down
1 change: 1 addition & 0 deletions src/interface/ITimelockController.sol
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// openzeppelin timelock controller interface
Expand Down
Loading
Loading