Comments (13)
Thanks for this.
Can you try running the bash command manually and seeing your output?
bash /<YOUR_PATH>/get_recent_deployment.sh FundMe 11155111 /<YOUR_PATH/broadcast
from foundry-devops.
@PatrickAlphaC It returns zero address 0x0000000000000000000000000000000000000000
from foundry-devops.
I see.... It's having a hard time finding your code...
Could you update the get_recent_deployments.sh
to:
for file in $files; do
echo $file # new line
if [[ $file == *"/$chainId/"* ]]; then
timestamp=$(jq '.timestamp' "$file")
transactions_length=$(jq '.transactions | length' "$file")
for ((i=0; i<$transactions_length; i++)); do
currentTransactionType=$(jq -r ".transactions[$i].transactionType" "$file")
currentContractName=$(jq -r ".transactions[$i].contractName" "$file")
echo $currentContractName # new line
if [ "$currentTransactionType" == "CREATE" ] && [ "$currentContractName" == "$contractName" ] && [ $timestamp -gt $latestTimestamp ]; then
latestTimestamp=$timestamp
latestContractAddress=$(jq -r ".transactions[$i].contractAddress" "$file")
fi
done
fi
done
and run it again?
from foundry-devops.
@PatrickAlphaC It outputs this;
Here is the link to the repository testing
branch where I have used DevOps.
from foundry-devops.
Just FYI you might want to remove your Alchmey API key from broadcast
before pushing it to github. I'd change it so that someone doesn't run up your bill now that it's exposed.
Can you copy-paste the output and put it between 3 backticks (```) so it's easier for me to copy-paste your code in the future?
Hmm... I just cloned your repo and it's working for me.
Can you add another echo?
for file in $files; do
echo $file # new line
if [[ $file == *"/$chainId/"* ]]; then
timestamp=$(jq '.timestamp' "$file")
transactions_length=$(jq '.transactions | length' "$file")
echo $transactions_length
for ((i=0; i<$transactions_length; i++)); do
currentTransactionType=$(jq -r ".transactions[$i].transactionType" "$file")
currentContractName=$(jq -r ".transactions[$i].contractName" "$file")
echo $currentContractName # new line
if [ "$currentTransactionType" == "CREATE" ] && [ "$currentContractName" == "$contractName" ] && [ $timestamp -gt $latestTimestamp ]; then
latestTimestamp=$timestamp
latestContractAddress=$(jq -r ".transactions[$i].contractAddress" "$file")
fi
done
fi
done
For me, I ran:
bash lib/foundry-devops/src/get_recent_deployment.sh FundMe 11155111 ./broadcast/
And got this output for you:
./broadcast//Fund.s.sol/11155111/run-latest.json
1
FundMe
./broadcast//Withdraw.s.sol/11155111/run-latest.json
1
null
./broadcast//DeployFundMe.s.sol/11155111/run-latest.json
1
FundMe
0x9660e111e09e2400afBe5c39aBc3c01B05011391
from foundry-devops.
Ah! Last time I checked it for any type of key but I think I didn't notice rpc
key/value! Thanks for mentioning I am going to remove this API key now from the alchemy dashboard.
Sure I will put the output in the backticks from now on.
I replaced the above echo and now my get_recent_deployment.sh
file looks like this;
#!/bin/bash
# Get the script's own directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Move up two levels to get the project root directory
PROJECT_ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
contractName=$1
chainId=$2
if [ -z "$3" ]; then
path="./broadcast"
else
path="$3"
fi
if [ -z "$contractName" ] || [ -z "$chainId" ] ; then
echo "Usage: $0 <contractName> <chainId> [path]"
exit 1
fi
latestTimestamp=0
latestContractAddress=""
files=$(find $path -name "run-latest.json" -type f)
for file in $files; do
echo $file # new line
if [[ $file == *"/$chainId/"* ]]; then
timestamp=$(jq '.timestamp' "$file")
transactions_length=$(jq '.transactions | length' "$file")
echo $transactions_length
for ((i=0; i<$transactions_length; i++)); do
currentTransactionType=$(jq -r ".transactions[$i].transactionType" "$file")
currentContractName=$(jq -r ".transactions[$i].contractName" "$file")
echo $currentContractName # new line
if [ "$currentTransactionType" == "CREATE" ] && [ "$currentContractName" == "$contractName" ] && [ $timestamp -gt $latestTimestamp ]; then
latestTimestamp=$timestamp
latestContractAddress=$(jq -r ".transactions[$i].contractAddress" "$file")
fi
done
fi
done
if [ $latestTimestamp -ne 0 ]; then
echo "$latestContractAddress"
else
echo "0x0000000000000000000000000000000000000000"
fi
And when I ran your given command I got this;
alymurtazamemon@Alis-MacBook-Air foundry-fund-me % bash lib/foundry-devops/src/get_recent_deployment.sh FundMe 11155111 ./broadcast/
./broadcast//Fund.s.sol/11155111/run-latest.json
lib/foundry-devops/src/get_recent_deployment.sh: line 34: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 36: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 39: ((: i<: syntax error: operand expected (error token is "<")
./broadcast//Withdraw.s.sol/11155111/dry-run/run-latest.json
lib/foundry-devops/src/get_recent_deployment.sh: line 34: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 36: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 39: ((: i<: syntax error: operand expected (error token is "<")
./broadcast//Withdraw.s.sol/11155111/run-latest.json
lib/foundry-devops/src/get_recent_deployment.sh: line 34: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 36: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 39: ((: i<: syntax error: operand expected (error token is "<")
./broadcast//DeployFundMe.s.sol/11155111/run-latest.json
lib/foundry-devops/src/get_recent_deployment.sh: line 34: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 36: jq: command not found
lib/foundry-devops/src/get_recent_deployment.sh: line 39: ((: i<: syntax error: operand expected (error token is "<")
./broadcast//DeployFundMe.s.sol/31337/dry-run/run-latest.json
./broadcast//DeployFundMe.s.sol/31337/run-latest.json
0x0000000000000000000000000000000000000000
from foundry-devops.
Ahhhhhh!!
can you try installing jq
?
https://stackoverflow.com/questions/37668134/how-to-install-jq-on-mac-on-the-command-line
from foundry-devops.
@PatrickAlphaC Yes, I installed it now it progressed a little bit but it shows the script failed at the end. And why it shows all these logs when I do not have give any verbosity?
alymurtazamemon@Alis-MacBook-Air foundry-fund-me % forge script Fund --rpc-url sepolia --private-key $PRIVATE_KEY --broadcast
[⠆] Compiling...
No files changed, compilation skipped
Traces:
[639098] → new DevOpsTools@0xba5964d2B89aEEb3a0067d7BB89479427Ae55ee8
└─ ← 3192 bytes of code
[274020] → new Fund@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
└─ ← 1037 bytes of code
[22279] Fund::setUp()
└─ ← ()
[69319] Fund::run()
├─ [39976] DevOpsTools::e374cdf1(00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000aa36a7000000000000000000000000000000000000000000000000000000000000000646756e644d650000000000000000000000000000000000000000000000000000) [delegatecall]
│ ├─ [0] VM::ffi([pwd])
│ │ └─ ← 0x2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d65
│ ├─ [0] VM::toString(11155111) [staticcall]
│ │ └─ ← 0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000083131313535313131000000000000000000000000000000000000000000000000
│ ├─ [0] VM::ffi([bash, /Users/alymurtazamemon/Desktop/Blockchain/my-projects/practice/foundry-fund-me/lib/foundry-devops/src/get_recent_deployment.sh, FundMe, 11155111, /Users/alymurtazamemon/Desktop/Blockchain/my-projects/practice/foundry-fund-me//broadcast])
│ │ └─ ← 0x2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f46756e642e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f57697468647261772e732e736f6c2f31313135353131312f6472792d72756e2f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f57697468647261772e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a46756e644d650a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f33313333372f6472792d72756e2f72756e2d6c61746573742e6a736f6e0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f33313333372f72756e2d6c61746573742e6a736f6e0a307839363630653131316530396532343030616642653563333961426333633031423035303131333931
│ ├─ [0] console::log(Return Data:) [staticcall]
│ │ └─ ← ()
│ ├─ [0] console::log(0x2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f46756e642e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f57697468647261772e732e736f6c2f31313135353131312f6472792d72756e2f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f57697468647261772e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a46756e644d650a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f33313333372f6472792d72756e2f72756e2d6c61746573742e6a736f6e0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f33313333372f72756e2d6c61746573742e6a736f6e0a307839363630653131316530396532343030616642653563333961426333633031423035303131333931) [staticcall]
│ │ └─ ← ()
│ └─ ← 0x0000000000000000000000002f55736572732f616c796d757274617a616d656d
├─ [0] VM::startBroadcast()
│ └─ ← ()
└─ ← "EvmError: Revert"
== Logs ==
Return Data:
0x2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f46756e642e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f57697468647261772e732e736f6c2f31313135353131312f6472792d72756e2f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f57697468647261772e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a6e756c6c0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f31313135353131312f72756e2d6c61746573742e6a736f6e0a310a46756e644d650a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f33313333372f6472792d72756e2f72756e2d6c61746573742e6a736f6e0a2f55736572732f616c796d757274617a616d656d6f6e2f4465736b746f702f426c6f636b636861696e2f6d792d70726f6a656374732f70726163746963652f666f756e6472792d66756e642d6d652f2f62726f6164636173742f4465706c6f7946756e644d652e732e736f6c2f33313333372f72756e2d6c61746573742e6a736f6e0a307839363630653131316530396532343030616642653563333961426333633031423035303131333931
Error:
Script failed.
alymurtazamemon@Alis-MacBook-Air foundry-fund-me %
from foundry-devops.
You likely don't have any LINK on sepolia? And hmm....
When you run scripts, I think you always get verbose outputs.
from foundry-devops.
@PatrickAlphaC I have ~35 ETH on sepolia network.
from foundry-devops.
The Fund
function funds with LINK
not ETH
from foundry-devops.
@PatrickAlphaC For that I send funds here;
uint256 SEND_VALUE = 0.1 ether;
vm.startBroadcast();
FundMe(mostRecentlyDeployed).fund{value: SEND_VALUE}();
vm.stopBroadcast();
and I have 585 LINK
tokens
I think it is OK, I will figure out it later. Thanks for the support.
from foundry-devops.
Hey @alymurtazamemon I'm running into the same issue; I have a new mac, is it because of this missing jq
?
from foundry-devops.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foundry-devops.