Skip to content
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

[SC-935] Feature/asm #135

Closed
wants to merge 9 commits into from
Closed

[SC-935] Feature/asm #135

wants to merge 9 commits into from

Conversation

ZumZoom
Copy link
Member

@ZumZoom ZumZoom commented Oct 6, 2023

getter: -470 gas on 5 points
whitelist: -487 gas on 5 resolvers
total: 957 gas

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
contracts/SettlementExtension.sol 100.00% <100.00%> (+3.03%) ⬆️

📢 Thoughts on this report? Let us know!.

Base automatically changed from feature/remove-settlement-contract to master November 1, 2023 10:46
// solhint-disable-next-line no-inline-assembly
assembly ("memory-safe") {
function timeWeightedAvg(t1, v1, t2, v2) -> avg {
avg := div(add(mul(sub(timestamp(), t1), v2), mul(sub(t2, timestamp()), v1)), sub(t2, t1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
avg := div(add(mul(sub(timestamp(), t1), v2), mul(sub(t2, timestamp()), v1)), sub(t2, t1))
avg := div(add(mul(sub(timestamp(), t1), v2), mul(sub(t2, timestamp()), v1)), sub(t2, t1)) // ((block.timestamp - t1) * v2 + (t2 - block.timestamp) * v1) / (t2 - t1)

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not used in fact. I forgot to remove the timeWeightedAvg function 😩

@ZumZoom
Copy link
Member Author

ZumZoom commented Nov 7, 2023

Closing as the gas gains are not significant.

@ZumZoom ZumZoom closed this Nov 7, 2023
@ZumZoom ZumZoom deleted the feature/asm branch November 7, 2023 07:16
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