Files
proxmox/scripts/test-oracle-contract.sh

42 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Test Oracle contract functionality
# Usage: ./test-oracle-contract.sh
RPC_URL="${RPC_URL:-http://192.168.11.250:8545}"
ORACLE_PROXY="0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6"
echo "Testing Oracle Proxy Contract"
echo "Address: $ORACLE_PROXY"
echo "RPC: $RPC_URL"
echo ""
echo "1. Checking contract bytecode..."
BYTECODE=$(cast code "$ORACLE_PROXY" --rpc-url "$RPC_URL" 2>/dev/null || echo "")
if [ -z "$BYTECODE" ] || [ "$BYTECODE" = "0x" ]; then
echo "❌ Contract has no bytecode"
exit 1
else
echo "✅ Contract has bytecode"
fi
echo ""
echo "2. Testing latestRoundData() function..."
RESULT=$(cast call "$ORACLE_PROXY" \
"latestRoundData()(uint80,int256,uint256,uint256,uint80)" \
--rpc-url "$RPC_URL" 2>/dev/null || echo "ERROR")
if [ "$RESULT" != "ERROR" ] && [ -n "$RESULT" ]; then
echo "✅ Function call successful"
echo " Result: $RESULT"
else
echo "⚠️ Function call failed or returned error"
fi
echo ""
echo "3. Checking recent events..."
BLOCK=$(cast block-number --rpc-url "$RPC_URL" 2>/dev/null || echo "0")
echo "Current block: $BLOCK"
echo ""
echo "Test complete"