-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* contracts: gas price oracle * tests: update * fees: fix tests * contracts: simplify gas price oracle * lint: fix
- Loading branch information
Showing
6 changed files
with
92 additions
and
95 deletions.
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
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
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
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
67 changes: 0 additions & 67 deletions
67
packages/contracts/test/contracts/OVM/precompiles/OVM_CongestionPriceOracle.spec.ts
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
packages/contracts/test/contracts/OVM/precompiles/OVM_GasPriceOracle.spec.ts
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,65 @@ | ||
import { expect } from '../../../setup' | ||
|
||
/* External Imports */ | ||
import { ethers } from 'hardhat' | ||
import { ContractFactory, Contract, Signer } from 'ethers' | ||
|
||
describe('OVM_SequencerEntrypoint', () => { | ||
let signer1: Signer | ||
let signer2: Signer | ||
before(async () => { | ||
;[signer1, signer2] = await ethers.getSigners() | ||
}) | ||
|
||
let Factory__OVM_GasPriceOracle: ContractFactory | ||
before(async () => { | ||
Factory__OVM_GasPriceOracle = await ethers.getContractFactory( | ||
'OVM_GasPriceOracle' | ||
) | ||
}) | ||
|
||
let OVM_GasPriceOracle: Contract | ||
beforeEach(async () => { | ||
OVM_GasPriceOracle = await Factory__OVM_GasPriceOracle.deploy( | ||
await signer1.getAddress() | ||
) | ||
}) | ||
|
||
describe('owner', () => { | ||
it('should have an owner', async () => { | ||
expect(await OVM_GasPriceOracle.owner()).to.equal( | ||
await signer1.getAddress() | ||
) | ||
}) | ||
}) | ||
|
||
describe('setExecutionPrice', () => { | ||
it('should revert if called by someone other than the owner', async () => { | ||
await expect(OVM_GasPriceOracle.connect(signer2).setExecutionPrice(1234)) | ||
.to.be.reverted | ||
}) | ||
|
||
it('should succeed if called by the owner', async () => { | ||
await expect(OVM_GasPriceOracle.connect(signer1).setExecutionPrice(1234)) | ||
.to.not.be.reverted | ||
}) | ||
}) | ||
|
||
describe('getExecutionPrice', () => { | ||
it('should return zero at first', async () => { | ||
expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal(0) | ||
}) | ||
|
||
it('should change when setExecutionPrice is called', async () => { | ||
const executionPrice = 1234 | ||
|
||
await OVM_GasPriceOracle.connect(signer1).setExecutionPrice( | ||
executionPrice | ||
) | ||
|
||
expect(await OVM_GasPriceOracle.getExecutionPrice()).to.equal( | ||
executionPrice | ||
) | ||
}) | ||
}) | ||
}) |