c2a3ffe0dd
* Add an option to pass env file to deploy command
* Use env variable mapping in fixturenet-optimism stack
* Use default values from checked in env files
* Use env variable mapping in mobymask-v2 stack
* Update instructions
* Add extra hosts in app compose files and update instructions
* Add CERC prefix to env variables in fixturenet-optimism stack
* Add CERC prefix to env variables in mobymask-v2 stack
Former-commit-id: 6b62247ef7
23 lines
884 B
TypeScript
23 lines
884 B
TypeScript
import { task } from 'hardhat/config'
|
|
import '@nomiclabs/hardhat-ethers'
|
|
import { ethers } from 'ethers'
|
|
|
|
task('send-balance', 'Sends Ether to a specified Ethereum account')
|
|
.addParam('to', 'The Ethereum address to send Ether to')
|
|
.addParam('amount', 'The amount of Ether to send, in Ether')
|
|
.addParam('privateKey', 'The private key of the sender')
|
|
.setAction(async ({ to, amount, privateKey }, {}) => {
|
|
// Open the wallet using sender's private key
|
|
const provider = new ethers.providers.JsonRpcProvider(`${process.env.CERC_L1_RPC}`)
|
|
const wallet = new ethers.Wallet(privateKey, provider)
|
|
|
|
// Send amount to the specified address
|
|
const tx = await wallet.sendTransaction({
|
|
to,
|
|
value: ethers.utils.parseEther(amount),
|
|
})
|
|
|
|
console.log(`Balance sent to: ${to}, from: ${wallet.address}`)
|
|
console.log(`Transaction hash: ${tx.hash}`)
|
|
})
|