-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mock and include in testable toml
- Loading branch information
1 parent
aa17203
commit af154fa
Showing
2 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,40 @@ | ||
name = "op-gas-price-oracle" | ||
version = "<%= package.version %>-testable" | ||
include = ["cannonfile.toml"] | ||
|
||
[setting.baseFee] | ||
defaultValue = "30000000" | ||
|
||
[setting.gasPrice] | ||
defaultValue = "30000000" | ||
|
||
[setting.l1BaseFee] | ||
defaultValue = "50000000000" | ||
|
||
[setting.overhead] | ||
defaultValue = "200" | ||
|
||
[setting.scalar] | ||
defaultValue = "684000" | ||
|
||
[setting.internall1GasUsed] | ||
defaultValue = "10000" | ||
|
||
[setting.internall1Fee] | ||
defaultValue = "1000" | ||
|
||
[contract.mockOVMGasPriceOracle] | ||
artifact = "contracts/mocks/MockOVMGasPriceOracle.sol:MockOVMGasPriceOracle" | ||
args = [ | ||
"<%= settings.gasPrice %>", | ||
"<%= settings.overhead %>", | ||
"<%= settings.baseFee %>", | ||
"<%= settings.l1BaseFee %>", | ||
"<%= settings.scalar %>", | ||
"<%= settings.internall1GasUsed %>", | ||
"<%= settings.internall1Fee %>" | ||
] | ||
|
||
[contract.OpGasPriceOracle] | ||
artifact = "contracts/OpGasPriceOracle.sol:OpGasPriceOracle" | ||
args = ["<%= contracts.mockOVMGasPriceOracle.address %>"] | ||
create2 = true |
66 changes: 66 additions & 0 deletions
66
auxiliary/OpGasPriceOracle/contracts/mocks/MockOVMGasPriceOracle.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0; | ||
|
||
import "../interfaces/IOVM_GasPriceOracle.sol"; | ||
|
||
contract MockOVMGasPriceOracle is IOVM_GasPriceOracle { | ||
uint256 public constant DECIMALS = 6; | ||
|
||
uint256 public gasPrice; | ||
uint256 public overhead; | ||
uint256 public baseFee; | ||
uint256 public l1BaseFee; | ||
uint256 public scalar; | ||
uint256 public internall1GasUsed; | ||
uint256 public internall1Fee; | ||
|
||
constructor( | ||
uint256 _gasPrice, | ||
uint256 _overhead, | ||
uint256 _baseFee, | ||
uint256 _l1BaseFee, | ||
uint256 _scalar, | ||
uint256 _internall1GasUsed, | ||
uint256 _internall1Fee | ||
) { | ||
gasPrice = _gasPrice; | ||
overhead = _overhead; | ||
baseFee = _baseFee; | ||
l1BaseFee = _l1BaseFee; | ||
scalar = _scalar; | ||
internall1GasUsed = _internall1GasUsed; | ||
internall1Fee = _internall1Fee; | ||
} | ||
|
||
function setParams( | ||
uint256 _gasPrice, | ||
uint256 _overhead, | ||
uint256 _baseFee, | ||
uint256 _l1BaseFee, | ||
uint256 _scalar, | ||
uint256 _internall1GasUsed, | ||
uint256 _internall1Fee | ||
) external { | ||
gasPrice = _gasPrice; | ||
overhead = _overhead; | ||
baseFee = _baseFee; | ||
l1BaseFee = _l1BaseFee; | ||
scalar = _scalar; | ||
internall1GasUsed = _internall1GasUsed; | ||
internall1Fee = _internall1Fee; | ||
} | ||
|
||
function decimals() external pure returns (uint256) { | ||
return DECIMALS; | ||
} | ||
|
||
function getL1Fee(bytes memory _data) external view returns (uint256) { | ||
_data; | ||
return internall1Fee; | ||
} | ||
|
||
function getL1GasUsed(bytes memory _data) external view returns (uint256) { | ||
_data; | ||
return internall1GasUsed; | ||
} | ||
} |