Skip to content

feat(blocksize): refactor with the changes they asked for - #18

Merged
gluax merged 1 commit into
mainfrom
feat/blocksize-updates
Sep 10, 2025
Merged

feat(blocksize): refactor with the changes they asked for#18
gluax merged 1 commit into
mainfrom
feat/blocksize-updates

Conversation

@gluax

@gluax gluax commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator

Motivation

Make the changes blocksize asked for.

Explanation of Changes

You can now pass in the fields you want from the API response. By default, does all fields from the response, minus the ticker.
It does the median for each, and it returns an uint256[].

Testing

Modified the tests and tested on testnet.

Related PRs and Issues

N/A

@gluax
gluax requested review from Thomasvdam and mariocao September 4, 2025 22:37
@gluax gluax self-assigned this Sep 4, 2025
Comment on lines +129 to +134
let timestamp = response_data
.get(field)
.and_then(|ts| ts.as_u64())
.ok_or_else(|| anyhow!("{field} not found in response or is invalid"))?;
log!("Fetched {field}: {timestamp:?}");
(timestamp as u128).to_le_bytes()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm missing something but doesn't this basically convert the ts field to a uint128 and gets processed as a price in the tally?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing done in the tally is median. So they said median timestamp following along the data was fine too :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫠

@gluax
gluax merged commit 5a209fe into main Sep 10, 2025
1 check passed
@gluax
gluax deleted the feat/blocksize-updates branch September 10, 2025 14:05
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