random
== vs ===
4 == 4 => true
4 == "4" => true
4 === "4" => false
js function reminder
arrow 1
function
and const functions are almost the same.async function greeter(greeting, name) {}
- same asconst greeter = async (greeting, name) => {}
- same asasync (greeting, name) => {}
arrow 2
- preferred:
describe("hello", function() {})
- not preferred:
describe("hello", () => {})
dealing with nested imports
given this tree structure
📦test
┗ 📜test-deploy.ts
📦typechain-types
┣ 📂factories
┃ ┣ 📜SimpleStorage__factory.ts
┃ ┗ 📜index.ts
┣ 📜SimpleStorage.ts
┣ 📜common.ts
┣ 📜hardhat.d.ts
┗ 📜index.ts
I want import { SimpleStorage__factory, SimpleStorage } from "../typechain-types"
in test-deploy.ts
SimpleStorage__factory
- in
📦typechain-types > 📂factories > 📜SimpleStorage__factory.ts
=>export class SimpleStorage__factory
- in
📦typechain-types > 📂factories > 📜index.ts
=>export { SimpleStorage__factory } from "./SimpleStorage__factory";
- in
📦typechain-types > 📜index.ts
=>export * as factories from "./factories";
&export { SimpleStorage__factory } from "./factories/SimpleStorage__factory";
SimpleStorage
- in
📦typechain-types > 📜SimpleStorage.ts
=>export interface SimpleStorage
- in
📦typechain-types > 📜index.ts
=>export type { SimpleStorage } from "./SimpleStorage";
-
import
task from "hardhat/config"
import -
import
{task} from "hardhat/config"
import the task functio
function export + destructure
async function deploy(hre) {
const namedAccounts = hre.getNamedAccounts,
deployments = hre.deployments;
}
module.exports.default = deploy();
same as
module.exports = async (hre) => {
const { getNamedAccounts, deployments } = hre;
};
same as
module.exports = async ({ getNamedAccounts, deployments }) => {};