Skip to content

Commit

Permalink
🥑 ts->js
Browse files Browse the repository at this point in the history
  • Loading branch information
coolcode committed Jan 30, 2024
1 parent db56aba commit 44b86c8
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 48 deletions.
3 changes: 1 addition & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"require": "hardhat/register",
"timeout": 40000,
"_": ["test/**/*.ts"]
"timeout": 40000
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# <h1 align="center"> Forge + OpenZeppelin + Hardhat Typescript Template </h1>
# <h1 align="center"> Forge + OpenZeppelin + Hardhat JS Template </h1>

**A Foundry template for rapidly initializing a Solidity project with [openzeppelin](https://github.com/OpenZeppelin/openzeppelin-contracts) & [hardhat](https://github.com/NomicFoundation/hardhat).**

![Github Actions](https://github.com/coolcode/forge-openzeppelin-hardhat-ts-template/workflows/CI/badge.svg)
![Github Actions](https://github.com/coolcode/forge-openzeppelin-hardhat-js-template/workflows/CI/badge.svg)

## Getting Started

Click "Use this template" on [GitHub](https://github.com/coolcode/forge-openzeppelin-hardhat-ts-template) to create a new repository with this repo as the initial state.
Click "Use this template" on [GitHub](https://github.com/coolcode/forge-openzeppelin-hardhat-js-template) to create a new repository with this repo as the initial state.

Or, if your repo already exists, run:
```sh
Expand Down
38 changes: 38 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"files": {
"include": [
"*.js",
"*.ts"
],
"ignore": [
".cache",
"node_modules",
"*.json"
]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"semicolons": "asNeeded",
"lineEnding": "lf",
"lineWidth": 160,
"bracketSameLine": true,
"bracketSpacing": true,
"trailingComma": "es5"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"organizeImports": {
"enabled": true
}
}
19 changes: 8 additions & 11 deletions hardhat.config.ts → hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import "@nomicfoundation/hardhat-foundry"
import "@nomicfoundation/hardhat-toolbox"
import "@typechain/hardhat"
import { HardhatUserConfig } from "hardhat/config"
require("@nomicfoundation/hardhat-foundry")
require("@nomicfoundation/hardhat-toolbox")
require("@typechain/hardhat")

import "./tasks/Balance"
require("./tasks/Balance")

const config: HardhatUserConfig = {
module.exports = {
solidity: {
version: "0.8.23",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
}
},
},
gasReporter: {
currency: "USD",
gasPrice: 20,
enabled: true
enabled: true,
},
paths: {
sources: "./src", // Use ./src rather than ./contracts as Hardhat expects
cache: "./cache_hardhat", // Use a different cache for Hardhat than Foundry
}
},
}

export default config
6 changes: 3 additions & 3 deletions tasks/Balance.ts → tasks/Balance.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { task } from "hardhat/config"
const { task } = require("hardhat/config")
/**
Example:
hardhat balance --account 1
*/
task("balance", "Prints an account's balance")
.addParam<string>("account", "The account's address")
.addParam("account", "The account's address")
.setAction(async (taskArgs, { ethers }) => {
const accountIndex = taskArgs.account
console.info(`account index: ${accountIndex}`)
Expand All @@ -13,4 +13,4 @@ task("balance", "Prints an account's balance")
const balance = await ethers.provider.getBalance(address)

console.info(`Balance account ${address}: ${balance}`)
})
})
11 changes: 5 additions & 6 deletions test/Token.test.ts → test/Token.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"
import { expect } from "chai"
import { ethers } from "hardhat"
const { loadFixture } = require("@nomicfoundation/hardhat-toolbox/network-helpers")
const { expect } = require("chai")
const { ethers } = require("hardhat")

describe("Token", () => {

async function deployContractFixture() {
const Token = await ethers.getContractFactory("Token")
const token = await Token.deploy()
Expand All @@ -13,7 +12,7 @@ describe("Token", () => {

it("Should return name Token", async () => {
const { token } = await loadFixture(deployContractFixture)

expect(await token.name()).to.equal("Token")
})
})
})
23 changes: 0 additions & 23 deletions tsconfig.json

This file was deleted.

0 comments on commit 44b86c8

Please sign in to comment.