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

[Feature]: Shorten All Relevant Add/Sub Assignment Operations in Every Contract #445

Open
1 task done
0xNeshi opened this issue Dec 10, 2024 · 0 comments · May be fixed by #467
Open
1 task done

[Feature]: Shorten All Relevant Add/Sub Assignment Operations in Every Contract #445

0xNeshi opened this issue Dec 10, 2024 · 0 comments · May be fixed by #467
Assignees
Labels
effort: low Easy or tiny task that takes less than a day. good first issue Good for newcomers. priority: 0 Nice-to-have. Willing to ship without this. type: ref A code update that doesn't meaningfully change functionality.

Comments

@0xNeshi
Copy link
Collaborator

0xNeshi commented Dec 10, 2024

What is the feature you would like to see?

The AddAssignUnchecked and SubAssignUnchecked traits are implemented for StorageUint (see source).

This makes it possible to shorten integer state assignments from:

let total_supply_all = self._total_supply_all.get() - total_burn_value;
self._total_supply_all.set(total_supply_all);

To a one-liner:

self._total_supply_all.sub_assign_unchecked(total_burn_value);

We should update all similar state updates in all contracts.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines
@0xNeshi 0xNeshi added priority: 0 Nice-to-have. Willing to ship without this. good first issue Good for newcomers. effort: low Easy or tiny task that takes less than a day. type: ref A code update that doesn't meaningfully change functionality. labels Dec 10, 2024
@0xNeshi 0xNeshi self-assigned this Dec 26, 2024
@0xNeshi 0xNeshi linked a pull request Dec 26, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: low Easy or tiny task that takes less than a day. good first issue Good for newcomers. priority: 0 Nice-to-have. Willing to ship without this. type: ref A code update that doesn't meaningfully change functionality.
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

1 participant