This document tracks all smart contract development tasks for the StellarGuard multi-sig treasury and DAO governance platform.
When you complete an issue:
- Mark the checkbox
[x] - Append your GitHub username and the Date/Time.
- Example:
- [x] Define Error enum (@yourname - 2026-02-20 15:00 UTC)
Priority: Critical
Labels: smart-contract, good-first-issue
Description: Initialize the Soroban workspace and define core error codes shared across contracts.
- Tasks:
- Verify
Cargo.tomlworkspace structure with all 4 contract crates. - Define
Errorenum in treasury contract with all error variants:NotInitialized(1),AlreadyInitialized(2),Unauthorized(3)InvalidAmount(4),InsufficientFunds(5),InvalidThreshold(6)
- Setup
Cargo.tomlwithsoroban-sdkv21.7.6 for each crate. - Ensure all crates compile with
cargo build --all.
- Verify
Priority: Critical
Labels: smart-contract, config
Description: Define the DataKey enums for all four contracts to manage on-chain state.
- Tasks:
- Define
DataKeyenum fortreasurycontract:Admin,Threshold,Signers,Balance,Transaction(u64),TxCounter,Initialized. - Define
DataKeyenum forgovernancecontract:Admin,Initialized,Members,QuorumPercent,VotingPeriod,ProposalCounter,Proposal(u64),Vote(u64, Address). - Define
DataKeyenum fortoken-vaultcontract:Admin,Initialized,EmergencySigners,EmergencyThreshold,LockCounter,Lock(u64),VestingCounter,Vesting(u64),TotalLocked. - Define
DataKeyenum foraccess-controlcontract:Initialized,Owner,Role(Address),AllMembers,RoleCount(u32).
- Define
Priority: High
Labels: smart-contract, core
Description: Implement the initialize function for the treasury contract.
- Tasks:
- Implement
initialize(env, admin, threshold, signers). - Validate threshold: must be > 0 and <= signer count.
- Prevent re-initialization with
AlreadyInitializedcheck. - Store admin, threshold, signers, balance (0), and tx counter (0) in
Instancestorage. - Emit
(treasury, init)event with admin, threshold, and signer count.
- Implement
Priority: Critical
Labels: smart-contract, types
Description: Define the hierarchical role system for access control.
- Tasks:
- Define
Roleenum:Viewer (1),Member (2),Admin (3),Owner (4). - Define
RoleAssignmentstruct:address,role,assigned_at,assigned_by. - Define
AccessSummarystruct for query responses. - Implement
initialize(env, owner)β sets owner role and initializes state.
- Define
Priority: High
Labels: smart-contract, core
Description: Implement the initialize function for the governance contract.
- Tasks:
- Implement
initialize(env, admin, members, quorum_percent, voting_period). - Store all governance parameters in
Instancestorage. - Validate quorum_percent is between 1 and 100.
- Emit
(gov, init)event.
- Implement
Priority: High
Labels: smart-contract, logic
Description: Implement the deposit function for the treasury.
- Tasks:
- Implement
deposit(env, from, amount). - Require
from.require_auth(). - Validate amount > 0.
- Update balance in
Instancestorage. - Emit
(treasury, deposit)event with from, amount, new_balance.
- Implement
Priority: Medium
Labels: smart-contract, logic, enhancement
Description: Extend deposits to support Soroban token contracts (SAC/custom tokens).
- Tasks:
- Add
token_addressparameter to deposit function or create separate function. - Use
soroban-sdktoken client to invoketransferfrom depositor to contract. - Track balances per token address.
- Emit event with token address included.
- Add
Priority: High
Labels: smart-contract, logic
Description: Implement the propose_withdrawal function.
- Tasks:
- Implement
propose_withdrawal(env, proposer, to, amount, memo). (@sshdopey - 2026-03-25 16:16 UTC) - Verify proposer is an authorized signer via
require_signerhelper. (@sshdopey - 2026-03-25 16:16 UTC) - Check sufficient balance exists. (@sshdopey - 2026-03-25 16:16 UTC)
- Auto-include proposer as first approval. (@sshdopey - 2026-03-25 16:16 UTC)
- Store
Transactionstruct inPersistentstorage. (@sshdopey - 2026-03-25 16:16 UTC) - Emit
(treasury, propose)event. (@sshdopey - 2026-03-25 16:16 UTC)
- Implement
Priority: Critical
Labels: smart-contract, logic
Description: Implement the approve function for multi-sig transaction approval.
- Tasks:
- Implement
approve(env, signer, tx_id). - Verify signer is authorized.
- Check transaction exists and is not already executed.
- Prevent duplicate approvals from same signer.
- Add signer to approvals list.
- Return current approval count.
- Emit
(treasury, approve)event.
- Implement
Priority: Critical
Labels: smart-contract, logic
Description: Implement the execute function to process approved withdrawals.
- Tasks:
- Implement
execute(env, executor, tx_id). - Check approval count meets threshold.
- Deduct balance from treasury.
- Mark transaction as executed.
- Emit
(treasury, execute)event with recipient and amount.
- Implement
Priority: Medium
Labels: smart-contract, query
Description: Implement read-only query functions for the treasury.
- Tasks:
- Implement
get_balance(env) -> i128. - Implement
get_config(env) -> TreasuryConfig. - Implement
get_transaction(env, tx_id) -> Transaction. - Implement
get_signers(env) -> Vec<Address>.
- Implement
Priority: Medium
Labels: smart-contract, events, integration
Description: Ensure all treasury actions emit properly structured events for indexing.
- Tasks:
- Verify
(treasury, init)event structure. - Verify
(treasury, deposit)event includes from, amount, new_balance. - Verify
(treasury, propose)event includes tx_id, proposer, to, amount. - Verify
(treasury, approve)event includes tx_id, signer, approval_count. - Verify
(treasury, execute)event includes tx_id, to, amount, new_balance. - Document event schemas in
docs/SMARTCONTRACT_GUIDE.md.
- Verify
Priority: Critical
Labels: smart-contract, types
Description: Define proposal data structures and action types.
- Tasks:
- Define
ProposalActionenum:Funding,PolicyChange,AddMember,RemoveMember,General. - Define
ProposalStatusenum:Active,Passed,Rejected,Executed,Expired. - Define
Proposalstruct with all fields. - Define
GovConfigstruct for query responses.
- Define
Priority: High
Labels: smart-contract, logic
Description: Implement proposal creation for DAO governance.
- Tasks:
- Implement
create_proposal(env, proposer, title, description, action, amount, target). - Require proposer is a DAO member.
- Calculate
ends_at = current_ledger + voting_period. - Store proposal in
Persistentstorage. - Emit
(gov, propose)event.
- Implement
Priority: High
Labels: smart-contract, logic
Description: Implement the voting mechanism for proposals.
- Tasks:
- Implement
vote(env, voter, proposal_id, vote_for). - Require voter is a DAO member.
- Prevent double voting using
Vote(proposal_id, voter)storage key. - Check proposal is
Activeand voting period hasn't ended. - Increment
votes_fororvotes_against. - Emit
(gov, vote)event.
- Implement
Priority: High
Labels: smart-contract, logic
Description: Implement proposal finalization with quorum logic.
- Tasks:
- Implement
finalize(env, caller, proposal_id). - Ensure voting period has ended (
current_ledger > ends_at). - Calculate quorum:
(member_count * quorum_percent) / 100. - Set status to
Expiredif quorum not met. - Set status to
Passedifvotes_for > votes_against. - Set status to
Rejectedotherwise.
- Implement
Priority: Medium
Labels: smart-contract, logic
Description: Implement proposal execution for passed proposals.
- Tasks:
- Implement
execute_proposal(env, executor, proposal_id). - Only admin or proposer can execute.
- Handle
AddMemberaction: add target to members list. - Handle
RemoveMemberaction: remove target from members list. - Mark proposal as
Executed. - Emit
(gov, exec)event.
- Implement
Priority: Medium
Labels: smart-contract, query
Description: Implement read-only query functions for governance.
- Tasks:
- Implement
get_proposal(env, proposal_id). - Implement
get_config(env) -> GovConfig. - Implement
get_members(env) -> Vec<Address>. - Implement
has_voted(env, proposal_id, voter) -> bool.
- Implement
Priority: High
Labels: smart-contract, logic
Description: Implement time-based token locking.
- Tasks:
- Implement
lock_tokens(env, owner, amount, duration, memo). - Create
TokenLockstruct with id, owner, amount, locked_at, unlock_at, claimed, memo. - Generate sequential lock IDs.
- Update
TotalLockedcounter. - Emit
(vault, lock)event.
- Implement
Priority: High
Labels: smart-contract, logic
Description: Implement vesting schedules with cliff periods.
- Tasks:
- Implement
create_vesting(env, admin, beneficiary, total_amount, duration, cliff, memo). (@Chucks1093 - 2026-03-25 23:06 UTC) - Implement
claim_vested(env, beneficiary, vesting_id). (@Chucks1093 - 2026-03-25 23:06 UTC) - Calculate vested amount:
(total_amount * elapsed) / duration. (@Chucks1093 - 2026-03-25 23:06 UTC) - Enforce cliff period: no claims before
start_time + cliff. (@Chucks1093 - 2026-03-25 23:06 UTC) - Track
claimed_amountto prevent over-claiming. (@Chucks1093 - 2026-03-25 23:06 UTC) - Emit
(vault, vest)and(vault, v_claim)events. (@Chucks1093 - 2026-03-25 23:06 UTC)
- Implement
Priority: Medium
Labels: smart-contract, logic
Description: Implement multi-sig emergency unlock for locked tokens.
- Tasks:
- Implement
approve_emergency(env, signer, lock_id). (@sshdopey - 2026-03-25 16:45 UTC) - Verify signer is an emergency signer. (@sshdopey - 2026-03-25 16:45 UTC)
- Track per-lock emergency approvals. (@sshdopey - 2026-03-25 16:45 UTC)
- Implement
emergency_unlock(env, caller, lock_id). (@sshdopey - 2026-03-25 16:45 UTC) - Check approval count meets
EmergencyThreshold. (@sshdopey - 2026-03-25 16:45 UTC) - Release locked tokens. (@sshdopey - 2026-03-25 16:45 UTC)
- Emit
(vault, emrg_ap)and(vault, emrg_ex)events. (@sshdopey - 2026-03-25 16:45 UTC)
- Implement
Priority: High
Labels: smart-contract, testing
Description: Comprehensive unit tests for the treasury contract.
- Tasks:
- Test
initializewith valid and invalid thresholds. - Test
depositwith valid and invalid amounts. - Test
propose_withdrawalby authorized signer and non-signer. - Test
approveβ single and multi-approval flows. - Test
executeβ threshold met and not met scenarios. - Test
add_signerandremove_signer. - Test
set_thresholdvalidation. - Test
transfer_admin.
- Test
Priority: High
Labels: smart-contract, testing
Description: Comprehensive unit tests for the governance contract.
- Tasks:
- Test
initializewith member list and quorum. - Test
create_proposalfor all action types. - Test
voteβ for, against, and double-vote prevention. - Test
finalizeβ quorum met, quorum not met, voting still active. - Test
execute_proposalβ AddMember and RemoveMember actions. - Test
transfer_adminandset_quorum.
- Test
Priority: Medium
Labels: smart-contract, testing
Description: Comprehensive unit tests for the access control contract.
- Tasks:
- Test
initializeβ owner gets Owner role. - Test
assign_roleβ privilege escalation prevention. - Test
revoke_roleβ cannot remove owner. - Test
has_permission,is_owner,is_admin_or_above,is_member_or_above. - Test
transfer_ownershipβ old owner demoted to admin.
- Test
Priority: High
Labels: smart-contract, testing, integration
Description: End-to-end tests simulating real multi-contract workflows.
- Tasks:
- Test full treasury workflow: init β deposit β propose β approve β execute.
- Test full governance workflow: init β propose β vote β finalize β execute.
- Test token vault workflow: lock β wait β claim.
- Test vesting workflow: create β cliff β partial claim β full claim.
- Test emergency unlock workflow: approve Γ threshold β unlock.
- Verify all events are emitted correctly throughout workflows.
(Move completed items here)