diff --git a/contracts/src/fund.cairo b/contracts/src/fund.cairo index da227f1..4361837 100644 --- a/contracts/src/fund.cairo +++ b/contracts/src/fund.cairo @@ -103,12 +103,13 @@ pub mod Fund { name: ByteArray, goal: u256, evidence_link: ByteArray, - contact_handle: ByteArray + contact_handle: ByteArray, + reason: ByteArray ) { self.id.write(id); self.owner.write(owner); self.name.write(name); - self.reason.write(" "); + self.reason.write(reason); self.up_votes.write(FundConstants::INITIAL_UP_VOTES); self.goal.write(goal); self.state.write(FundStates::RECOLLECTING_VOTES); diff --git a/contracts/src/fundManager.cairo b/contracts/src/fundManager.cairo index 84a4005..ebc2bc7 100755 --- a/contracts/src/fundManager.cairo +++ b/contracts/src/fundManager.cairo @@ -8,7 +8,8 @@ pub trait IFundManager { name: ByteArray, goal: u256, evidence_link: ByteArray, - contact_handle: ByteArray + contact_handle: ByteArray, + reason: ByteArray ); fn getCurrentId(self: @TContractState) -> u128; fn getFund(self: @TContractState, id: u128) -> ContractAddress; @@ -82,7 +83,8 @@ pub mod FundManager { name: ByteArray, goal: u256, evidence_link: ByteArray, - contact_handle: ByteArray + contact_handle: ByteArray, + reason: ByteArray, ) { assert(goal >= FundConstants::MINIMUM_GOAL, 'Goal must be at least 500'); let mut call_data: Array = array![]; @@ -92,6 +94,7 @@ pub mod FundManager { Serde::serialize(@goal, ref call_data); Serde::serialize(@evidence_link, ref call_data); Serde::serialize(@contact_handle, ref call_data); + Serde::serialize(@reason, ref call_data); let (new_fund_address, _) = deploy_syscall( self.fund_class_hash.read(), 12345, call_data.span(), false ) diff --git a/contracts/tests/test_fund.cairo b/contracts/tests/test_fund.cairo index b26ae69..7f9268e 100644 --- a/contracts/tests/test_fund.cairo +++ b/contracts/tests/test_fund.cairo @@ -36,7 +36,10 @@ fn FUND_MANAGER() -> ContractAddress { fn NAME() -> ByteArray { "Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum" } -fn REASON() -> ByteArray { +fn REASON_1() -> ByteArray { + "Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum" +} +fn REASON_2() -> ByteArray { "Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum" } fn GOAL() -> u256 { @@ -63,6 +66,7 @@ fn _setup_() -> ContractAddress { calldata.append_serde(GOAL()); calldata.append_serde(EVIDENCE_LINK_1()); calldata.append_serde(CONTACT_HANDLE_1()); + calldata.append_serde(REASON_1()); let (contract_address, _) = contract.deploy(@calldata).unwrap(); contract_address } @@ -85,7 +89,7 @@ fn test_constructor() { assert(id == ID(), 'Invalid id'); assert(owner == OWNER(), 'Invalid owner'); assert(name == NAME(), 'Invalid name'); - assert(reason == " ", 'Invalid reason'); + assert(reason == REASON_1(), 'Invalid reason'); assert(up_votes == 0, 'Invalid up votes'); assert(goal == GOAL(), 'Invalid goal'); assert(current_goal_state == 0, 'Invalid current goal state'); @@ -109,11 +113,11 @@ fn test_set_reason() { let contract_address = _setup_(); let dispatcher = IFundDispatcher { contract_address }; let reason = dispatcher.getReason(); - assert(reason == " ", 'Invalid reason'); + assert(reason == REASON_1(), 'Invalid reason'); start_cheat_caller_address_global(OWNER()); - dispatcher.setReason(REASON()); + dispatcher.setReason(REASON_2()); let new_reason = dispatcher.getReason(); - assert(new_reason == REASON(), 'Set reason method not working') + assert(new_reason == REASON_2(), 'Set reason method not working') } #[test] diff --git a/contracts/tests/test_fund_manager.cairo b/contracts/tests/test_fund_manager.cairo index d293811..70312b1 100755 --- a/contracts/tests/test_fund_manager.cairo +++ b/contracts/tests/test_fund_manager.cairo @@ -43,7 +43,6 @@ fn EVIDENCE_LINK() -> ByteArray { fn CONTACT_HANDLE() -> ByteArray { "Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum, Lorem impsum" } - fn _setup_() -> (ContractAddress, ClassHash) { // Fund let fund = declare("Fund").unwrap(); @@ -54,6 +53,7 @@ fn _setup_() -> (ContractAddress, ClassHash) { fund_calldata.append_serde(GOAL()); fund_calldata.append_serde(EVIDENCE_LINK()); fund_calldata.append_serde(CONTACT_HANDLE()); + fund_calldata.append_serde(REASON()); let (fund_contract_address, _) = fund.deploy(@fund_calldata).unwrap(); let fund_class_hash = get_class_hash(fund_contract_address); @@ -87,7 +87,7 @@ fn test_new_fund() { start_cheat_caller_address_global(OWNER()); let (contract_address, fund_class_hash) = _setup_(); let fund_manager_contract = IFundManagerDispatcher { contract_address }; - fund_manager_contract.newFund(NAME(), GOAL(), EVIDENCE_LINK(), CONTACT_HANDLE()); + fund_manager_contract.newFund(NAME(), GOAL(), EVIDENCE_LINK(), CONTACT_HANDLE(), REASON()); let expected_fund_class_hash = get_class_hash(fund_manager_contract.getFund(1)); let current_id = fund_manager_contract.getCurrentId(); assert(expected_fund_class_hash == fund_class_hash, 'Invalid fund address'); @@ -100,7 +100,7 @@ fn test_new_fund_bad_goal() { start_cheat_caller_address_global(OWNER()); let (contract_address, _) = _setup_(); let fund_manager_contract = IFundManagerDispatcher { contract_address }; - fund_manager_contract.newFund(NAME(), BAD_GOAL(), EVIDENCE_LINK(), CONTACT_HANDLE()); + fund_manager_contract.newFund(NAME(), BAD_GOAL(), EVIDENCE_LINK(), CONTACT_HANDLE(), REASON()); } #[test] @@ -113,7 +113,7 @@ fn test_fund_deployed_event() { let mut spy = spy_events(); let current_id = fund_manager_contract.getCurrentId(); - fund_manager_contract.newFund(NAME(), GOAL(), EVIDENCE_LINK(), CONTACT_HANDLE()); + fund_manager_contract.newFund(NAME(), GOAL(), EVIDENCE_LINK(), CONTACT_HANDLE(), REASON()); let expected_fund_class_hash = fund_manager_contract.getFund(1); diff --git a/frontend/gostarkme-web/app/app/page.tsx b/frontend/gostarkme-web/app/app/page.tsx index d5ef593..1a1036a 100644 --- a/frontend/gostarkme-web/app/app/page.tsx +++ b/frontend/gostarkme-web/app/app/page.tsx @@ -32,7 +32,6 @@ const Dashboard = () => { const fundContract = new Contract(fundAbi, fundaddr, wallet?.account); // GET FUND NAME let name = await fundContract.getName(); - name = hex2ascii(name.toString(16)); // GET FUND DESCRIPTION let desc = await fundContract.getReason(); // GET FUND ID diff --git a/frontend/gostarkme-web/components/modules/Fund/Fund.tsx b/frontend/gostarkme-web/components/modules/Fund/Fund.tsx index c529897..8aafa12 100644 --- a/frontend/gostarkme-web/components/modules/Fund/Fund.tsx +++ b/frontend/gostarkme-web/components/modules/Fund/Fund.tsx @@ -31,15 +31,15 @@ const Fund = () => { // GET FUND NAME let name = await fundContract.getName(); - name = hex2ascii(name.toString(16)); // GET FUND DESCRIPTION + let desc = await fundContract.getReason(); if (desc == " ") { desc = "No description provided"; } let state = await fundContract.getState(); - let currentBalance = await fundContract.getCurrentGoalState(); + let currentBalance = await fundContract.get_current_goal_state(); let goal = await fundContract.getGoal(); diff --git a/frontend/gostarkme-web/components/modules/newfunding/FundingStep.tsx b/frontend/gostarkme-web/components/modules/newfunding/FundingStep.tsx index b46f515..688a189 100644 --- a/frontend/gostarkme-web/components/modules/newfunding/FundingStep.tsx +++ b/frontend/gostarkme-web/components/modules/newfunding/FundingStep.tsx @@ -3,17 +3,25 @@ import React from 'react'; interface FundingStepProps { fundingName: string; setFundingName: (name: string) => void; - name: string; - setName: (name: string) => void; - errors: { fundingName: string; name: string }; // Expecting errors as props - setErrors: React.Dispatch>; // Specify the type for setErrors + goal: string; + setGoal: (name: string) => void; + evidenceLink: string; + setEvidenceLink: (name: string) => void; + contactHandle: string; + setContactHandle: (name: string) => void; + errors: { fundingName: string; goal: string ;evidenceLink: string; contactHandle: string }; // Expecting errors as props + setErrors: React.Dispatch>; // Specify the type for setErrors } const FundingStep: React.FC = ({ fundingName, setFundingName, - name, - setName, + goal, + setGoal, + evidenceLink, + setEvidenceLink, + contactHandle, + setContactHandle, errors, setErrors, }) => { @@ -22,10 +30,10 @@ const FundingStep: React.FC = ({ // Check if the input is empty or a valid non-negative number if (newValue === '' || (Number(newValue) >= 0 && !isNaN(Number(newValue)))) { - setName(newValue); - setErrors((prev) => ({ ...prev, name: '' })); + setGoal(newValue); + setErrors((prev) => ({ ...prev, goal : '' })); } else { - setErrors((prev) => ({ ...prev, name: 'The goal must be a non-negative number.' })); + setErrors((prev) => ({ ...prev, goal: 'The goal must be a non-negative number.' })); } }; @@ -45,6 +53,26 @@ const FundingStep: React.FC = ({ } }; + const handleEvidenceLink = (e: React.ChangeEvent) => { + const newValue = e.target.value; + setEvidenceLink(newValue); + if (!newValue) { + setErrors((prev) => ({ ...prev, evidenceLink: 'Evidence link is required.' })); + } else { + setErrors((prev) => ({ ...prev, evidenceLink: '' })); + } + }; + + const handleContactHandle = (e: React.ChangeEvent) => { + const newValue = e.target.value; + setContactHandle(newValue); + if (!newValue) { + setErrors((prev) => ({ ...prev, evidenceLink: 'Contact handle is required.' })); + } else { + setErrors((prev) => ({ ...prev, evidenceLink: '' })); + } + }; + return (
= ({ + + {/* Error Messages */} {errors.fundingName && (

{errors.fundingName}

)} - {errors.name && ( -

{errors.name}

+ {errors.goal && ( +

{errors.goal}

+ )} + {errors.evidenceLink && ( +

{errors.evidenceLink}

+ )} + {errors.contactHandle && ( +

{errors.contactHandle}

)}
); diff --git a/frontend/gostarkme-web/components/modules/newfunding/Stages.tsx b/frontend/gostarkme-web/components/modules/newfunding/Stages.tsx index df37ddd..8ab7cb7 100644 --- a/frontend/gostarkme-web/components/modules/newfunding/Stages.tsx +++ b/frontend/gostarkme-web/components/modules/newfunding/Stages.tsx @@ -2,17 +2,26 @@ import { Button } from "@/components/ui/Button"; import { useState } from "react"; import FundingStep from "./FundingStep"; import DescriptionStep from "./DescriptionStep"; +import { Contract, wallet, InvokeFunctionResponse, shortString } from "starknet"; +import { fundManager } from "@/contracts/abis/fundManager"; +import { FUND_MANAGER_ADDR } from "@/constants"; +import { useAtomValue } from "jotai"; +import { walletStarknetkitLatestAtom } from "@/state/connectedWallet"; + const Stages = () => { const [currentStep, setCurrentStep] = useState(0); const [fundingName, setFundingName] = useState(""); - const [name, setName] = useState(""); + const [goal, setGoal] = useState(""); const [fundingDescription, setFundingDescription] = useState(""); - const [errors, setErrors] = useState({ fundingName: "", name: "" }); + const [errors, setErrors] = useState({ fundingName: "", goal: "",evidenceLink: "",contactHandle: "" }); + const [evidenceLink, setEvidenceLink] = useState(""); + const [contactHandle, setContactHandle] = useState(""); + const wallet = useAtomValue(walletStarknetkitLatestAtom); const handleNextStep = () => { // Reset errors - setErrors({ fundingName: "", name: "" }); + setErrors({ fundingName: "", goal: "", evidenceLink: "", contactHandle: ""}); // Validate fields let hasErrors = false; @@ -21,8 +30,16 @@ const Stages = () => { setErrors((prev) => ({ ...prev, fundingName: "Funding name is required." })); hasErrors = true; } - if (!name) { - setErrors((prev) => ({ ...prev, name: "The goal is required." })); + if (!goal) { + setErrors((prev) => ({ ...prev, goal: "The goal is required." })); + hasErrors = true; + } + if (!evidenceLink) { + setErrors((prev) => ({ ...prev, evidenceLink: "The evidence link is required." })); + hasErrors = true; + } + if (!contactHandle) { + setErrors((prev) => ({ ...prev, contactHandle: "The contact handle is required." })); hasErrors = true; } } @@ -38,11 +55,20 @@ const Stages = () => { alert("Please enter a description."); return; } - console.log("Funding Name:", fundingName); - console.log("Name:", name); - console.log("Description:", fundingDescription); + newFund(); }; + function newFund() { + const fundNameSplited = shortString.splitLongString(fundingName); + const fundManagerContract = new Contract(fundManager, FUND_MANAGER_ADDR, wallet?.account); + const myCall = fundManagerContract.newFund(fundingName,goal,evidenceLink,contactHandle,fundingDescription); + wallet?.account?.execute(myCall) + .then(async (resp: InvokeFunctionResponse) => { + console.log("increaseBalance txH =", resp.transaction_hash); + }) + .catch((e: any) => { console.log("error increase balance =", e) }); + } + return (
{/* Step Content */} @@ -50,10 +76,14 @@ const Stages = () => { ) : ( " - }, - { - "name": "pending_word", - "type": "core::felt252" - }, - { - "name": "pending_word_len", - "type": "core::integer::u32" - } - ] - }, - { - "type": "struct", - "name": "core::integer::u256", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "type": "interface", - "name": "gostarkme::fund::IFund", - "items": [ - { - "type": "function", - "name": "getId", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "getOwner", - "inputs": [], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "setName", - "inputs": [ - { - "name": "name", - "type": "core::felt252" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "getName", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "setReason", - "inputs": [ - { - "name": "reason", - "type": "core::byte_array::ByteArray" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "getReason", - "inputs": [], - "outputs": [ - { - "type": "core::byte_array::ByteArray" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "receiveVote", - "inputs": [], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "getUpVotes", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "setGoal", - "inputs": [ - { - "name": "goal", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "getGoal", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "receiveDonation", - "inputs": [ - { - "name": "strks", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "getCurrentGoalState", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u256" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "setState", - "inputs": [ - { - "name": "state", - "type": "core::integer::u8" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "getState", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u8" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "getVoter", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "withdraw", - "inputs": [], - "outputs": [], - "state_mutability": "external" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [ - { - "name": "id", - "type": "core::integer::u128" - }, - { - "name": "owner", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "name", - "type": "core::felt252" - }, - { - "name": "goal", - "type": "core::integer::u256" - } - ] - }, - { - "type": "event", - "name": "gostarkme::fund::Fund::DonationWithdraw", - "kind": "struct", - "members": [ - { - "name": "owner_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "fund_contract_address", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "withdrawn_amount", - "type": "core::integer::u256", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "gostarkme::fund::Fund::NewVoteReceived", - "kind": "struct", - "members": [ - { - "name": "voter", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "fund", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "data" - }, - { - "name": "votes", - "type": "core::integer::u32", - "kind": "data" - } - ] - }, - { - "type": "event", - "name": "gostarkme::fund::Fund::Event", - "kind": "enum", - "variants": [ - { - "name": "DonationWithdraw", - "type": "gostarkme::fund::Fund::DonationWithdraw", - "kind": "nested" - }, - { - "name": "NewVoteReceived", - "type": "gostarkme::fund::Fund::NewVoteReceived", - "kind": "nested" - } - ] - } - ] \ No newline at end of file + { + "type": "impl", + "name": "FundImpl", + "interface_name": "gostarkme::fund::IFund" + }, + { + "type": "struct", + "name": "core::byte_array::ByteArray", + "members": [ + { + "name": "data", + "type": "core::array::Array::" + }, + { + "name": "pending_word", + "type": "core::felt252" + }, + { + "name": "pending_word_len", + "type": "core::integer::u32" + } + ] + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "interface", + "name": "gostarkme::fund::IFund", + "items": [ + { + "type": "function", + "name": "getId", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "getOwner", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "setName", + "inputs": [ + { + "name": "name", + "type": "core::byte_array::ByteArray" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "getName", + "inputs": [], + "outputs": [ + { + "type": "core::byte_array::ByteArray" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "setReason", + "inputs": [ + { + "name": "reason", + "type": "core::byte_array::ByteArray" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "getReason", + "inputs": [], + "outputs": [ + { + "type": "core::byte_array::ByteArray" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "receiveVote", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "getUpVotes", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "setGoal", + "inputs": [ + { + "name": "goal", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "getGoal", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "receiveDonation", + "inputs": [ + { + "name": "strks", + "type": "core::integer::u256" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_current_goal_state", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "setState", + "inputs": [ + { + "name": "state", + "type": "core::integer::u8" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "getState", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u8" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "getVoter", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "withdraw", + "inputs": [], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "set_evidence_link", + "inputs": [ + { + "name": "evidence", + "type": "core::byte_array::ByteArray" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_evidence_link", + "inputs": [], + "outputs": [ + { + "type": "core::byte_array::ByteArray" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_contact_handle", + "inputs": [ + { + "name": "contact_handle", + "type": "core::byte_array::ByteArray" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "get_contact_handle", + "inputs": [], + "outputs": [ + { + "type": "core::byte_array::ByteArray" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "id", + "type": "core::integer::u128" + }, + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "name", + "type": "core::byte_array::ByteArray" + }, + { + "name": "goal", + "type": "core::integer::u256" + }, + { + "name": "evidence_link", + "type": "core::byte_array::ByteArray" + }, + { + "name": "contact_handle", + "type": "core::byte_array::ByteArray" + }, + { + "name": "reason", + "type": "core::byte_array::ByteArray" + } + ] + }, + { + "type": "event", + "name": "gostarkme::fund::Fund::DonationWithdraw", + "kind": "struct", + "members": [ + { + "name": "owner_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "fund_contract_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "withdrawn_amount", + "type": "core::integer::u256", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "gostarkme::fund::Fund::NewVoteReceived", + "kind": "struct", + "members": [ + { + "name": "voter", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "fund", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "votes", + "type": "core::integer::u32", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "gostarkme::fund::Fund::DonationReceived", + "kind": "struct", + "members": [ + { + "name": "donator_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "current_balance", + "type": "core::integer::u256", + "kind": "data" + }, + { + "name": "donated_strks", + "type": "core::integer::u256", + "kind": "data" + }, + { + "name": "fund_contract_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "gostarkme::fund::Fund::Event", + "kind": "enum", + "variants": [ + { + "name": "DonationWithdraw", + "type": "gostarkme::fund::Fund::DonationWithdraw", + "kind": "nested" + }, + { + "name": "NewVoteReceived", + "type": "gostarkme::fund::Fund::NewVoteReceived", + "kind": "nested" + }, + { + "name": "DonationReceived", + "type": "gostarkme::fund::Fund::DonationReceived", + "kind": "nested" + } + ] + } +] \ No newline at end of file diff --git a/frontend/gostarkme-web/contracts/abis/fundManager.ts b/frontend/gostarkme-web/contracts/abis/fundManager.ts index e5fa5d3..37f60f9 100644 --- a/frontend/gostarkme-web/contracts/abis/fundManager.ts +++ b/frontend/gostarkme-web/contracts/abis/fundManager.ts @@ -1,108 +1,166 @@ export const fundManager = [ - { - "type": "impl", - "name": "FundManagerImpl", - "interface_name": "gostarkme::fundManager::IFundManager" - }, - { - "type": "struct", - "name": "core::integer::u256", - "members": [ - { - "name": "low", - "type": "core::integer::u128" - }, - { - "name": "high", - "type": "core::integer::u128" - } - ] - }, - { - "type": "interface", - "name": "gostarkme::fundManager::IFundManager", - "items": [ - { - "type": "function", - "name": "newFund", - "inputs": [ - { - "name": "name", - "type": "core::felt252" - }, - { - "name": "goal", - "type": "core::integer::u256" - } - ], - "outputs": [], - "state_mutability": "external" - }, - { - "type": "function", - "name": "getCurrentId", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u128" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "getFund", - "inputs": [ - { - "name": "id", - "type": "core::integer::u128" - } - ], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "getOwner", - "inputs": [], - "outputs": [ - { - "type": "core::starknet::contract_address::ContractAddress" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "getFundClassHash", - "inputs": [], - "outputs": [ - { - "type": "core::starknet::class_hash::ClassHash" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "constructor", - "name": "constructor", - "inputs": [ - { - "name": "fund_class_hash", - "type": "core::felt252" - } - ] - }, - { - "type": "event", - "name": "gostarkme::fundManager::FundManager::Event", - "kind": "enum", - "variants": [] - } - ] \ No newline at end of file + { + "type": "impl", + "name": "FundManagerImpl", + "interface_name": "gostarkme::fundManager::IFundManager" + }, + { + "type": "struct", + "name": "core::byte_array::ByteArray", + "members": [ + { + "name": "data", + "type": "core::array::Array::" + }, + { + "name": "pending_word", + "type": "core::felt252" + }, + { + "name": "pending_word_len", + "type": "core::integer::u32" + } + ] + }, + { + "type": "struct", + "name": "core::integer::u256", + "members": [ + { + "name": "low", + "type": "core::integer::u128" + }, + { + "name": "high", + "type": "core::integer::u128" + } + ] + }, + { + "type": "interface", + "name": "gostarkme::fundManager::IFundManager", + "items": [ + { + "type": "function", + "name": "newFund", + "inputs": [ + { + "name": "name", + "type": "core::byte_array::ByteArray" + }, + { + "name": "goal", + "type": "core::integer::u256" + }, + { + "name": "evidence_link", + "type": "core::byte_array::ByteArray" + }, + { + "name": "contact_handle", + "type": "core::byte_array::ByteArray" + }, + { + "name": "reason", + "type": "core::byte_array::ByteArray" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "getCurrentId", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "getFund", + "inputs": [ + { + "name": "id", + "type": "core::integer::u128" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "getOwner", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "getFundClassHash", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::class_hash::ClassHash" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "fund_class_hash", + "type": "core::felt252" + } + ] + }, + { + "type": "event", + "name": "gostarkme::fundManager::FundManager::FundDeployed", + "kind": "struct", + "members": [ + { + "name": "owner", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "key" + }, + { + "name": "fund_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "fund_id", + "type": "core::integer::u128", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "gostarkme::fundManager::FundManager::Event", + "kind": "enum", + "variants": [ + { + "name": "FundDeployed", + "type": "gostarkme::fundManager::FundManager::FundDeployed", + "kind": "nested" + } + ] + } +] \ No newline at end of file