Last active
August 18, 2022 10:13
-
-
Save Jesserc/5c657b6c5c37a99d28fe0da61b9cda51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | |
| // deployed contract address = 0x6e828b59fc799b6ef92e42d2f39e438a7477f469 | |
| 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; | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// hardhat.config file
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;