Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/contracts/group_treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ impl GroupTreasuryContract {

TokenClient::new(&env, &token_id).balance(&env.current_contract_address())
}
}
}
2 changes: 1 addition & 1 deletion contracts/contracts/group_treasury/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ pub struct DepositEvent {
pub struct WithdrawEvent {
pub to: Address,
pub amount: i128,
}
}
2 changes: 1 addition & 1 deletion contracts/contracts/group_treasury/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ fn test_deposit_zero_panics() {
let (contract_id, _token_id, _admin, member) = setup(&env);
let client = GroupTreasuryContractClient::new(&env, &contract_id);
client.deposit(&member, &0);
}
}
2 changes: 1 addition & 1 deletion contracts/contracts/group_treasury/src/token_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ use soroban_sdk::{contractclient, Address, Env};
pub trait TokenInterface {
fn transfer(env: Env, from: Address, to: Address, amount: i128);
fn balance(env: Env, id: Address) -> i128;
}
}
2 changes: 1 addition & 1 deletion contracts/contracts/proposals/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,4 @@ impl ProposalsContract {
}
}

mod test;
mod test;
45 changes: 45 additions & 0 deletions contracts/contracts/proposals/src/storage.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use soroban_sdk::{contracttype, Address, String};

#[contracttype]
#[derive(Clone)]
pub struct Proposal {
pub proposer: Address,
pub description: String,
pub amount: i128,
pub recipient: Address,
pub yes_votes: u32,
pub no_votes: u32,
/// Unix timestamp (seconds) when the voting period closes.
pub end_time: u64,
pub executed: bool,
}

#[contracttype]
pub enum DataKey {
Admin,
Treasury,
NextId,
Proposal(u32),
/// Tracks whether a given voter has already voted on a proposal.
Voted(u32, Address),
}

#[contracttype]
pub struct ProposalCreatedEvent {
pub id: u32,
pub proposer: Address,
pub amount: i128,
}

#[contracttype]
pub struct VoteCastEvent {
pub proposal_id: u32,
pub voter: Address,
pub approve: bool,
}

#[contracttype]
pub struct ProposalExecutedEvent {
pub proposal_id: u32,
pub passed: bool,
}
2 changes: 1 addition & 1 deletion contracts/contracts/proposals/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ fn create_with_past_expiry_panics() {
// expires_at == now → not in the future → panic.
let desc = String::from_str(&env, "x");
client.create_proposal(&alice, &desc, &env.ledger().timestamp());
}
}
7 changes: 7 additions & 0 deletions contracts/contracts/proposals/src/treasury_interface.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use soroban_sdk::{contractclient, Address, Env};

/// Minimal interface for calling the group treasury contract.
#[contractclient(name = "TreasuryClient")]
pub trait TreasuryInterface {
fn withdraw(env: Env, to: Address, amount: i128);
}
Loading