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

refactor(protocol): use npm to manage third-party solidity dependency #17881

Merged
merged 3 commits into from
Aug 6, 2024
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
14 changes: 8 additions & 6 deletions packages/protocol/contracts/L2/Lib1559Math.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "../thirdparty/solmate/LibFixedPointMath.sol";
import "@solady/src/utils/FixedPointMathLib.sol";
import "../libs/LibMath.sol";

/// @title Lib1559Math
Expand All @@ -12,6 +12,8 @@ import "../libs/LibMath.sol";
library Lib1559Math {
using LibMath for uint256;

uint128 public constant MAX_EXP_INPUT = 135_305_999_368_893_231_588;

error EIP1559_INVALID_PARAMS();

function calc1559BaseFee(
Expand Down Expand Up @@ -55,7 +57,7 @@ library Lib1559Math {
if (_adjustmentFactor == 0) {
revert EIP1559_INVALID_PARAMS();
}
return _ethQty(_gasExcess, _adjustmentFactor) / LibFixedPointMath.SCALING_FACTOR;
return _ethQty(_gasExcess, _adjustmentFactor) / FixedPointMathLib.WAD;
}

/// @dev exp(gas_qty / TARGET / ADJUSTMENT_QUOTIENT)
Expand All @@ -67,10 +69,10 @@ library Lib1559Math {
pure
returns (uint256)
{
uint256 input = _gasExcess * LibFixedPointMath.SCALING_FACTOR / _adjustmentFactor;
if (input > LibFixedPointMath.MAX_EXP_INPUT) {
input = LibFixedPointMath.MAX_EXP_INPUT;
uint256 input = _gasExcess * FixedPointMathLib.WAD / _adjustmentFactor;
if (input > MAX_EXP_INPUT) {
input = MAX_EXP_INPUT;
}
return uint256(LibFixedPointMath.exp(int256(input)));
return uint256(FixedPointMathLib.expWad(int256(input)));
}
}
6 changes: 3 additions & 3 deletions packages/protocol/contracts/libs/LibTrieProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

pragma solidity 0.8.24;

import "../thirdparty/optimism/rlp/RLPReader.sol";
import "../thirdparty/optimism/rlp/RLPWriter.sol";
import "../thirdparty/optimism/trie/SecureMerkleTrie.sol";
import "@optimism/packages/contracts-bedrock/src/libraries/rlp/RLPReader.sol";
import "@optimism/packages/contracts-bedrock/src/libraries/rlp/RLPWriter.sol";
import "@optimism/packages/contracts-bedrock/src/libraries/trie/SecureMerkleTrie.sol";

/// @title LibTrieProof
/// @custom:security-contact [email protected]
Expand Down
9 changes: 0 additions & 9 deletions packages/protocol/contracts/thirdparty/README.md

This file was deleted.

152 changes: 0 additions & 152 deletions packages/protocol/contracts/thirdparty/optimism/Bytes.sol

This file was deleted.

Loading