Skip to content

Commit

Permalink
update tests and scarb fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
credence0x committed May 21, 2024
1 parent c9c08f8 commit 8b89c89
Show file tree
Hide file tree
Showing 5 changed files with 447 additions and 17 deletions.
19 changes: 19 additions & 0 deletions contracts/src/components/erc721/extensions/erc721_votes.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ use starknet::ContractAddress;
/// "representative" that will pool delegated voting units from different accounts and can then use it to vote in
/// decisions. In fact, voting units MUST be delegated in order to count as actual votes, and an account has to
/// delegate those votes to itself if it wishes to participate in decisions and does not have a trusted representative.
#[starknet::interface]
trait IERC721Votes<TState> {
fn get_votes(self: @TState, account: ContractAddress) -> u256;
fn get_past_votes(self: @TState, account: ContractAddress, timepoint: u64) -> u256;
fn get_past_total_supply(self: @TState, timepoint: u64) -> u256;

fn delegates(self: @TState, account: ContractAddress) -> ContractAddress;
fn delegate(ref self: TState, delegatee: ContractAddress);
fn delegate_by_sig(
ref self: TState,
delegator: ContractAddress,
delegatee: ContractAddress,
nonce: felt252,
expiry: u64,
signature: Array<felt252>
);
}


#[starknet::component]
mod ERC721VotesComponent {
use openzeppelin::account::dual_account::{DualCaseAccount, DualCaseAccountABI};
Expand Down
7 changes: 5 additions & 2 deletions contracts/src/components/strealm.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,14 @@ mod StRealmComponent {
}
}

fn _reward_balance(self: @ComponentState<TContractState>, owner: ContractAddress) -> (u256, bool) {
fn _reward_balance(
self: @ComponentState<TContractState>, owner: ContractAddress
) -> (u256, bool) {
if owner.is_non_zero() {
let staker_reward_balance = self.StRealm_staker_reward_balance.read(owner);
let stream: Stream = self.StRealm_streams.read(owner);
let owner_has_stream = stream.flow_id.is_non_zero() && stream.start_at.is_non_zero();
let owner_has_stream = stream.flow_id.is_non_zero()
&& stream.start_at.is_non_zero();
if owner_has_stream {
let flow: Flow = self.StRealm_flows.read(stream.flow_id);
let latest_flow_id: u64 = self.StRealm_latest_flow_id.read();
Expand Down
Loading

0 comments on commit 8b89c89

Please sign in to comment.