-
Notifications
You must be signed in to change notification settings - Fork 256
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
Solving issue #1905: Aggregate Fights into a single txn to reduce gas… #1906
Merged
jeffyzxc
merged 11 commits into
CryptoBlades:main
from
NindoK:Aggregated-fights-into-single-transaction
May 11, 2023
Merged
Solving issue #1905: Aggregate Fights into a single txn to reduce gas… #1906
jeffyzxc
merged 11 commits into
CryptoBlades:main
from
NindoK:Aggregated-fights-into-single-transaction
May 11, 2023
Conversation
This file contains 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
github-actions
bot
added
pr-frontend
Frontend pull request
pr-solidity
Solidity pull request
labels
Mar 29, 2023
3 tasks
Chriserus
requested changes
May 3, 2023
Chriserus
reviewed
May 4, 2023
Chriserus
approved these changes
May 8, 2023
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.
LGTM, also consulted with @bilbolPrime
Please resolve the conflicts
Awesome! Glad to hear it :D Just solved the conflicts. |
…ion call. Switched on combat page from moltiplication to bignumber multiplication
bilbolPrime
approved these changes
May 10, 2023
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.
All Submissions
New Feature Submissions
Related to issues #1905
Notes
Please note, your code must pass all tests and lint checks before it can be merged.
PR Description
In this PR I propose a solution for aggregating all the fights into a single txn.
The solution require minor changes in the contract:
Instead in the Front End, I have readapted two old functions
fightTarget
inCombat.vue
anddoEncounterPayNative
inindex.ts
, I have just renamed these functions with their plural form to remain consistent.In both files I have changed that instead of the single values like
characterId
,targetId
orfightMultiplier
, now they are all arrays.For now this PR solves only the fighting part, but not the UI. The UI should let the users select for each character their enemy and then with a button fight all of them at once.
With this change the transaction gas goes down from
~356k
to~230k
.I have made some small changes into the
README.md
file, since I had some troubles while setting up the environment.Testing
The code has been tested multiple times, but I advise to check the math behind the offset, since I might not have understood correctly.