Open
Conversation
buck54321
reviewed
Feb 6, 2026
bond/verifier.go
Outdated
| ) | ||
|
|
||
| // ParseFunc is a function that parses a bond transaction and returns bond parameters. | ||
| type ParseFunc func(ver uint16, rawTx []byte, price float64) (*BondParams, error) |
Contributor
There was a problem hiding this comment.
Since bond strength is USD-based now, the calcs should be handled by the caller. bond.BondParams is more suitable as a DB type. Let's have this function return BTC value, expiration time, and account ID.
Contributor
Author
There was a problem hiding this comment.
by BTC value you mean asset value right? if so noted, if not elaborate. I'll get that done and start working on bond storage.
Extracted bond verification into dedicated package with asset parsers, verifier, database, and fetcher. Transactions are fetched via block explorers and verified using prevailing asset prices to determine bond strength. BTC and DCR verification are implemented with pluggable asset parsers. Integrated into handlers with price fetching per bond to calculate USD strength. Verifier stub still in use for now.
Updated asset ID format to use CAIP-19 standard (chain_id/slip44:code). Changed AssetBTC and AssetDCR from numeric uint32 to standardized strings: - BTC: bip122:000000000019d6689c085ae165831e93/slip44:0 - DCR: bip122:298e5cc3d985bcc8d3d8ec0a6c0d5755eb8d8374eb5aa635d37c2ab26370498a/slip44:42 Refactored asset ID handling across fetcher, verifier, and handlers from uint32 to string. Bond IDs now include full CAIP-19 asset identifiers. Database parsing correctly handles colons in bond IDs using SplitN. All tests updated with CAIP-19 formatted identifiers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a bond verifier. Provided transactions are fetched via block explorers and verified. The bond verifier uses the prevailing price of the asset at the time of posting to the mesh network to determine the strength of the bond. The verifier has been integrated but still uses the verifier stub for the time being. BTC and DCR bond verification have been implemented.
Updated asset ID format to use CAIP-19 standard (chain_id/slip44:code). Changed
AssetBTC and AssetDCR from numeric uint32 to standardized strings:
bip122:000000000019d6689c085ae165831e93/slip44:0bip122:298e5cc3d985bcc8d3d8ec0a6c0d5755eb8d8374eb5aa635d37c2ab26370498a/slip44:42Refactored asset ID handling across fetcher, verifier, and handlers from uint32
to string. Bond IDs now include full CAIP-19 asset identifiers. Database parsing
correctly handles colons in bond IDs using SplitN. All tests updated with CAIP-19
formatted identifiers.