Skip to content

Commit

Permalink
Revert "Update to use snake_case in ERC20 govtoken instead of camelCase"
Browse files Browse the repository at this point in the history
This reverts commit 399dcb8.
  • Loading branch information
tensojka committed Apr 26, 2024
1 parent d841970 commit 2477871
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
19 changes: 6 additions & 13 deletions src/proposals.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ mod proposals {
use governance::types::VoteStatus;
use governance::traits::IERC20Dispatcher;
use governance::traits::IERC20DispatcherTrait;
use governance::traits::IGovernanceTokenDispatcher;
use governance::traits::IGovernanceTokenDispatcherTrait;
use governance::traits::get_governance_token_address_self;
use governance::constants;

Expand Down Expand Up @@ -279,16 +277,13 @@ mod proposals {
assert_correct_contract_type(to_upgrade);
let govtoken_addr = get_governance_token_address_self();
let caller = get_caller_address();
let caller_balance: u128 = IGovernanceTokenDispatcher {
contract_address: govtoken_addr
}
.balance_of(caller)
let caller_balance: u128 = IERC20Dispatcher { contract_address: govtoken_addr }
.balanceOf(caller)
.low;
let total_supply = IGovernanceTokenDispatcher { contract_address: govtoken_addr }
.total_supply();
let total_supply = IERC20Dispatcher { contract_address: govtoken_addr }.totalSupply();
let res: u256 = (caller_balance * constants::NEW_PROPOSAL_QUORUM)
.into(); // TODO use such multiplication that u128 * u128 = u256
assert(total_supply <= res, 'not enough tokens to submit');
assert(total_supply < res, 'not enough tokens to submit');

let prop_id = self.get_free_prop_id_timestamp();
let prop_details = PropDetails { payload: payload, to_upgrade: to_upgrade.into() };
Expand Down Expand Up @@ -377,10 +372,8 @@ mod proposals {
// TODO allow override of previous vote
assert(curr_vote_status == 0, 'already voted');

let caller_balance_u256: u256 = IGovernanceTokenDispatcher {
contract_address: gov_token_addr
}
.balance_of(caller_addr);
let caller_balance_u256: u256 = IERC20Dispatcher { contract_address: gov_token_addr }
.balanceOf(caller_addr);
assert(caller_balance_u256.high == 0, 'CARM balance > u128');
let caller_balance: u128 = caller_balance_u256.low;
assert(caller_balance != 0, 'CARM balance is zero');
Expand Down
6 changes: 3 additions & 3 deletions src/traits.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ trait IGovernanceToken<TContractState> {
fn name(self: @TContractState) -> felt252;
fn symbol(self: @TContractState) -> felt252;
fn decimals(self: @TContractState) -> felt252;
fn total_supply(self: @TContractState) -> u256;
fn balance_of(self: @TContractState, account: ContractAddress) -> u256;
fn totalSupply(self: @TContractState) -> u256;
fn balanceOf(self: @TContractState, account: ContractAddress) -> u256;
fn allowance(self: @TContractState, owner: ContractAddress, spender: ContractAddress) -> u256;
fn transfer(ref self: TContractState, recipient: ContractAddress, amount: u256) -> felt252;
fn transfer_from(
fn transferFrom(
ref self: TContractState, sender: ContractAddress, recipient: ContractAddress, amount: u256
) -> felt252;
fn mint(ref self: TContractState, to: ContractAddress, amount: u256);
Expand Down

0 comments on commit 2477871

Please sign in to comment.