Skip to content

Commit

Permalink
Update packages (#11)
Browse files Browse the repository at this point in the history
* Updated migrations

* Added bignumber.js

* Updated hardhat-migrate to 2.0.0

* Updated OpenZeppelin to 5.0.0

* Updated dependencies

---------

Co-authored-by: Artem Chystiakov <[email protected]>
  • Loading branch information
aritkulova and Arvolear authored Dec 1, 2023
1 parent 8a11a69 commit 2773a3f
Show file tree
Hide file tree
Showing 11 changed files with 13,088 additions and 28,869 deletions.
7 changes: 0 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,3 @@ BSCSCAN_KEY=BSCSCAN API KEY
POLYGONSCAN_KEY=POLYGONSCAN API KEY
AVALANCHE_KEY=AVALANCHE API KEY
COINMARKETCAP_KEY=COINMARKETCAP API KEY

# Available targets: 'ethers-v6', 'truffle-v5' and 'web3-v1'
# By default 'ethers-v6'
TYPECHAIN_TARGET=TYPECHAIN TARGET

# Set 'false' to not automatically generate types
TYPECHAIN_FORCE=TYPECHAIN FORCE
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ coverage

# Typechain generated files
generated-types

# Hardhat migrate
.storage.json
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ coverage

# Typechain generated files
generated-types

# Hardhat migrate
.storage.json
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": "*.sol",
Expand Down
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "warn",
"reentrancy": "off",
"prettier/prettier": "off",
"modifier-name-mixedcase": "off",
"no-empty-blocks": "off",
"func-visibility": "off",
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock/tokens/ERC20Mock.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract ERC20Mock is ERC20 {
uint8 internal _decimals;
Expand Down
11 changes: 5 additions & 6 deletions deploy/1_token.migration.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Deployer, Logger } from "@solarity/hardhat-migrate";
import { artifacts } from "hardhat";
import { Deployer, Reporter } from "@solarity/hardhat-migrate";

const ERC20Mock = artifacts.require("ERC20Mock");
import { ERC20Mock__factory } from "@ethers-v6";

export = async (deployer: Deployer, logger: Logger) => {
const erc20 = await deployer.deploy(ERC20Mock, "Mock", "Mock", 18);
export = async (deployer: Deployer) => {
const erc20 = await deployer.deploy(ERC20Mock__factory, ["Mock", "Mock", 18]);

logger.logContracts(["ERC20Mock", erc20.address]);
Reporter.reportContracts(["ERC20Mock", await erc20.getAddress()]);
};
18 changes: 2 additions & 16 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "@nomiclabs/hardhat-web3";
import "@nomiclabs/hardhat-truffle5";
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-chai-matchers";
import "@solarity/hardhat-migrate";
Expand All @@ -20,24 +18,13 @@ function privateKey() {
return process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [];
}

function typechainTarget() {
const target = process.env.TYPECHAIN_TARGET;

return target === "" || target === undefined ? "ethers-v6" : target;
}

function forceTypechain() {
return process.env.TYPECHAIN_FORCE === "false";
}

const config: HardhatUserConfig = {
networks: {
hardhat: {
initialDate: "1970-01-01T00:00:00Z",
},
localhost: {
url: "http://127.0.0.1:8545",
initialDate: "1970-01-01T00:00:00Z",
gasMultiplier: 1.2,
},
goerli: {
Expand Down Expand Up @@ -130,11 +117,10 @@ const config: HardhatUserConfig = {
coinmarketcap: `${process.env.COINMARKETCAP_KEY}`,
},
typechain: {
outDir: `generated-types/${typechainTarget().split("-")[0]}`,
target: typechainTarget(),
outDir: "generated-types/ethers",
target: "ethers-v6",
alwaysGenerateOverloads: true,
discriminateTypes: true,
dontOverrideCompile: forceTypechain(),
},
};

Expand Down
Loading

0 comments on commit 2773a3f

Please sign in to comment.