-
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.
refactor: remove hardhat-ovm plugin and its deps
- Loading branch information
1 parent
1e63ffa
commit a14047b
Showing
37 changed files
with
54 additions
and
2,263 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ | |
set -e | ||
|
||
yarn build:contracts | ||
yarn build:contracts:ovm | ||
yarn generate:artifacts | ||
yarn build:typescript |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,60 @@ | ||
import { | ||
ethers, | ||
ContractFactory, | ||
Signer, | ||
providers, | ||
Contract, | ||
constants, | ||
} from 'ethers' | ||
import { Interface } from 'ethers/lib/utils' | ||
import { ethers } from 'ethers' | ||
|
||
export const getContractDefinition = (name: string, ovm?: boolean): any => { | ||
export const getContractDefinition = (name: string): any => { | ||
// We import this using `require` because hardhat tries to build this file when compiling | ||
// the contracts, but we need the contracts to be compiled before the contract-artifacts.ts | ||
// file can be generated. | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const { getContractArtifact } = require('./contract-artifacts') | ||
const artifact = getContractArtifact(name, ovm) | ||
const artifact = getContractArtifact(name) | ||
if (artifact === undefined) { | ||
throw new Error(`Unable to find artifact for contract: ${name}`) | ||
} | ||
return artifact | ||
} | ||
|
||
export const getContractInterface = ( | ||
name: string, | ||
ovm?: boolean | ||
): Interface => { | ||
const definition = getContractDefinition(name, ovm) | ||
export const getContractInterface = (name: string): ethers.utils.Interface => { | ||
const definition = getContractDefinition(name) | ||
return new ethers.utils.Interface(definition.abi) | ||
} | ||
|
||
export const getContractFactory = ( | ||
name: string, | ||
signer?: Signer, | ||
ovm?: boolean | ||
): ContractFactory => { | ||
const definition = getContractDefinition(name, ovm) | ||
const contractInterface = getContractInterface(name, ovm) | ||
return new ContractFactory(contractInterface, definition.bytecode, signer) | ||
signer?: ethers.Signer | ||
): ethers.ContractFactory => { | ||
const definition = getContractDefinition(name) | ||
const contractInterface = getContractInterface(name) | ||
return new ethers.ContractFactory( | ||
contractInterface, | ||
definition.bytecode, | ||
signer | ||
) | ||
} | ||
|
||
export const loadContract = ( | ||
name: string, | ||
address: string, | ||
provider: providers.JsonRpcProvider | ||
): Contract => { | ||
return new Contract(address, getContractInterface(name) as any, provider) | ||
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: Contract | ||
provider: providers.JsonRpcProvider | ||
}): Promise<Contract> => { | ||
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 === constants.AddressZero) { | ||
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) | ||
} |
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
Oops, something went wrong.