Skip to content

Commit

Permalink
feat: celoscan contract verification check script
Browse files Browse the repository at this point in the history
  • Loading branch information
chapati23 committed Aug 19, 2024
1 parent 3c750c5 commit 4b6e768
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions bin/check-celoscan-verification.sh
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"

0 comments on commit 4b6e768

Please sign in to comment.