stack-orchestrator/app/data/config/fixturenet-optimism/optimism-contracts/send-balance.ts
prathamesh0 1881554ae0 Add Optimism Fixturenet stack (#266)
* Initial version

* Update readme

* Build op-geth container

* Add optimism go code containers

* Add optimism contracts container

* Update optimism contracts container build

* Add fixturenet-optimism-contracts service to deploy L1 contracts

* Add fixturenet-optimism op-node and op-geth

* Avoid reading addresses from a file when sending balances

* Fixes for running op-geth container

* Fix image name and command in optimism-contracts service

* Add a healthcheck to lighthouse bootnode to avoid failing eth txs

* Avoid using hardhat ethers to send balances from an account

* Update script to send balance to L1 bridge proxy contract

* Implement op-node container

* Wait for a finalized L1 block to exist

* Fix for running op-batcher

* Add a todo for restart support

* Integrate optimism-contracts service and update instructions

* Update clean-up to remove docker volumes

* Update volume access permissions

* Add a todo to replace foundry usage with web3 js

* Add known issues

* Fix README

* Fix indentation

* Update known issues

---------

Co-authored-by: David Boreham <david@bozemanpas.com>
Co-authored-by: David Boreham <david@bozemanpass.com>
Co-authored-by: nabarun <nabarun@deepstacksoft.com>
Former-commit-id: fc522140ba
2023-04-03 12:33:47 +05:30

23 lines
879 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.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}`)
})