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]: Add "Checked" Versions of [Add/Sub]Assign Traits #469

Closed
1 task done
0xNeshi opened this issue Dec 31, 2024 · 0 comments · Fixed by #474
Closed
1 task done

[Feature]: Add "Checked" Versions of [Add/Sub]Assign Traits #469

0xNeshi opened this issue Dec 31, 2024 · 0 comments · Fixed by #474
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 31, 2024

What is the feature you would like to see?

Add traits similar to existing [Add/Sub]AssignUnchecked, but "checked" versions:

trait AddAssignChecked
trait SubAssignChecked

This would enable us to change code like:

let updated_nonce = nonce.checked_add(uint!(1_U256)).expect("error message");
self._nonces.setter(owner).set(updated_nonce);

Into:

self._nonces.setter(owner).add_assign_checked(uint!(1_U256), "error message");

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 31, 2024
@0xNeshi 0xNeshi added this to the Release v0.2.0 milestone Dec 31, 2024
@bidzyyys bidzyyys self-assigned this Jan 3, 2025
@bidzyyys bidzyyys moved this from Todo to In Progress in Rust Contracts Stylus Jan 3, 2025
bidzyyys added a commit that referenced this issue Jan 3, 2025
@bidzyyys bidzyyys linked a pull request Jan 3, 2025 that will close this issue
3 tasks
@github-project-automation github-project-automation bot moved this from In Progress to Done in Rust Contracts Stylus Jan 8, 2025
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: Done
Development

Successfully merging a pull request may close this issue.

2 participants