-
Notifications
You must be signed in to change notification settings - Fork 92
feat: add Tron substreams indexing package #1691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/tron-payment-processor
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile OverviewGreptile SummaryThis PR adds a new Substreams module for indexing ERC20FeeProxy payment events on TRON blockchain (mainnet and Nile testnet). The implementation includes Rust code to parse Critical Issues Found:
Positive Aspects:
Confidence Score: 0/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant TB as TRON Blockchain
participant SS as Substreams Module
participant Map as map_erc20_fee_proxy_payments
participant Parser as Event Parser
participant Store as store_payments
participant SG as Subgraph (mappings.ts)
TB->>SS: Block Stream (sf.tron.type.v1.Block)
SS->>Map: Process Block
loop For each transaction
Map->>Map: Extract transaction logs
loop For each log entry
Map->>Map: Check contract address<br/>(MAINNET or NILE proxy)
alt Contract address matches
Map->>Parser: parse_transfer_with_reference_and_fee()
Parser->>Parser: Extract payment reference from topics[1]
Parser->>Parser: Parse ABI-encoded data:<br/>- token_address<br/>- to<br/>- amount<br/>- fee_amount<br/>- fee_address
Parser->>Parser: Extract sender from transaction
Parser->>Parser: base58_encode() addresses
Parser-->>Map: Payment object
Map->>Map: Add to payments collection
end
end
end
Map-->>Store: Payments (proto:request.tron.v1.Payments)
Store->>Store: Index by payment reference
Store-->>SG: Payment events
SG->>SG: Transform to GraphQL entities
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 4 comments
efec749 to
d371bec
Compare
7928566 to
5ac332a
Compare
d371bec to
b25490d
Compare
5ac332a to
984a642
Compare
b25490d to
7781afd
Compare
41e33e8 to
d03f1db
Compare
cc6dc3b to
5775865
Compare
7d73139 to
6dce563
Compare
0ba3252 to
02650d7
Compare
6dce563 to
dbed330
Compare
0d5df81 to
55ba0a1
Compare
1797a69 to
d5e25df
Compare
55ba0a1 to
320874e
Compare
d5e25df to
b5ce760
Compare
bd8dee5 to
00fa62d
Compare
9f7c686 to
f35428b
Compare
c5a8b72 to
96fe3e0
Compare
6e8e3f4 to
d55f2f5
Compare
96fe3e0 to
5c45f73
Compare
d066e4e to
c574332
Compare
19beedb to
f8bb525
Compare
e2cdfb9 to
3ec3783
Compare
- Add substreams configuration for Tron payment indexing - Add protobuf definitions and schema - Add Rust implementation for payment extraction
- Fix truncated TRANSFER_WITH_REF_AND_FEE_TOPIC (was 40 chars, now 64 chars) - Add validation to check topics[0] matches expected event signature - Prevents parsing non-TransferWithReferenceAndFee events
- Add hexAddress to deployment files (mainnet.json and nile.json) - Move tron/nile chain definitions from declarative to tron folder - Update DeclarativeChainName type to remove tron/nile - Use erc20FeeProxyArtifact.getDeploymentInformation() instead of hardcoded values - Rename tron-fee-proxy.ts to trc20-fee-proxy.ts for clarity - Make fee limit configurable in utils-tron.ts with defaults
- Remove hardcoded MAINNET_PROXY_ADDRESS and NILE_PROXY_ADDRESS constants - Add parse_proxy_addresses function to read addresses from params - Update substreams.yaml to pass params to the map module This allows the proxy addresses to be configured without recompiling.
Proto package directory mismatch: - Move payments.proto to proto/request/tron/v1/ to match package declaration - Update build.rs and substreams.yaml with new path Transaction success validation: - Add TronTransactionInfo interface - Add getTransactionInfo method to TronWeb interface - Add waitForTransactionConfirmation helper function - Add optional waitForConfirmation parameter to approveTrc20 and processTronFeeProxyPayment
- Add missing bs58 dependency to Cargo.toml - Fix subgraph.yaml to use correct substreams/graph-entities pattern - Remove store_payments module (no handler implemented)
- Add dedicated build-substreams-tron job with Rust 1.75 image - Install wasm32-unknown-unknown target for WebAssembly compilation - Add cargo caching for faster builds - Run tests as part of the CI job - Update package.json to skip lerna build (requires Rust toolchain)
… crate The substreams-tron crate doesn't exist on crates.io. Instead, we now include pre-generated protobuf types from the StreamingFast tron-foundational module. This includes: - sf.tron.type.v1 types (Block, Transaction, etc.) - protocol types (TransactionInfo, Log, Contract, etc.) - request.tron.v1 types (Payment, Payments) Also fixed type references in lib.rs to use the correct Transaction structure instead of the non-existent TransactionTrace.
The home crate v0.5.12 requires Rust edition 2024 which was stabilized in Rust 1.85.
substreams v0.5.22 uses prost v0.11.9, so we need to use the same version to avoid trait incompatibility errors.
- Add engines, bugs, and homepage fields - Add period at end of description - Reorder properties with description after private
The substreams-tron tests require Rust/cargo which is only available in the dedicated build-substreams-tron CI job, not the general Node.js test environment.
The test was importing from 'tron-fee-proxy' but the source file is named 'trc20-fee-proxy.ts'.
f8bb525 to
ceec59f
Compare
4588088 to
6e9d00f
Compare
- Remove packages/substreams-tron (moved to payments-substream/tron) - Remove build-substreams-tron job from CircleCI config - Update graphql.config.yml to use local schema - Substreams now maintained in separate repo for cleaner separation

Description of the changes
Added a new Substreams module for indexing ERC20FeeProxy payment events on the TRON blockchain. This module:
TransferWithReferenceAndFeeevents from deployed ERC20FeeProxy contracts on TRON mainnet and Nile testnetTCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd) and Nile testnet (THK5rNmrvCujhmrXa5DB1dASepwXTr9cJs) contract addressesCloses RequestNetwork/private-issues#226