-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: celoscan contract verification check script
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
source "$(dirname "$0")/../.env" | ||
|
||
# Etherscan API endpoint | ||
API_ENDPOINT="https://api.celoscan.io/api" | ||
|
||
# Function to check contract verification status | ||
check_celoscan_verification() { | ||
local contract_address="$1" | ||
|
||
# Make API request | ||
response=$(curl -s "$API_ENDPOINT?module=contract&action=getabi&address=$contract_address&apikey=$CELOSCAN_API_KEY") | ||
|
||
# Check response | ||
if echo "$response" | grep -q '"status":"1"' && echo "$response" | grep -q '"message":"OK"'; then | ||
echo "Contract $contract_address is verified" | ||
else | ||
echo "Contract $contract_address is not verified" | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Main script | ||
if [ $# -eq 0 ]; then | ||
echo "Usage: $0 <contract_address>" | ||
exit 1 | ||
fi | ||
|
||
check_celoscan_verification "$1" |