-
Notifications
You must be signed in to change notification settings - Fork 28
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
[SC-935] Feature/asm #135
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
📢 Thoughts on this report? Let us know!. |
// 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)) |
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.
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) |
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.
It is not used in fact. I forgot to remove the timeWeightedAvg
function 😩
Closing as the gas gains are not significant. |
getter: -470 gas on 5 points
whitelist: -487 gas on 5 resolvers
total: 957 gas