Skip to content

:feat: price oracle - support coingecko and fallback#51

Merged
Frostweeds merged 7 commits intomainfrom
feat/price_with_fallback
Jan 9, 2026
Merged

:feat: price oracle - support coingecko and fallback#51
Frostweeds merged 7 commits intomainfrom
feat/price_with_fallback

Conversation

@Frostweeds
Copy link
Copy Markdown
Contributor

@Frostweeds Frostweeds commented Dec 19, 2025

✨ support Coingecko to fetch price
✨ support price oracle fallback

Without Falllback

{
  ...,
  "price": {
        "provider": "coingecko",
        "endpoint": "https://api.coingecko.com",
        "address_to_id": {
          "0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d": "starknet"
   },
  ...
}

With Fallback

{
   ...,
  "price": {
      "principal":{
        "provider": "coingecko",
        "endpoint": "https://api.coingecko.com",
        "address_to_id": {
          "0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d": "starknet"
        }
      },
      "fallbacks": [
        {
          "provider": "avnu",
          "endpoint": "https://sepolia.api.avnu.fi"
        }
      ]
    },
  ...

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
paymaster Ready Ready Preview, Comment Jan 9, 2026 9:21am

Comment thread crates/paymaster-prices/src/avnu/mod.rs Outdated
Comment thread crates/paymaster-cli/src/command/setup/mod.rs
@Frostweeds Frostweeds merged commit 3a5cffd into main Jan 9, 2026
3 of 13 checks passed
@Frostweeds Frostweeds deleted the feat/price_with_fallback branch January 9, 2026 09:35
tarrencev added a commit to cartridge-gg/paymaster that referenced this pull request Jan 15, 2026
* 🔧 Export metrics each 30sec instead of 60sec (avnu-labs#54)

* ✨ Retrieve and publish the gas tanks balance in STRK (avnu-labs#53)

* :feat: price oracle - support coingecko and fallback (avnu-labs#51)

* :feat: price oracle - support coingecko and fallback

* 🐛 Fix build (avnu-labs#56)

* Add version-agnostic raw execute endpoint (#2)

* ✨ add version-agnostic raw execute endpoint

Add paymaster_executeRawTransaction RPC method that accepts pre-built
execute_from_outside calls, making the paymaster agnostic to SNIP-9 versions.

* 🎨 fix formatting

* ci: disable codecov failure blocking

* test: add tests for execute_raw endpoint

* refactor: extract gas transfer from execute_from_outside call (#6)

* refactor: extract gas transfer from execute_from_outside call in raw execute

Remove gas_token and max_gas_token_amount fields from RawInvokeParameters
to eliminate duplication with ExecutionParameters.FeeMode. The gas transfer
is now extracted directly from the execute_from_outside_call, making FeeMode
the single source of truth for fee payment mode.

This ensures consistency between the standard build_transaction flow and the
raw execute flow, as both now derive gas payment information from the signed
call structure itself.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: simplify gas transfer extraction with single-pass parsing

Remove redundant double-parsing in extract_gas_transfer_from_raw_call.
The function now extracts all required data in a single iteration through
the calls array, improving both clarity and efficiency.

Also add comprehensive unit tests covering:
- Successful extraction from multi-call scenario
- Validation of transfer selector
- Validation of forwarder recipient
- Error handling for empty calls
- Error handling for insufficient calldata

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* style: fix formatting alignment

* refactor: remove unused gas_token/max_gas_token_amount from RawInvoke

These fields are no longer needed in ExecutableTransactionParameters::RawInvoke
since we extract the gas transfer information directly from the
execute_from_outside_call in estimate_transaction.

This completes the cleanup, ensuring gas payment info is only stored in
one place (the signed call itself) and extracted when needed.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: remove no-op validate_raw_invoke_fee_mode function

This function was just returning Ok(()) in all branches without
performing any actual validation. The real validation happens in
the execution layer when extracting the gas transfer.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* refactor: add early break and clarify iteration necessity

Add break statement after extracting the last call's details to avoid
unnecessary continuation of the loop.

Also add comment explaining why we must iterate through all calls:
each call has variable-length calldata, so we can't jump directly to
the last call without parsing the preceding ones.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* perf: extract last call directly instead of iterating

Since the last call is always a transfer with fixed structure
(to, selector, calldata_len=2, recipient, amount), we can read
the last 5 felts directly instead of iterating through all calls.

This changes the complexity from O(n) to O(1).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: correct transfer call size to 6 felts (u256 amount)

The amount field in a transfer call is a u256 represented as two felts
(low and high limbs), making the transfer call structure:
[to, selector, calldata_len(=3), recipient, amount_low, amount_high]

This is 6 felts total, not 5. Also update validation to check
calldata_len == 3 instead of 2.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* ♻️ cleanup code

* 🧹 cargo fmt

* ✏️ fix naming

* 🧹 cargo fmt

* feat: add asdf plugin and cross-platform binary releases

- Add asdf plugin scripts (download, install, list-all, list-bin-paths)
- Add GitHub Actions release workflow for cross-platform binaries
- Add GitHub Actions publish workflow for Docker images
- Add Cross.toml for ARM64 Linux cross-compilation
- Update README with asdf installation instructions
- Fix macOS build configuration for cross-compilation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Florian Bellotti <contact@fbellotti.com>
Co-authored-by: Frostweeds <romain.jufer@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
amanusk added a commit to amanusk/avnu-paymaster that referenced this pull request Jan 18, 2026
* Fix typo in chain_id conversion (avnu-labs#28)

Fixing an issue where the CLI fails if `SN_MAINNET` is used as chain_id

* ✨ Introducing tip in FeeMode (avnu-labs#26)

* ⬆️ Update Rust version to 1.87 in Dockerfiles (avnu-labs#29)

* :feat: remove check_balance to allow for self-paying transaction (avnu-labs#36)

* ✨ Filter duplicated transactions (avnu-labs#37)

* 🔧 Update Braavos MFA overhead (avnu-labs#41)

* 🐛 Fix validation fee overhead when sponsored tx (avnu-labs#42)

* 🔧 Update forwarder class hash (avnu-labs#45)

* ✨ Extract and log more context from simulation errors (avnu-labs#44)

* ✨ Extract and log more context from simulation errors

* 🎨 Improve code

* 🎨 Improve code

* ✨ Update swap parameter extraction to return Result and handle errors

* 🔧 Simplify service availability checks by removing token validation (avnu-labs#46)

* 🔧 Simplify service availability checks by removing token validation

* 🔧 Use ConcurrentExecutor instead of Futur

* 🔧 Move logic

* ⬆️ Update Rust version to 1.91 in Dockerfiles

* 🔥 disable starknet tests (image not working)

* 🐛 fix normalization. Decimals where cut before multiplying (avnu-labs#48)

* 🐛 fix normalization. Decimals where cut before multiplying

* ♻️ fix warnings (avnu-labs#49)

* 🧹 clean up constants endpoints & tokens (avnu-labs#50)

* 🧹 clean up constants endpoints & tokens

* 🔧 Export metrics each 30sec instead of 60sec (avnu-labs#54)

* ✨ Retrieve and publish the gas tanks balance in STRK (avnu-labs#53)

* :feat: price oracle - support coingecko and fallback (avnu-labs#51)

* :feat: price oracle - support coingecko and fallback

* 🐛 Fix build (avnu-labs#56)

---------

Co-authored-by: Florian Bellotti <contact@fbellotti.com>
Co-authored-by: Frostweeds <romain.jufer@gmail.com>
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.

2 participants