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

Implemented dynamic IGO for #1796 #1797

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Implemented dynamic IGO for #1796 #1797

wants to merge 1 commit into from

Conversation

poshdan
Copy link
Collaborator

@poshdan poshdan commented Nov 23, 2022

Please check migration numbers before merging

PR Description

Based on ticket #1796
Implements a lightweight if-clause to distribute IGO.
Previously we would not do an if check in the else branch and would incur a hefty gas cost of modifying the user's IGO value to itself (you still pay extra even if the number doesn't change)
This solution makes very little impact but saves a LOT of gas when it's set to 0 and allows us to have different gas impact per-network.

Operating the feature is same as before, modifying var 28 on the cryptoblades contract.

Testing

Tested locally

Before if clause
win 103217 << extra cost for writing earnings on character for first time
win 87645 << real value to compare
After if clause, 0 amount
win 87883
win 87883
After if clause, non-0 amount
win 110433 << extra cost for taking user's IGO amount from 0 to non-0
win 95297 << consecutive gas cost compared to above for updating IGO number

Seems only 238 gas cost for the if clause. That's very negligible even at BNB ATH.

@poshdan poshdan added the pr-solidity Solidity pull request label Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-solidity Solidity pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant