Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .changeset/healthy-otters-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Removes outdated functions and constants from the contracts package
28 changes: 0 additions & 28 deletions packages/contracts/src/contract-defs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,3 @@ export const getContractFactory = (
signer
)
}

export const loadContract = (
name: string,
address: string,
provider: ethers.providers.JsonRpcProvider
): ethers.Contract => {
return new ethers.Contract(
address,
getContractInterface(name) as any,
provider
)
}

export const loadContractFromManager = async (args: {
name: string
proxy?: string
Lib_AddressManager: ethers.Contract
provider: ethers.providers.JsonRpcProvider
}): Promise<ethers.Contract> => {
const { name, proxy, Lib_AddressManager, provider } = args
const address = await Lib_AddressManager.getAddress(proxy ? proxy : name)
if (address === ethers.constants.AddressZero) {
throw new Error(
`Lib_AddressManager does not have a record for a contract named: ${name}`
)
}
return loadContract(name, address, provider)
}
3 changes: 0 additions & 3 deletions packages/contracts/test/helpers/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* External Imports */
import { defaultAccounts } from 'ethereum-waffle'

export const DEFAULT_ACCOUNTS = defaultAccounts
export const DEFAULT_ACCOUNTS_HARDHAT = defaultAccounts.map((account) => {
return {
balance: account.balance,
Expand All @@ -10,10 +9,8 @@ export const DEFAULT_ACCOUNTS_HARDHAT = defaultAccounts.map((account) => {
})

export const RUN_OVM_TEST_GAS = 20_000_000
export const FORCE_INCLUSION_PERIOD_SECONDS = 600
export const L2_GAS_DISCOUNT_DIVISOR = 32
export const ENQUEUE_GAS_COST = 60_000
export const FORCE_INCLUSION_PERIOD_BLOCKS = 600 / 12

export const NON_NULL_BYTES32 =
'0x1111111111111111111111111111111111111111111111111111111111111111'
Expand Down
12 changes: 6 additions & 6 deletions packages/contracts/test/helpers/trie/trie-test-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import { SecureTrie, BaseTrie } from 'merkle-patricia-tree'
import { fromHexString, toHexString } from '@eth-optimism/core-utils'
import { ethers } from 'ethers'

export interface TrieNode {
interface TrieNode {
key: string
val: string
}

export interface InclusionProofTest {
interface InclusionProofTest {
key: string
val: string
proof: string
root: string
}

export interface NodeUpdateTest extends InclusionProofTest {
interface NodeUpdateTest extends InclusionProofTest {
newRoot: string
}

export interface EthereumAccount {
interface EthereumAccount {
address?: string
nonce: number
balance: number
Expand All @@ -30,14 +30,14 @@ export interface EthereumAccount {
storage?: TrieNode[]
}

export interface AccountProofTest {
interface AccountProofTest {
address: string
account: EthereumAccount
accountTrieWitness: string
accountTrieRoot: string
}

export interface AccountUpdateTest extends AccountProofTest {
interface AccountUpdateTest extends AccountProofTest {
newAccountTrieRoot: string
}

Expand Down
16 changes: 1 addition & 15 deletions packages/contracts/test/helpers/utils/eth-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,10 @@ export const increaseEthTime = async (
await mineBlock(provider)
}

export const mineBlock = async (
provider: any,
timestamp?: number
): Promise<void> => {
const mineBlock = async (provider: any, timestamp?: number): Promise<void> => {
await provider.send('evm_mine', timestamp ? [timestamp] : [])
}

export const getBlockTime = async (
provider: any,
block?: number
): Promise<number> => {
await mineBlock(provider)
if (!!block) {
block = await getNextBlockNumber(provider)
}
return (await provider.getBlock(block)).timestamp
}

export const getNextBlockNumber = async (provider: any): Promise<number> => {
return (await provider.getBlock('latest')).number + 1
}