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

feat: deployment config for fee oracle contract #936

Merged
merged 19 commits into from
Jun 2, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix lint
  • Loading branch information
karlfloersch committed May 27, 2021
commit 8d6280798dc26919eb3e3170b3986d9e5144e0bc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { expect } from '../../../setup'
import { ethers } from 'hardhat'
import { ContractFactory, Contract, Signer } from 'ethers'

describe.only('OVM_GasPriceOracle', () => {
describe('OVM_GasPriceOracle', () => {
const initialGasPrice = 0
let signer1: Signer
let signer2: Signer
Expand Down Expand Up @@ -37,47 +37,41 @@ describe.only('OVM_GasPriceOracle', () => {

describe('setGasPrice', () => {
it('should revert if called by someone other than the owner', async () => {
await expect(OVM_GasPriceOracle.connect(signer2).setGasPrice(1234))
.to.be.reverted
await expect(OVM_GasPriceOracle.connect(signer2).setGasPrice(1234)).to.be
.reverted
})

it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => {
const gasPrice = 1234

await expect(
OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)
).to.be.reverted
await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)).to
.be.reverted
})

it('should revert if DOES NOT satisfy `price % GAS_PRICE_MULTIPLE == 0`', async () => {
const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE()
const gasPrice = 1234 * gasPriceMultiple

await expect(
OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)
).to.not.be.reverted
await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)).to
.not.be.reverted
})

it('should succeed if called by the owner and is equal to `0`', async () => {
await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to
.not.be.reverted
await expect(OVM_GasPriceOracle.connect(signer1).setGasPrice(0)).to.not.be
.reverted
})
})

describe('get gasPrice', () => {
it('should return zero at first', async () => {
expect(await OVM_GasPriceOracle.gasPrice()).to.equal(
initialGasPrice
)
expect(await OVM_GasPriceOracle.gasPrice()).to.equal(initialGasPrice)
})

it('should change when setGasPrice is called', async () => {
const gasPriceMultiple = await OVM_GasPriceOracle.GAS_PRICE_MULTIPLE()
const gasPrice = 1234 * gasPriceMultiple

await OVM_GasPriceOracle.connect(signer1).setGasPrice(
gasPrice
)
await OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)

expect(await OVM_GasPriceOracle.gasPrice()).to.equal(gasPrice)
})
Expand All @@ -88,9 +82,7 @@ describe.only('OVM_GasPriceOracle', () => {
const slot = 1

// set the price
await OVM_GasPriceOracle.connect(signer1).setGasPrice(
gasPrice
)
await OVM_GasPriceOracle.connect(signer1).setGasPrice(gasPrice)

// get the storage slot value
const priceAtSlot = await signer1.provider.getStorageAt(
Expand Down