Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Ultra-Tech-code/f900a6d58079062ab0cff1210b9b1f20 to your computer and use it in GitHub Desktop.
Save Ultra-Tech-code/f900a6d58079062ab0cff1210b9b1f20 to your computer and use it in GitHub Desktop.
require("dotenv").config({ path: ".env" });
import { BytesLike } from "ethers";
import { ethers } from "hardhat";
// import * as dotenv from "dotenv";
// import IMultiSig from "../typechain-types/Imultisig.sol"
async function main() {
let provider = {
PrivateKey: process.env.PRIVATE_KEY as BytesLike,
URL: process.env.URL,
};
const provider2 = ethers.getDefaultProvider("ropsten", provider.URL);
let wallet = new ethers.Wallet(provider.PrivateKey, provider2);
const _value = ethers.utils.parseEther("1");
const CONTRACTADDRESS = "0x6e828b59fc799b6ef92e42d2f39e438a7477f469";
const MULTISIG = await ethers.getContractAt("IMultiSig", CONTRACTADDRESS);
// await wallet.sendTransaction({ to: CONTRACTADDRESS, value: _value });
// console.log();
// console.log("contractBalanc", await MULTISIG.contractBalance());
await MULTISIG.withdrawEther(_value);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
@Ultra-Tech-code
Copy link
Author

import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import * as dotenv from "dotenv";

dotenv.config();

const config: HardhatUserConfig = {
solidity: "0.8.9",

networks: {
hardhat: {
forking: {
url: "https://ropsten.infura.io/v3/rpc",
},
},
ropsten: {
url: process.env.ROPSTEN_URL,
//@ts-ignore
accounts: [process.env.PRIVATE_KEY],
},
},
};

export default config;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment