Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
8dc0f910
Unverified
Commit
8dc0f910
authored
Sep 24, 2021
by
elenadimitrova
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused predeploy interface iOVM_GasPriceOracle
and remove SafeMath from 0.8 GasPriceOracle contract
parent
a9fc7310
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
47 deletions
+15
-47
OVM_GasPriceOracle.sol
.../contracts/contracts/L2/predeploys/OVM_GasPriceOracle.sol
+15
-17
iOVM_GasPriceOracle.sol
...contracts/contracts/L2/predeploys/iOVM_GasPriceOracle.sol
+0
-30
No files found.
packages/contracts/contracts/L2/predeploys/OVM_GasPriceOracle.sol
View file @
8dc0f910
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/* Internal Imports */
import { iOVM_GasPriceOracle } from "./iOVM_GasPriceOracle.sol";
/* External Imports */
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
/**
* @title OVM_GasPriceOracle
...
...
@@ -19,7 +15,7 @@ import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
* constructor doesn't run in practice as the L2 state generation script uses
* the deployed bytecode instead of running the initcode.
*/
contract OVM_GasPriceOracle is Ownable
, iOVM_GasPriceOracle
{
contract OVM_GasPriceOracle is Ownable {
/*************
* Variables *
...
...
@@ -52,6 +48,15 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
transferOwnership(_owner);
}
/**********
* Events *
**********/
event GasPriceUpdated(uint256);
event L1BaseFeeUpdated(uint256);
event OverheadUpdated(uint256);
event ScalarUpdated(uint256);
event DecimalsUpdated(uint256);
/********************
* Public Functions *
...
...
@@ -65,7 +70,6 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
uint256 _gasPrice
)
public
override
onlyOwner
{
gasPrice = _gasPrice;
...
...
@@ -80,7 +84,6 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
uint256 _baseFee
)
public
override
onlyOwner
{
l1BaseFee = _baseFee;
...
...
@@ -95,7 +98,6 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
uint256 _overhead
)
public
override
onlyOwner
{
overhead = _overhead;
...
...
@@ -110,7 +112,6 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
uint256 _scalar
)
public
override
onlyOwner
{
scalar = _scalar;
...
...
@@ -125,7 +126,6 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
uint256 _decimals
)
public
override
onlyOwner
{
decimals = _decimals;
...
...
@@ -142,16 +142,15 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
function getL1Fee(bytes memory _data)
public
view
override
returns (
uint256
)
{
uint256 l1GasUsed = getL1GasUsed(_data);
uint256 l1Fee =
SafeMath.mul(l1GasUsed, l1BaseFee)
;
uint256 l1Fee =
l1GasUsed * l1BaseFee
;
uint256 divisor = 10**decimals;
uint256 unscaled =
SafeMath.mul(l1Fee, scalar)
;
uint256 scaled =
SafeMath.div(unscaled, divisor)
;
uint256 unscaled =
l1Fee * scalar
;
uint256 scaled =
unscaled / divisor
;
return scaled;
}
...
...
@@ -180,7 +179,6 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
function getL1GasUsed(bytes memory _data)
public
view
override
returns (
uint256
)
...
...
@@ -193,7 +191,7 @@ contract OVM_GasPriceOracle is Ownable, iOVM_GasPriceOracle {
total += 16;
}
}
uint256 unsigned =
SafeMath.add(total, overhead)
;
return
SafeMath.add(unsigned,
68 * 16);
uint256 unsigned =
total + overhead
;
return
unsigned + (
68 * 16);
}
}
packages/contracts/contracts/L2/predeploys/iOVM_GasPriceOracle.sol
deleted
100644 → 0
View file @
a9fc7310
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
/**
* @title iOVM_GasPriceOracle
*/
interface iOVM_GasPriceOracle {
/**********
* Events *
**********/
event GasPriceUpdated(uint256);
event L1BaseFeeUpdated(uint256);
event OverheadUpdated(uint256);
event ScalarUpdated(uint256);
event DecimalsUpdated(uint256);
/********************
* Public Functions *
********************/
function setGasPrice(uint256 _gasPrice) external;
function setL1BaseFee(uint256 _baseFee) external;
function setOverhead(uint256 _overhead) external;
function setScalar(uint256 _scalar) external;
function setDecimals(uint256 _decimals) external;
function getL1Fee(bytes memory _data) external returns (uint256);
function getL1GasUsed(bytes memory _data) external returns (uint256);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment