Skip to content

Commit

Permalink
Merge pull request #300 from adrianvrj/dev
Browse files Browse the repository at this point in the history
feat-291
  • Loading branch information
EmmanuelAR authored Dec 18, 2024
2 parents 819a559 + fe01196 commit 057c6aa
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 67 deletions.
4 changes: 4 additions & 0 deletions contracts/src/fund.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use starknet::ContractAddress;
pub trait IFund<TContractState> {
fn get_id(self: @TContractState) -> u128;
fn get_owner(self: @TContractState) -> ContractAddress;
fn is_owner(self: @TContractState, caller: ContractAddress) -> bool;
fn set_name(ref self: TContractState, name: ByteArray);
fn get_name(self: @TContractState) -> ByteArray;
fn set_reason(ref self: TContractState, reason: ByteArray);
Expand Down Expand Up @@ -132,6 +133,9 @@ pub mod Fund {
fn get_owner(self: @ContractState) -> ContractAddress {
return self.owner.read();
}
fn is_owner(self: @ContractState, caller: ContractAddress) -> bool {
return (self.owner.read() == caller);
}
fn set_name(ref self: ContractState, name: ByteArray) {
let caller = get_caller_address();
let valid_address_1 = contract_address_const::<FundManagerConstants::VALID_ADDRESS_1>();
Expand Down
2 changes: 0 additions & 2 deletions frontend/gostarkme-web/.env.example

This file was deleted.

4 changes: 1 addition & 3 deletions frontend/gostarkme-web/components/modules/Fund/Fund.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ const Fund = () => {
let evidenceLink = await fundContract.get_evidence_link();
let contactHandle = await fundContract.get_contact_handle();
// Fetch owner
const ownerDecimal = (await fundContract.get_owner()).toString();
const ownerHex = "0x"+BigInt(ownerDecimal).toString(16);
setIsOwner(ownerHex.toLowerCase() === wallet?.account?.address.toLowerCase());
setIsOwner(await fundContract.is_owner(wallet?.account.address));
// USER VOTED?
let voted = await fundContract.get_voter(wallet != undefined ? wallet?.account.address : "0x0000000000");

Expand Down
Loading

0 comments on commit 057c6aa

Please sign in to comment.