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

Upgrade solidity version #39

Merged
merged 6 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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 .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"visibility-modifier-order": "error",
"compiler-version": [
"warn",
"0.8.21"
"0.8.23"
],
"func-visibility": [
"warn",
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cache_path = "cache"
broadcast = "broadcast"
gas_reports = ["MToken", "Protocol", "ProtocolHarness"]
gas_reports_ignore = []
solc-version = "0.8.21"
solc-version = "0.8.23"
optimizer = false
verbosity = 3
ignored_error_codes = []
Expand Down
2 changes: 1 addition & 1 deletion lib/common
2 changes: 1 addition & 1 deletion script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { DeployBase } from "./DeployBase.s.sol";

Expand Down
2 changes: 1 addition & 1 deletion script/DeployBase.s.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { Script, console } from "../lib/forge-std/src/Script.sol";
import { ContractHelper } from "../lib/common/src/ContractHelper.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/ContinuousIndexing.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { IContinuousIndexing } from "./interfaces/IContinuousIndexing.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/EarnerRateModel.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { SPOGRegistrarReader } from "./libs/SPOGRegistrarReader.sol";

Expand Down
6 changes: 3 additions & 3 deletions src/MToken.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { IERC20 } from "../lib/common/src/interfaces/IERC20.sol";
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed as well as IProtocol.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


Expand Down Expand Up @@ -99,7 +99,7 @@ contract MToken is IMToken, ContinuousIndexing, ERC20Permit {
| External/Public View/Pure Functions |
\******************************************************************************************************************/

function balanceOf(address account_) external view override(ERC20Permit, IERC20) returns (uint256 balance_) {
function balanceOf(address account_) external view returns (uint256 balance_) {
return _isEarning[account_] ? _getPresentAmount(_balances[account_], currentIndex()) : _balances[account_];
}

Expand Down Expand Up @@ -127,7 +127,7 @@ contract MToken is IMToken, ContinuousIndexing, ERC20Permit {
return _totalNonEarningSupply;
}

function totalSupply() external view override(ERC20Permit, IERC20) returns (uint256 totalSupply_) {
function totalSupply() external view returns (uint256 totalSupply_) {
return _totalNonEarningSupply + totalEarningSupply();
}

Expand Down
2 changes: 1 addition & 1 deletion src/MinterRateModel.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { SPOGRegistrarReader } from "./libs/SPOGRegistrarReader.sol";

Expand Down
8 changes: 4 additions & 4 deletions src/Protocol.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { SignatureChecker } from "../lib/common/src/SignatureChecker.sol";
import { StatelessERC712 } from "../lib/common/src/StatelessERC712.sol";
import { ERC712 } from "../lib/common/src/ERC712.sol";

import { SPOGRegistrarReader } from "./libs/SPOGRegistrarReader.sol";

Expand All @@ -19,7 +19,7 @@ import { ContinuousIndexing } from "./ContinuousIndexing.sol";
* @author M^ZERO LABS_
* @notice Core protocol of M^ZERO ecosystem. TODO Add description.
*/
contract Protocol is IProtocol, ContinuousIndexing, StatelessERC712 {
contract Protocol is IProtocol, ContinuousIndexing, ERC712 {
// TODO: bit-packing
struct MintProposal {
uint256 id; // TODO: uint96 or uint48 if 2 additional fields
Expand Down Expand Up @@ -96,7 +96,7 @@ contract Protocol is IProtocol, ContinuousIndexing, StatelessERC712 {
* @param spogRegistrar_ The address of the SPOG Registrar contract.
* @param mToken_ The address of the M Token.
*/
constructor(address spogRegistrar_, address mToken_) ContinuousIndexing() StatelessERC712("Protocol") {
constructor(address spogRegistrar_, address mToken_) ContinuousIndexing() ERC712("Protocol") {
if ((spogRegistrar = spogRegistrar_) == address(0)) revert ZeroSpogRegistrar();
if ((spogVault = SPOGRegistrarReader.getVault(spogRegistrar_)) == address(0)) revert ZeroSpogVault();
if ((mToken = mToken_) == address(0)) revert ZeroMToken();
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IContinuousIndexing.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

interface IContinuousIndexing {
event IndexUpdated(uint256 indexed index, uint256 indexed rate);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IEarnerRateModel.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { IRateModel } from "./IRateModel.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IMToken.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { IERC20Permit } from "../../lib/common/src/interfaces/IERC20Permit.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IMinterRateModel.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { IRateModel } from "./IRateModel.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IProtocol.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { IContinuousIndexing } from "./IContinuousIndexing.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IRateModel.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

interface IRateModel {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISPOGRegistrar.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

interface ISPOGRegistrar {
function get(bytes32 key) external view returns (bytes32 value);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ContinuousIndexingMath.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

// TODO: Can optimize with base-2 scales instead of base-10 (so we can shift instead of divide)

Expand Down
2 changes: 1 addition & 1 deletion src/libs/SPOGRegistrarReader.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { ISPOGRegistrar } from "../interfaces/ISPOGRegistrar.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/Integrations.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { console2, stdError, Test } from "../lib/forge-std/src/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/InterestMath.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { console2, Test } from "../lib/forge-std/src/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/MToken.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { console2, stdError, Test } from "../lib/forge-std/src/Test.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/Protocol.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { console2, stdError, Test } from "../lib/forge-std/src/Test.sol";

Expand Down
6 changes: 3 additions & 3 deletions test/utils/DigestHelper.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import { IStatelessERC712 } from "../../lib/common/src/interfaces/IStatelessERC712.sol";
import { IERC712 } from "../../lib/common/src/interfaces/IERC712.sol";

import { IProtocol } from "../../src/interfaces/IProtocol.sol";

Expand All @@ -23,7 +23,7 @@ library DigestHelper {
}

function getUpdateCollateralDigest(address protocol, bytes32 internalDigest) public view returns (bytes32 digest_) {
return keccak256(abi.encodePacked("\x19\x01", IStatelessERC712(protocol).DOMAIN_SEPARATOR(), internalDigest));
return keccak256(abi.encodePacked("\x19\x01", IERC712(protocol).DOMAIN_SEPARATOR(), internalDigest));
}

function getUpdateCollateralInternalDigest(
Expand Down
2 changes: 1 addition & 1 deletion test/utils/MTokenHarness.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

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

Expand Down
2 changes: 1 addition & 1 deletion test/utils/Mocks.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

import "../../src/interfaces/ISPOGRegistrar.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/utils/ProtocolHarness.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.21;
pragma solidity 0.8.23;

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

Expand Down