- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
51 lines
1.9 KiB
Bash
Executable File
51 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Probe whether a Chain 138 address behaves like an official DODO DVM (query + sell selectors).
|
|
#
|
|
# XAU "PMM" pools in ADDRESS_MATRIX often use a different on-chain implementation: querySellBase
|
|
# reverts even when ERC-20 balances exist. Stable pools behind minimal proxies delegate to DVM.
|
|
#
|
|
# Usage:
|
|
# ./scripts/verify/probe-pmm-pool-dvm-chain138.sh 0x9e89bAe009adf128782E19e8341996c596ac40dC [RPC_URL]
|
|
# Env: FROM (default deployer) for query trader address.
|
|
|
|
set -euo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
POOL="${1:?pool address}"
|
|
RPC="${2:-${RPC_URL_138:-https://rpc-http-pub.d-bis.org}}"
|
|
FROM="${FROM:-0x4A666F96fC8764181194447A7dFdb7d471b301C8}"
|
|
AMT=1000000
|
|
|
|
code=$(curl -s "$RPC" -H 'Content-Type: application/json' \
|
|
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"$POOL\",\"latest\"],\"id\":1}" \
|
|
| jq -r '.result')
|
|
clen=$(( (${#code} - 2) / 2 ))
|
|
echo "Pool: $POOL"
|
|
echo "RPC: $RPC"
|
|
echo "code len: $clen bytes"
|
|
|
|
ok=0
|
|
if cast call "$POOL" "querySellBase(address,uint256)(uint256,uint256)" "$FROM" "$AMT" --rpc-url "$RPC" >/dev/null 2>&1; then
|
|
echo "querySellBase($AMT): OK"
|
|
ok=1
|
|
else
|
|
echo "querySellBase($AMT): REVERT (not DVM-compatible for this probe)"
|
|
fi
|
|
|
|
if cast call "$POOL" "querySellQuote(address,uint256)(uint256,uint256)" "$FROM" "$AMT" --rpc-url "$RPC" >/dev/null 2>&1; then
|
|
echo "querySellQuote($AMT): OK"
|
|
ok=1
|
|
else
|
|
echo "querySellQuote($AMT): REVERT"
|
|
fi
|
|
|
|
echo "sellBase selector: $(cast sig 'sellBase(address)')"
|
|
echo "sellQuote selector: $(cast sig 'sellQuote(address)')"
|
|
|
|
if [[ "$ok" -eq 1 ]]; then
|
|
echo "Verdict: DVM-style quotes succeed — swap-random-registered-pmm-pools-chain138.sh can target this pool."
|
|
exit 0
|
|
fi
|
|
echo "Verdict: Quotes failed — use a different swap path or verify pool type on Blockscout."
|
|
exit 1
|