-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/erc20-burnable
- Loading branch information
Showing
7 changed files
with
1,192 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use alloy_primitives::U256; | ||
use stylus_sdk::storage::{StorageGuardMut, StorageUint}; | ||
|
||
pub(crate) trait AddAssignUnchecked<T> { | ||
fn add_assign_unchecked(&mut self, rhs: T); | ||
} | ||
|
||
impl<'a> AddAssignUnchecked<U256> for StorageGuardMut<'a, StorageUint<256, 4>> { | ||
fn add_assign_unchecked(&mut self, rhs: U256) { | ||
let new_balance = self.get() + rhs; | ||
self.set(new_balance); | ||
} | ||
} | ||
|
||
pub(crate) trait SubAssignUnchecked<T> { | ||
fn sub_assign_unchecked(&mut self, rhs: T); | ||
} | ||
|
||
impl<'a> SubAssignUnchecked<U256> for StorageGuardMut<'a, StorageUint<256, 4>> { | ||
fn sub_assign_unchecked(&mut self, rhs: U256) { | ||
let new_balance = self.get() - rhs; | ||
self.set(new_balance); | ||
} | ||
} |
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
Oops, something went wrong.