Separate secrets to another file, add some Dione-related tasks to hardhat project
This commit is contained in:
parent
225c84e8a8
commit
7e8e4ccc41
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,4 +25,5 @@ eth-contracts/node_modules
|
||||
/.dione-config-4.toml
|
||||
.bootstrap_privkey
|
||||
eth-contracts/build
|
||||
/.db
|
||||
.db
|
||||
eth-contracts/secrets.json
|
@ -1,30 +1,24 @@
|
||||
import { task } from "hardhat/config";
|
||||
import "@nomiclabs/hardhat-ethers";
|
||||
import "hardhat-tracer";
|
||||
import "@nomiclabs/hardhat-waffle";
|
||||
import "solidity-coverage";
|
||||
import "hardhat-gas-reporter";
|
||||
|
||||
task("accounts", "Prints the list of accounts", async (args, hre) => {
|
||||
const accounts = await hre.ethers.getSigners();
|
||||
|
||||
for (const account of accounts) {
|
||||
console.log(await account.address);
|
||||
}
|
||||
});
|
||||
import * as secrets from "./secrets.json";
|
||||
import "./hardhat.tasks";
|
||||
|
||||
export default {
|
||||
solidity: "0.8.3",
|
||||
networks: {
|
||||
geth: {
|
||||
url: `http://localhost:8545`,
|
||||
accounts: {
|
||||
mnemonic: "test test test test test test test test test test test junk"
|
||||
solidity: {
|
||||
version: "0.8.3",
|
||||
settings: {
|
||||
optimizer: {
|
||||
enabled: false,
|
||||
runs: 200
|
||||
}
|
||||
}
|
||||
},
|
||||
networks: secrets.networks,
|
||||
gasReporter: {
|
||||
currency: 'USD',
|
||||
enabled: (process.env.REPORT_GAS) ? true : false
|
||||
enabled: process.env.REPORT_GAS
|
||||
}
|
||||
};
|
34
eth-contracts/hardhat.tasks.ts
Normal file
34
eth-contracts/hardhat.tasks.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { task } from "hardhat/config";
|
||||
import "@nomiclabs/hardhat-ethers";
|
||||
|
||||
task("stake", "Prints an account's stake amount in DioneStaking contract")
|
||||
.addParam("contract", "DioneStaking contract address")
|
||||
.addParam("account", "The account's address")
|
||||
.setAction(async (args, hre) => {
|
||||
const DioneStaking = await hre.ethers.getContractFactory("DioneStaking");
|
||||
const contract = DioneStaking.attach(args.contract);
|
||||
const a = await contract.minerStake(args.account);
|
||||
console.log("Stake amount:", a.div(hre.ethers.constants.WeiPerEther).toString());
|
||||
});
|
||||
|
||||
task("accounts", "Prints the list of accounts", async (args, hre) => {
|
||||
const accounts = await hre.ethers.getSigners();
|
||||
|
||||
for (const account of accounts) {
|
||||
console.log(await account.address);
|
||||
}
|
||||
});
|
||||
|
||||
task("oracleRequest", "Makes oracle request to Mediator contract")
|
||||
.addParam("contract", "Mediator contract address")
|
||||
.addParam("chainid", "Chain ID from which need to request info")
|
||||
.addParam("method", "Method name of requesting chain RPC")
|
||||
.addParam("param", "Value of parameter for specified method")
|
||||
.setAction(async (args, hre) => {
|
||||
const Mediator = await hre.ethers.getContractFactory("Mediator");
|
||||
const contract = Mediator.attach(args.contract);
|
||||
const res = await contract.request(args.chainid, args.method, args.param)
|
||||
console.log("Request has successfully been sent.")
|
||||
console.log("Transaction info:")
|
||||
console.log(res)
|
||||
})
|
@ -4,7 +4,8 @@
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"outDir": "dist"
|
||||
"outDir": "dist",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./scripts", "./test", "./common"],
|
||||
"files": ["./hardhat.config.ts"]
|
||||
|
Loading…
Reference in New Issue
Block a user