Skip to content

Commit

Permalink
refactor(protocol): use npm to manage third-party solidity dependency (
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Aug 6, 2024
1 parent 7bf7d69 commit d524e69
Show file tree
Hide file tree
Showing 22 changed files with 1,390 additions and 1,728 deletions.
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 security@taiko.xyz
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

0 comments on commit d524e69

Please sign in to comment.