Commit dc034be4 authored by Corey Rice's avatar Corey Rice Committed by Kelvin Fichter

style: Turn on eslint no unused vars

parent a98a1884
......@@ -81,6 +81,7 @@ module.exports = {
],
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/no-unused-vars': 'error',
},
},
],
......
......@@ -3,14 +3,9 @@ import chaiAsPromised from 'chai-as-promised'
chai.use(chaiAsPromised)
/* Imports: External */
import { ethers, BigNumber, Contract, utils } from 'ethers'
import { sleep } from '@eth-optimism/core-utils'
import { BigNumber, utils } from 'ethers'
import { serialize } from '@ethersproject/transactions'
import {
predeploys,
getContractInterface,
getContractFactory,
} from '@eth-optimism/contracts'
import { predeploys, getContractFactory } from '@eth-optimism/contracts'
/* Imports: Internal */
import { isLiveNetwork } from './shared/utils'
......@@ -166,8 +161,6 @@ describe('Fee Payment Integration Tests', async () => {
const balanceBefore = await env.l1Wallet.provider.getBalance(l1FeeWallet)
const withdrawalAmount = await env.sequencerFeeVault.MIN_WITHDRAWAL_AMOUNT()
const l2WalletBalance = await env.l2Wallet.getBalance()
// Transfer the minimum required to withdraw.
const tx = await env.l2Wallet.sendTransaction({
to: env.sequencerFeeVault.address,
......
import {
BigNumber,
BigNumberish,
Contract,
ContractFactory,
Wallet,
} from 'ethers'
import { BigNumber, Contract, ContractFactory, Wallet } from 'ethers'
import { ethers } from 'hardhat'
import chai, { expect } from 'chai'
import {
......
......@@ -9,8 +9,8 @@ import { expectApprox } from '@eth-optimism/core-utils'
/* Imports: Internal */
import { Direction } from './shared/watcher-utils'
import { fundUser, PROXY_SEQUENCER_ENTRYPOINT_ADDRESS } from './shared/utils'
import { OptimismEnv, useDynamicTimeoutForWithdrawals } from './shared/env'
import { PROXY_SEQUENCER_ENTRYPOINT_ADDRESS } from './shared/utils'
import { OptimismEnv } from './shared/env'
const DEFAULT_TEST_GAS_L1 = 330_000
const DEFAULT_TEST_GAS_L2 = 1_300_000
......
/* Imports: External */
import { Contract, ContractFactory, Wallet } from 'ethers'
import { ContractFactory } from 'ethers'
import { ethers } from 'hardhat'
import chai, { expect } from 'chai'
import { solidity } from 'ethereum-waffle'
......
/* Imports: External */
import { DeployFunction } from 'hardhat-deploy/dist/types'
import { hexStringEquals } from '@eth-optimism/core-utils'
/* Imports: Internal */
import {
......
/* Imports: External */
import { hexStringEquals, awaitCondition } from '@eth-optimism/core-utils'
import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/dist/types'
/* Imports: Internal */
......
......@@ -2,11 +2,7 @@
import { ethers, Contract } from 'ethers'
import { Provider } from '@ethersproject/abstract-provider'
import { Signer } from '@ethersproject/abstract-signer'
import {
sleep,
hexStringEquals,
awaitCondition,
} from '@eth-optimism/core-utils'
import { sleep, awaitCondition } from '@eth-optimism/core-utils'
import { HttpNetworkConfig } from 'hardhat/types'
export const deployAndPostDeploy = async ({
......
......@@ -21,7 +21,7 @@ task('set-l2-gasprice')
process.env.CONTRACTS_DEPLOYER_KEY,
types.string
)
.setAction(async (args, hre: any, runSuper) => {
.setAction(async (args) => {
const provider = new ethers.providers.JsonRpcProvider(args.contractsRpcUrl)
const signer = new ethers.Wallet(args.contractsDeployerKey).connect(
provider
......
......@@ -40,7 +40,7 @@ task('set-owner')
predeploys.OVM_GasPriceOracle,
types.string
)
.setAction(async (args, hre: any, runSuper) => {
.setAction(async (args) => {
const provider = new ethers.providers.JsonRpcProvider(args.contractsRpcUrl)
let signer: ethers.Signer
if (!args.useLedger) {
......
......@@ -42,7 +42,7 @@ task('whitelist')
predeploys.OVM_DeployerWhitelist,
types.string
)
.setAction(async (args, hre: any) => {
.setAction(async (args) => {
const provider = new ethers.providers.JsonRpcProvider(args.contractsRpcUrl)
let signer: ethers.Signer
if (!args.useLedger) {
......
......@@ -35,7 +35,7 @@ task('withdraw-fees')
process.env.CONTRACTS_DEPLOYER_KEY,
types.string
)
.setAction(async (args, hre: any) => {
.setAction(async (args) => {
const provider = new ethers.providers.JsonRpcProvider(args.contractsRpcUrl)
let signer: ethers.Signer
if (!args.useLedger) {
......
......@@ -27,7 +27,6 @@ import {
setEthTime,
} from '../../../helpers'
import { predeploys } from '../../../../src'
import { keccak256 } from 'ethers/lib/utils'
const MAX_GAS_LIMIT = 8_000_000
......@@ -113,7 +112,7 @@ describe('L1CrossDomainMessenger', () => {
AddressManager.address,
'CanonicalTransactionChain'
)
const queue = await Factory__ChainStorageContainer.deploy(
await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'CanonicalTransactionChain'
)
......
......@@ -31,13 +31,12 @@ describe('L1StandardBridge', () => {
let aliceAddress
// we can just make up this string since it's on the "other" Layer
let Mock__OVM_ETH: MockContract
let Factory__L1ERC20: ContractFactory
let IL2ERC20Bridge: Interface
before(async () => {
;[l1MessengerImpersonator, alice, bob] = await ethers.getSigners()
Mock__OVM_ETH = await smockit(await ethers.getContractFactory('OVM_ETH'))
await smockit(await ethers.getContractFactory('OVM_ETH'))
// deploy an ERC20 contract on L1
Factory__L1ERC20 = await smoddit(
......
/* External Imports */
import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, constants } from 'ethers'
import { Signer, ContractFactory, Contract } from 'ethers'
import { smoddit } from '@eth-optimism/smock'
import { expectApprox } from '@eth-optimism/core-utils'
......@@ -56,7 +56,7 @@ describe('[GAS BENCHMARK] Depositing via the standard bridge [ @skip-on-coverage
AddressManager.address,
'CanonicalTransactionChain'
)
const queue = await Factory__ChainStorageContainer.deploy(
await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'CanonicalTransactionChain'
)
......
/* External Imports */
import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, constants } from 'ethers'
import { Signer, ContractFactory, Contract } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock'
import {
AppendSequencerBatchParams,
......@@ -10,13 +10,11 @@ import {
} from '@eth-optimism/core-utils'
import { TransactionResponse } from '@ethersproject/abstract-provider'
import { keccak256 } from 'ethers/lib/utils'
import _ from 'lodash'
/* Internal Imports */
import {
makeAddressManager,
setProxyTarget,
FORCE_INCLUSION_PERIOD_SECONDS,
L2_GAS_DISCOUNT_DIVISOR,
ENQUEUE_GAS_COST,
getEthTime,
......@@ -92,7 +90,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain [ @skip-on-coverage ]', () =
AddressManager.address,
'CanonicalTransactionChain'
)
const queue = await Factory__ChainStorageContainer.deploy(
await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'CanonicalTransactionChain'
)
......
......@@ -2,12 +2,11 @@ import { expect } from '../../../setup'
/* External Imports */
import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, BigNumber, constants } from 'ethers'
import { Signer, ContractFactory, Contract } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock'
import {
AppendSequencerBatchParams,
encodeAppendSequencerBatch,
remove0x,
} from '@eth-optimism/core-utils'
import { TransactionResponse } from '@ethersproject/abstract-provider'
import { keccak256 } from 'ethers/lib/utils'
......@@ -24,7 +23,6 @@ import {
getEthTime,
getNextBlockNumber,
} from '../../../helpers'
import { predeploys } from '../../../../src'
const ELEMENT_TEST_SIZES = [1, 2, 4, 8, 16]
const MAX_GAS_LIMIT = 8_000_000
......@@ -115,7 +113,7 @@ describe('CanonicalTransactionChain', () => {
AddressManager.address,
'CanonicalTransactionChain'
)
const queue = await Factory__ChainStorageContainer.deploy(
await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'CanonicalTransactionChain'
)
......@@ -146,7 +144,6 @@ describe('CanonicalTransactionChain', () => {
addressManagerOwner
).setGasParams(newGasDivisor, newEnqueueGasCost)
const l2GasDiscountDivisor =
await CanonicalTransactionChain.l2GasDiscountDivisor()
const enqueueL2GasPrepaid =
await CanonicalTransactionChain.enqueueL2GasPrepaid()
......
......@@ -3,7 +3,6 @@ import { expect } from '../../../setup'
/* External Imports */
import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers'
import { Interface } from 'ethers/lib/utils'
import {
smockit,
MockContract,
......@@ -31,7 +30,6 @@ describe('L2StandardBridge', () => {
let bobsAddress: string
let l2MessengerImpersonator: Signer
let Factory__L1StandardBridge: ContractFactory
let IL2ERC20Bridge: Interface
const INITIAL_TOTAL_SUPPLY = 100_000
const ALICE_INITIAL_BALANCE = 50_000
before(async () => {
......@@ -44,7 +42,7 @@ describe('L2StandardBridge', () => {
)
// get an L2ER20Bridge Interface
IL2ERC20Bridge = getContractInterface('IL2ERC20Bridge')
getContractInterface('IL2ERC20Bridge')
})
let L2StandardBridge: Contract
......
......@@ -276,7 +276,6 @@ describe('OVM_GasPriceOracle', () => {
describe('decimals', () => {
it('is the 5th storage slot', async () => {
const decimals = 6
const slot = 5
// get the storage slot value
......
......@@ -4,7 +4,7 @@
* @param ms Number of milliseconds to sleep.
*/
export const sleep = async (ms: number): Promise<void> => {
return new Promise<void>((resolve, reject) => {
return new Promise<void>((resolve) => {
setTimeout(() => {
resolve(null)
}, ms)
......
......@@ -2,7 +2,6 @@
import { ethers } from 'ethers'
import { Provider, TransactionReceipt } from '@ethersproject/abstract-provider'
const SENT_MESSAGE = ethers.utils.id('SentMessage(bytes)')
const RELAYED_MESSAGE = ethers.utils.id(`RelayedMessage(bytes32)`)
const FAILED_RELAYED_MESSAGE = ethers.utils.id(`FailedRelayedMessage(bytes32)`)
......
import { expect } from './setup'
import * as fees from '../src/fees'
import { BigNumber, utils } from 'ethers'
const hundredBillion = 10 ** 11
const tenThousand = 10 ** 4
describe('Fees', () => {
it('should count zeros and ones', () => {
......
......@@ -173,15 +173,6 @@ export const solcInput = (contract: EtherscanContract) => {
return input
}
const compilerCache: {
[target: string]: {
[hash: string]: any
}
} = {
['OVM']: {},
['EVM']: {},
}
const readCompilerCache = (
target: 'evm' | 'ovm',
hash: string
......
/* eslint-disable @typescript-eslint/no-empty-function */
import { expect, env, NUM_ACCOUNTS_DIVISOR } from '../setup'
import { AccountType, Account } from '../../scripts/types'
import { AccountType } from '../../scripts/types'
describe('verified', () => {
before(async () => {
......
......@@ -75,10 +75,7 @@ export class GenesisJsonProvider implements AbstractProvider {
}
}
async getBalance(
addressOrName: string,
blockTag?: BlockTag
): Promise<BigNumber> {
async getBalance(addressOrName: string): Promise<BigNumber> {
const address = remove0x(addressOrName)
const account = this.state[address]
if (!account) {
......@@ -87,10 +84,7 @@ export class GenesisJsonProvider implements AbstractProvider {
return BigNumber.from(account.balance)
}
async getTransactionCount(
addressOrName: string,
blockTag?: BlockTag
): Promise<number> {
async getTransactionCount(addressOrName: string): Promise<number> {
const address = remove0x(addressOrName)
const account = this.state[address]
if (!account) {
......@@ -99,7 +93,7 @@ export class GenesisJsonProvider implements AbstractProvider {
return account.nonce
}
async getCode(addressOrName: string, blockTag?: BlockTag): Promise<string> {
async getCode(addressOrName: string): Promise<string> {
const address = remove0x(addressOrName)
const account = this.state[address]
if (!account) {
......@@ -110,8 +104,7 @@ export class GenesisJsonProvider implements AbstractProvider {
async getStorageAt(
addressOrName: string,
position: BigNumber | number,
blockTag?: BlockTag
position: BigNumber | number
): Promise<string> {
const address = remove0x(addressOrName)
const account = this.state[address]
......@@ -130,7 +123,9 @@ export class GenesisJsonProvider implements AbstractProvider {
transaction: Deferrable<TransactionRequest>,
blockTag?: BlockTag | Promise<BlockTag>
): Promise<string> {
throw new Error('Unsupported Method: call')
throw new Error(
`Unsupported Method: call with args: transaction - ${transaction}, blockTag - ${blockTag}`
)
}
async send(method: string, args: Array<any>): Promise<any> {
......@@ -177,73 +172,101 @@ export class GenesisJsonProvider implements AbstractProvider {
async sendTransaction(
signedTransaction: string | Promise<string>
): Promise<TransactionResponse> {
throw new Error('Unsupported Method: sendTransaction')
throw new Error(
`Unsupported Method: sendTransaction with args: transaction - ${signedTransaction}`
)
}
async estimateGas(
transaction: Deferrable<TransactionRequest>
): Promise<BigNumber> {
async estimateGas(): Promise<BigNumber> {
return BigNumber.from(0)
}
async getBlock(
blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>
): Promise<Block> {
throw new Error('Unsupported Method: getBlock')
throw new Error(
`Unsupported Method: getBlock with args blockHashOrBlockTag - ${blockHashOrBlockTag}`
)
}
async getBlockWithTransactions(
blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | string>
): Promise<BlockWithTransactions> {
throw new Error('Unsupported Method: getBlockWithTransactions')
throw new Error(
`Unsupported Method: getBlockWithTransactions with args blockHashOrBlockTag - ${blockHashOrBlockTag}`
)
}
async getTransaction(transactionHash: string): Promise<TransactionResponse> {
throw new Error('Unsupported Method: getTransaction')
throw new Error(
`Unsupported Method: getTransaction with args transactionHash - ${transactionHash}`
)
}
async getTransactionReceipt(
transactionHash: string
): Promise<TransactionReceipt> {
throw new Error('Unsupported Method: getTransactionReceipt')
throw new Error(
`Unsupported Method: getTransactionReceipt with args transactionHash - ${transactionHash}`
)
}
async getLogs(filter: Filter): Promise<Array<Log>> {
throw new Error('Unsupported Method: getLogs')
throw new Error(`Unsupported Method: getLogs with args filter - ${filter}`)
}
async resolveName(name: string | Promise<string>): Promise<null | string> {
throw new Error('Unsupported Method: resolveName')
throw new Error(`Unsupported Method: resolveName with args name - ${name}`)
}
async lookupAddress(
address: string | Promise<string>
): Promise<null | string> {
throw new Error('Unsupported Method: lookupAddress')
throw new Error(
`Unsupported Method: lookupAddress with args address - ${address}`
)
}
on(eventName: EventType, listener: Listener): Provider {
throw new Error('Unsupported Method: on')
throw new Error(
`Unsupported Method: on with args eventName - ${eventName}, listener - ${listener}`
)
}
once(eventName: EventType, listener: Listener): Provider {
throw new Error('Unsupported Method: once')
throw new Error(
`Unsupported Method: once with args eventName - ${eventName}, listener - ${listener}`
)
}
emit(eventName: EventType, ...args: Array<any>): boolean {
throw new Error('Unsupported Method: emit')
throw new Error(
`Unsupported Method: emit with args eventName - ${eventName}, args - ${args}`
)
}
listenerCount(eventName?: EventType): number {
throw new Error('Unsupported Method: listenerCount')
throw new Error(
`Unsupported Method: listenerCount with args eventName - ${eventName}`
)
}
listeners(eventName?: EventType): Array<Listener> {
throw new Error('Unsupported Method: listeners')
throw new Error(
`Unsupported Method: listeners with args eventName - ${eventName}`
)
}
off(eventName: EventType, listener?: Listener): Provider {
throw new Error('Unsupported Method: off')
throw new Error(
`Unsupported Method: off with args eventName - ${eventName}, listener - ${listener}`
)
}
removeAllListeners(eventName?: EventType): Provider {
throw new Error('Unsupported Method: removeAllListeners')
throw new Error(
`Unsupported Method: removeAllListeners with args eventName - ${eventName}`
)
}
addListener(eventName: EventType, listener: Listener): Provider {
throw new Error('Unsupported Method: addListener')
throw new Error(
`Unsupported Method: addListener with args eventName - ${eventName}, listener - ${listener}`
)
}
removeListener(eventName: EventType, listener: Listener): Provider {
throw new Error('Unsupported Method: removeListener')
throw new Error(
`Unsupported Method: removeListener with args eventName - ${eventName}, listener - ${listener}`
)
}
async waitForTransaction(
......@@ -251,7 +274,9 @@ export class GenesisJsonProvider implements AbstractProvider {
confirmations?: number,
timeout?: number
): Promise<TransactionReceipt> {
throw new Error('Unsupported Method: waitForTransaction')
throw new Error(
`Unsupported Method: waitForTransaction with args transactionHash - ${transactionHash}, confirmations - ${confirmations}, timeout - ${timeout}`
)
}
readonly _isProvider: boolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment