Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sour-brooms-bet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-eth": patch
---

fix deployHelpers.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract ScaffoldETHDeploy is Script {
(, address _deployer,) = vm.readCallers();

if (block.chainid == 31337 && _deployer.balance == 0) {
try this.anvil_setBalance(_deployer, ANVIL_BASE_BALANCE) {
try vm.deal(_deployer, ANVIL_BASE_BALANCE) {
emit AnvilSetBalance(_deployer, ANVIL_BASE_BALANCE);
} catch {
emit FailedAnvilRequest();
Expand Down Expand Up @@ -71,7 +71,7 @@ contract ScaffoldETHDeploy is Script {

string memory chainName;

try this.getChain() returns (Chain memory chain) {
try vm.getChain(block.chainid) returns (Vm.Chain memory chain) {
chainName = chain.name;
} catch {
chainName = findChainName();
Expand All @@ -80,30 +80,6 @@ contract ScaffoldETHDeploy is Script {
vm.writeJson(jsonWrite, path);
}

function getChain() public returns (Chain memory) {
return getChain(block.chainid);
}

function anvil_setBalance(address addr, uint256 amount) public {
string memory addressString = vm.toString(addr);
string memory amountString = vm.toString(amount);
string memory requestPayload = string.concat(
'{"method":"anvil_setBalance","params":["', addressString, '","', amountString, '"],"id":1,"jsonrpc":"2.0"}'
);

string[] memory inputs = new string[](8);
inputs[0] = "curl";
inputs[1] = "-X";
inputs[2] = "POST";
inputs[3] = "http://localhost:8545";
inputs[4] = "-H";
inputs[5] = "Content-Type: application/json";
inputs[6] = "--data";
inputs[7] = requestPayload;

vm.ffi(inputs);
}

function findChainName() public returns (string memory) {
uint256 thisChainId = block.chainid;
string[2][] memory allRpcUrls = vm.rpcUrls();
Expand Down