Skip to content

Commit

Permalink
Changed impls references to self to "Self" (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
bengineer42 authored May 29, 2024
1 parent 274faaf commit 4b87d23
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/src/random/deck.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl DeckImpl of DeckTrait {

fn from_bitmap(seed: felt252, number: u32, mut bitmap: u128) -> Deck {
assert(number <= 128, errors::TOO_MANY_CARDS);
let mut deck = DeckTrait::new(seed, number);
let mut deck = Self::new(seed, number);
let mut card: u8 = 1;
loop {
if bitmap == 0 || card.into() > number {
Expand Down
4 changes: 2 additions & 2 deletions crates/src/rating/elo.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ impl Private of PrivateTrait {
} else if exp == 1_u8.into() {
base
} else if exp % 2_u8.into() == 0_u8.into() {
PrivateTrait::pow(base * base, exp / 2_u8.into())
Self::pow(base * base, exp / 2_u8.into())
} else {
base * PrivateTrait::pow(base * base, exp / 2_u8.into())
base * Self::pow(base * base, exp / 2_u8.into())
}
}

Expand Down
10 changes: 5 additions & 5 deletions examples/matchmaker/src/helpers/bitmap.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ mod errors {
impl Bitmap of BitmapTrait {
#[inline(always)]
fn get_bit_at(bitmap: u256, index: felt252) -> bool {
let mask = Bitmap::two_pow(index);
let mask = Self::two_pow(index);
bitmap & mask == mask
}

#[inline(always)]
fn set_bit_at(bitmap: u256, index: felt252, value: bool) -> u256 {
let mask = Bitmap::two_pow(index);
let mask = Self::two_pow(index);
if value {
bitmap | mask
} else {
Expand All @@ -40,10 +40,10 @@ impl Bitmap of BitmapTrait {
/// * The index of the nearest significant bit
#[inline(always)]
fn nearest_significant_bit(x: u256, s: u8) -> Option::<u8> {
let lower_mask = Bitmap::set_bit_at(0, (s + 1).into(), true) - 1;
let lower = Bitmap::most_significant_bit(x & lower_mask);
let lower_mask = Self::set_bit_at(0, (s + 1).into(), true) - 1;
let lower = Self::most_significant_bit(x & lower_mask);
let upper_mask = ~(lower_mask / 2);
let upper = Bitmap::least_significant_bit(x & upper_mask);
let upper = Self::least_significant_bit(x & upper_mask);
match (lower, upper) {
(
Option::Some(l), Option::Some(u)
Expand Down
2 changes: 1 addition & 1 deletion token/src/erc721/erc721.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ mod ERC721 {

let caller = get_caller_address();
assert(
owner == caller || ERC721Impl::is_approved_for_all(@self, owner, caller),
owner == caller || Self::is_approved_for_all(@self, owner, caller),
Errors::UNAUTHORIZED
);
self._approve(to, token_id);
Expand Down

0 comments on commit 4b87d23

Please sign in to comment.