Skip to content

Commit

Permalink
Merge pull request DMDcoin#209 from alx-muller/feature/hardhat-deps-u…
Browse files Browse the repository at this point in the history
…pgrade

Dependencies upgrade. Unit tests refactor
Ok looks good, thanks
  • Loading branch information
SurfingNerd authored Apr 18, 2024
2 parents b3cdb74 + e4a9769 commit ce19d5c
Show file tree
Hide file tree
Showing 19 changed files with 5,720 additions and 5,244 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
Expand Down
19 changes: 0 additions & 19 deletions contracts/mockContracts/BlockRewardHbbftMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,10 @@ pragma solidity =0.8.17;
import "../BlockRewardHbbft.sol";

contract BlockRewardHbbftMock is BlockRewardHbbft {
address internal _systemAddress;

// ============================================== Modifiers =======================================================

modifier onlySystem() virtual override {
require(msg.sender == _getSystemAddress());
_;
}

// =============================================== Setters ========================================================

function sendCoins() public payable {}

function setSystemAddress(address _address) public {
_systemAddress = _address;
}

function setGovernanceAddress(address _address) public {
governancePotAddress = payable(_address);
}
Expand Down Expand Up @@ -81,10 +68,4 @@ contract BlockRewardHbbftMock is BlockRewardHbbft {

_epochsPoolGotRewardFor[_poolMiningAddress].push(_stakingEpoch);
}

// =============================================== Private ========================================================

function _getSystemAddress() internal view returns (address) {
return _systemAddress;
}
}
57 changes: 11 additions & 46 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
import fs from "fs";
import { ethers } from "ethers";
import { HardhatUserConfig } from "hardhat/config";

import 'dotenv/config'
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomiclabs/hardhat-ethers";
import "@nomiclabs/hardhat-etherscan";
import "@nomicfoundation/hardhat-ethers";
import "@openzeppelin/hardhat-upgrades";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "hardhat-contract-sizer";
import "@openzeppelin/hardhat-upgrades";
import 'solidity-docgen';
import 'hardhat-tracer';
import { config as dotenvConfig } from "dotenv";
import type { NetworkUserConfig } from "hardhat/types";
// ToDo::check why config excluding gas reporter and typechain
import type { HardhatUserConfig } from "hardhat/config";
import { resolve } from "path";
import { utils } from "ethers";
import fs from "fs";

const dotenvConfigPath: string = process.env.DOTENV_CONFIG_PATH || "./.env";
dotenvConfig({ path: resolve(__dirname, dotenvConfigPath) });
import './tasks/make_spec';

// ToDo::change require to smth more suitable
require('./tasks');

const getMnemonic = () => {
try {
Expand All @@ -33,40 +24,14 @@ const getMnemonic = () => {
};

// Ensure that we have all the environment variables we need.
const mnemonic: string = process.env.MNEMONIC ? process.env.MNEMONIC : utils.entropyToMnemonic(utils.randomBytes(32));

const infuraApiKey: string = process.env.INFURA_API_KEY ? process.env.INFURA_API_KEY : "";
const mnemonic: string = process.env.MNEMONIC ? process.env.MNEMONIC : ethers.Mnemonic.entropyToPhrase(ethers.randomBytes(32));

const chainIds = {
hardhat: 31337,
alpha2: 777012
};

function getChainConfig(chain: keyof typeof chainIds): NetworkUserConfig {
let jsonRpcUrl: string;
switch (chain) {
case "alpha2":
jsonRpcUrl = "http://rpc.uniq.diamonds:8540";
break;
default:
jsonRpcUrl = "https://" + chain + ".infura.io/v3/" + infuraApiKey;
}
return {
accounts: {
count: 10,
mnemonic,
path: "m/44'/60'/0'/0",
},
chainId: chainIds[chain],
gas: 21_000_000_000,
gasPrice: 1_000_000_000,
allowUnlimitedContractSize: true,
blockGasLimit: 100000000429720,
url: jsonRpcUrl,
};
}

const config: {} = {
const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
etherscan: {
// apiKey: process.env.ETHERSCAN_API_KEY,
Expand Down Expand Up @@ -192,7 +157,7 @@ const config: {} = {
},
typechain: {
outDir: "src/types",
target: "ethers-v5",
target: "ethers-v6",
},
mocha: {
timeout: 100000000
Expand Down
Loading

0 comments on commit ce19d5c

Please sign in to comment.