Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy contracts using solc 0.8.23 for proper verification #231

Merged
merged 3 commits into from
Dec 15, 2023
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
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"files": "*.sol",
"options": {
"compiler": "0.8.17",
"compiler": "0.8.23",
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
Expand Down
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"ordering": "warn",
"visibility-modifier-order": "error",

"compiler-version": ["error", "0.8.17"],
"compiler-version": ["error", "0.8.23"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"no-inline-assembly": "off",
"not-rely-on-time": "off"
Expand Down
7 changes: 7 additions & 0 deletions core/.env.deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
saltA='0x000000000000000000000000000000000000000072d2b1e41bc2400020241d9b'
saltB='0x000000000000000000000000000000000000000029a4b92da42120001626d608'
saltC='0x000000000000000000000000000000000000000091b1b6c2b3d408003c519fc1'
saltD='0x0000000000000000000000000000000000000000cb94eb7800f858003d6aca1f'
deployOracle='true'
deployRateModel='true'
deployBorrowerDeployer='true'
44 changes: 22 additions & 22 deletions core/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
BorrowerGasTest:test_addMargin() (gas: 16225)
BorrowerGasTest:test_borrow() (gas: 116555)
BorrowerGasTest:test_borrow() (gas: 116507)
BorrowerGasTest:test_getUniswapPositions() (gas: 5376)
BorrowerGasTest:test_modify() (gas: 89952)
BorrowerGasTest:test_modifyWithAnte() (gas: 96429)
BorrowerGasTest:test_repay() (gas: 68517)
BorrowerGasTest:test_uniswapDepositInBorrower() (gas: 248173)
BorrowerGasTest:test_modify() (gas: 89913)
BorrowerGasTest:test_modifyWithAnte() (gas: 96390)
BorrowerGasTest:test_repay() (gas: 68475)
BorrowerGasTest:test_uniswapDepositInBorrower() (gas: 248131)
BorrowerGasTest:test_uniswapDepositStandard() (gas: 167581)
BorrowerGasTest:test_uniswapWithdraw() (gas: 154954)
BorrowerGasTest:test_withdraw() (gas: 113535)
BorrowerGasTest:test_uniswapWithdraw() (gas: 154915)
BorrowerGasTest:test_withdraw() (gas: 113496)
FactoryGasTest:test_createBorrower() (gas: 137495)
FactoryGasTest:test_createMarket() (gas: 4159223)
LenderGasTest:test_accrueInterest() (gas: 45702)
LenderGasTest:test_borrow() (gas: 40988)
LenderGasTest:test_deposit() (gas: 49158)
LenderGasTest:test_depositWithCourier() (gas: 49304)
LenderGasTest:test_redeem() (gas: 48835)
LenderGasTest:test_redeemWithCourier() (gas: 82023)
LenderGasTest:test_repay() (gas: 44896)
LiquidatorGasTest:test_noCallbackOneAsset() (gas: 123547)
LiquidatorGasTest:test_noCallbackTwoAssets() (gas: 181621)
LiquidatorGasTest:test_noCallbackTwoAssetsAndUniswapPosition() (gas: 226368)
LiquidatorGasTest:test_warn() (gas: 40915)
LiquidatorGasTest:test_withCallbackAndSwap() (gas: 195562)
VolatilityGasTest:test_consult() (gas: 43957)
VolatilityGasTest:test_updateNoBinarySearch() (gas: 196352)
FactoryGasTest:test_createMarket() (gas: 4166418)
LenderGasTest:test_accrueInterest() (gas: 45680)
LenderGasTest:test_borrow() (gas: 40985)
LenderGasTest:test_deposit() (gas: 49157)
LenderGasTest:test_depositWithCourier() (gas: 49303)
LenderGasTest:test_redeem() (gas: 48829)
LenderGasTest:test_redeemWithCourier() (gas: 82014)
LenderGasTest:test_repay() (gas: 44881)
LiquidatorGasTest:test_noCallbackOneAsset() (gas: 123378)
LiquidatorGasTest:test_noCallbackTwoAssets() (gas: 181408)
LiquidatorGasTest:test_noCallbackTwoAssetsAndUniswapPosition() (gas: 226178)
LiquidatorGasTest:test_warn() (gas: 40870)
LiquidatorGasTest:test_withCallbackAndSwap() (gas: 195393)
VolatilityGasTest:test_consult() (gas: 43953)
VolatilityGasTest:test_updateNoBinarySearch() (gas: 196354)
5 changes: 3 additions & 2 deletions core/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ libs = ['lib']
out = 'build'
cache_path = 'cache'

solc_version = '0.8.17'
solc_version = '0.8.23'
evm_version = 'paris'
via_ir = true
optimizer = true
optimizer_runs = 4294967295
optimizer_runs = 100000000
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the maximum supported by Etherscan's JSON parser.

gas_reports = []

auto_detect_remappings = false
Expand Down
9 changes: 5 additions & 4 deletions core/script/CreateMarkets.s.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Script.sol";

import {Factory, IUniswapV3Pool} from "../src/Factory.sol";

Factory constant FACTORY = Factory(0x0000000000000000000000000000000000000000);
Factory constant FACTORY = Factory(0x000000009efdB26b970bCc0085E126C9dfc16ee8);

contract CreateMarketsScript is Script {
address[] poolsMainnet = [
Expand All @@ -23,7 +23,7 @@ contract CreateMarketsScript is Script {
0x1d42064Fc4Beb5F8aAF85F4617AE8b3b5B8Bd801, // UNI/WETH 0.30%
0x290A6a7460B308ee3F19023D2D00dE604bcf5B42, // MATIC/WETH 0.30%
0xe42318eA3b998e8355a3Da364EB9D48eC725Eb45, // WETH/RPL 0.30%
0xAc4b3DacB91461209Ae9d41EC517c2B9Cb1B7DAF // APE/WETH 30%
0xAc4b3DacB91461209Ae9d41EC517c2B9Cb1B7DAF // APE/WETH 0.30%
];

address[] poolsOptimism = [
Expand All @@ -45,7 +45,8 @@ contract CreateMarketsScript is Script {

address[] poolsBase = [
0x4C36388bE6F416A29C8d8Eee81C771cE6bE14B18, // WETH/USDbC 0.05%
0x10648BA41B8565907Cfa1496765fA4D95390aa0d // cbETH/WETH 0.05%
0x10648BA41B8565907Cfa1496765fA4D95390aa0d, // cbETH/WETH 0.05%
0x9E37cb775a047Ae99FC5A24dDED834127c4180cD // BALD/WETH 1.0%
];

function run() external {
Expand Down
27 changes: 15 additions & 12 deletions core/script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Script.sol";

Expand All @@ -8,17 +8,16 @@ import {Lender} from "src/Lender.sol";
import {RateModel} from "src/RateModel.sol";
import {VolatilityOracle} from "src/VolatilityOracle.sol";

address constant GOVERNOR = 0x2bf8eA41aF0695D482C4aa23d4f8aD7E9023b890;
address constant RESERVE = 0xAd236E154cbC33cFDB6CD7A4BA04679d9fb74A8C;

// Derived using https://github.com/0age/create2crunch/
bytes32 constant saltA = 0x0000000000000000000000000000000000000000aeeec55d74c86000021e5622;
bytes32 constant saltB = 0x00000000000000000000000000000000000000008a0ad7466accc00001d49926;
bytes32 constant saltC = 0x0000000000000000000000000000000000000000d36d6b3f5afc00000074870e;
bytes32 constant saltD = 0x00000000000000000000000000000000000000005f2f31da9d94e0001ab8274a;
address constant GOVERNOR = 0xFb6520d40fF68d9088d9e55F44f6C44bb2967Fb9;
address constant RESERVE = 0xB0e822D7073f0cE223256AEf04d59b0e06AeE8f9;

contract DeployScript is Script {
function run() external {
bytes32 saltA = vm.envBytes32("saltA");
bytes32 saltB = vm.envBytes32("saltB");
bytes32 saltC = vm.envBytes32("saltC");
bytes32 saltD = vm.envBytes32("saltD");

bytes32 ichVolatilityOracle = hashInitCode(type(VolatilityOracle).creationCode);
bytes32 ichRateModel = hashInitCode(type(RateModel).creationCode);
bytes32 ichBorrowerDeployer = hashInitCode(type(BorrowerDeployer).creationCode);
Expand Down Expand Up @@ -47,9 +46,13 @@ contract DeployScript is Script {

vm.startBroadcast(vm.envUint("PRIVATE_KEY"));

VolatilityOracle oracle = new VolatilityOracle{salt: saltA}();
RateModel rateModel = new RateModel{salt: saltB}();
BorrowerDeployer borrowerDeployer = new BorrowerDeployer{salt: saltC}();
VolatilityOracle oracle = vm.envBool("deployOracle")
? new VolatilityOracle{salt: saltA}()
: VolatilityOracle(addrVolatilityOracle);
RateModel rateModel = vm.envBool("deployRateModel") ? new RateModel{salt: saltB}() : RateModel(addrRateModel);
BorrowerDeployer borrowerDeployer = vm.envBool("deployBorrowerDeployer")
? new BorrowerDeployer{salt: saltC}()
: BorrowerDeployer(addrBorrowerDeployer);
Factory factory = new Factory{salt: saltD}({
governor: GOVERNOR,
reserve: RESERVE,
Expand Down
2 changes: 1 addition & 1 deletion core/src/Borrower.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {ImmutableArgs} from "clones-with-immutable-args/ImmutableArgs.sol";
import {FixedPointMathLib as SoladyMath} from "solady/utils/FixedPointMathLib.sol";
Expand Down
2 changes: 1 addition & 1 deletion core/src/Factory.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {ClonesWithImmutableArgs} from "clones-with-immutable-args/ClonesWithImmutableArgs.sol";
import {ERC20, SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
Expand Down
2 changes: 1 addition & 1 deletion core/src/Ledger.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {ImmutableArgs} from "clones-with-immutable-args/ImmutableArgs.sol";
import {IERC165} from "openzeppelin-contracts/contracts/interfaces/IERC165.sol";
Expand Down
2 changes: 1 addition & 1 deletion core/src/Lender.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";
import {ERC20, SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
Expand Down
2 changes: 1 addition & 1 deletion core/src/RateModel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/src/VolatilityOracle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {IUniswapV3Pool} from "v3-core/contracts/interfaces/IUniswapV3Pool.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/BalanceSheet.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {FixedPointMathLib as SoladyMath} from "solady/utils/FixedPointMathLib.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/Exp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
pragma solidity 0.8.23;

/// @dev Returns \\( 10^{12} \cdot e^{\frac{x}{10^{12}}} \\) or `type(int256).max`, whichever is smaller
/// @custom:author Modified from [Solady](https://github.com/Vectorized/solady/blob/main/src/utils/FixedPointMathLib.sol#L113)
Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/LiquidityAmounts.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {Math} from "openzeppelin-contracts/contracts/utils/math/Math.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/MulDiv.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.23;

/// @dev Equivalent to `fullMulDiv(x, x, 1 << 64)`
function square(uint160 x) pure returns (uint256 result) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/Oracle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {FixedPointMathLib as SoladyMath} from "solady/utils/FixedPointMathLib.sol";
import {IUniswapV3Pool} from "v3-core/contracts/interfaces/IUniswapV3Pool.sol";
Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/Positions.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {Q24, Q48} from "./constants/Q.sol"; // solhint-disable-line no-unused-import

Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/Rewards.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {FixedPointMathLib as SoladyMath} from "solady/utils/FixedPointMathLib.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/TickMath.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {FixedPointMathLib as SoladyMath} from "solady/utils/FixedPointMathLib.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/Volatility.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {FixedPointMathLib as SoladyMath} from "solady/utils/FixedPointMathLib.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/constants/Constants.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

/// @dev The initial value of `Lender`'s `borrowIndex`
uint256 constant ONE = 1e12;
Expand Down
2 changes: 1 addition & 1 deletion core/src/libraries/constants/Q.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

uint256 constant Q8 = 1 << 8;

Expand Down
2 changes: 1 addition & 1 deletion core/test/Borrower.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/Factory.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion core/test/Lender.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/LenderERC20.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/LenderReferrals.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/LenderRewards.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/Liquidator.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/RateModel.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/Utils.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import {ClonesWithImmutableArgs} from "clones-with-immutable-args/ClonesWithImmutableArgs.sol";
import {ERC20} from "solmate/tokens/ERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion core/test/VolatilityOracle.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/gas/BorrowerGas.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/gas/FactoryGas.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/gas/LenderGas.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/gas/LiquidatorGas.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion core/test/gas/VolatilityGas.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.17;
pragma solidity 0.8.23;

import "forge-std/Test.sol";

Expand Down
Loading