Skip to content

fix: parse CoinGecko price response - #232

Open
Kewe63 wants to merge 1 commit into
t1protocol:canaryfrom
Kewe63:fix/231-coingecko-price-shape
Open

Kewe63 wants to merge 1 commit into
t1protocol:canaryfrom
Kewe63:fix/231-coingecko-price-shape

Conversation

@Kewe63

@Kewe63 Kewe63 commented Sep 18, 2026

Copy link
Copy Markdown

Description

  • Parse CoinGecko's Simple Price response from ethereum.usd instead of the nonexistent top-level price field.
  • Reject missing, malformed, non-finite, and non-positive quotes so the existing fallback remains effective.
  • Round valid fractional USD quotes before the existing bigint valuation step.
  • Add focused tests for nested integer and fractional quotes plus invalid-response fallback behavior.

Motivation and Context

The intent pauser currently converts data.price to a number, but CoinGecko returns { "ethereum": { "usd": ... } }. As a result, the live quote becomes NaN and the monitor always uses ETH_PRICE_FALLBACK.

Fixes #231.

How Has This Been Tested?

  • bun test test/TresholdMonitor.test.ts — 3 passed, 0 failed.
  • bun test — 3 passed, 0 failed.
  • The regression suite was run before the fix: the two CoinGecko-shape cases failed and the fallback control passed.
  • bun x tsc -p tsconfig.json --noEmit remains blocked on the unchanged base by the missing generated ../../contracts/artifacts/src/T1ERC7683.sol/T1ERC7683.json artifact.

Types of changes (remove all unchecked types)

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I assessed the documentation impact; no documentation update is required.
  • I assessed the deployment-script impact; no deployment-script update is required.
  • I added focused regression coverage for the corrected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intent pauser always ignores CoinGecko's ETH price response

1 participant