Skip to content

Commit

Permalink
refactor: simplify overly verbose code
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed Sep 19, 2023
1 parent e3e6226 commit b767531
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/libraries/ownable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ fn transfer_ownership<T, impl TOwnable: Ownable<T>, impl TDrop: Drop<T>>(
fn renounce_ownership<T, impl TOwnable: Ownable<T>, impl TDrop: Drop<T>>(ref self: T) {
assert_only_owner(@self);
__private::_transfer_ownership(ref self, contract_address_const::<0>());
return ();
}

// Not public API (Cairo does not support _real_ private modules yet)
Expand Down
10 changes: 2 additions & 8 deletions src/z_token/view.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ fn decimals(self: @ContractState) -> felt252 {
}

fn totalSupply(self: @ContractState) -> u256 {
let scaled_up_supply = felt_total_supply(self);
let scaled_up_supply: u256 = scaled_up_supply.into();

scaled_up_supply
felt_total_supply(self).into()
}

fn felt_total_supply(self: @ContractState) -> felt252 {
Expand All @@ -52,10 +49,7 @@ fn felt_total_supply(self: @ContractState) -> felt252 {
}

fn balanceOf(self: @ContractState, account: ContractAddress) -> u256 {
let scaled_up_balance = felt_balance_of(self, account);
let scaled_up_balance: u256 = scaled_up_balance.into();

scaled_up_balance
felt_balance_of(self, account).into()
}

fn felt_balance_of(self: @ContractState, account: ContractAddress) -> felt252 {
Expand Down

0 comments on commit b767531

Please sign in to comment.