A collection of useful JavaScript/TypeScript tooling plugins that you might need when building on top of Optimistic Ethereum!
Plugins for hardhat
Automatically compiles your Solidity contracts with the OVM compiler. Defaults to Solidity version 0.7.6, but also has support for 0.5.16 and 0.6.12. Full README available here.
Just import into your hardhat.config.js
!
// hardhat.config.js
require("@eth-optimism/plugins/hardhat/ethers")
Or if using typescript:
// hardhat.config.ts
import "@eth-optimism/plugins/hardhat/ethers"
Creates an l2ethers
object that can be imported via hardhat
.
Behaves identically to the ethers
object that you would get if using @nomiclabs/hardhat-ethers
, but deploys contracts to Layer 2 instead of Layer 1!
Here's it in action:
import { l2ethers } from "hardhat"
describe("My Contract Test", () => {
it("should deploy a contract", async () => {
const factory = await l2ethers.getContractFactory("MyContractName")
const instance = await factory.deploy()
// Now we're cooking with gas!
})
})