Skip to content
Closed
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: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions contracts/dao_governance/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// src/clients.rs
use soroban_sdk::{Address, Env, Symbol};
use soroban_sdk::{Address, Env};

/// A client for the reputation contract.
pub struct ReputationClient<'a> {
Expand All @@ -14,7 +14,7 @@ impl<'a> ReputationClient<'a> {

/// Calls the reputation contract to get the reputation score for a given voter.
/// Assumes the reputation contract has a function named `get_reputation` that takes an Address and returns a u128.
pub fn get_reputation(&self, voter: &Address) -> u64 {
pub fn get_reputation(&self, _voter: &Address) -> u64 {
// In a real implementation, you’d invoke the contract.
// For example, if you had a generated client or using env.invoke_contract:
// self.env.invoke_contract(self.contract_id, &Symbol::short("get_rep"), voter)
Expand All @@ -37,7 +37,7 @@ impl<'a> ERC721Client<'a> {

/// Calls the ERC721 contract to get the NFT balance (voting power) for a given owner.
/// Assumes the ERC721 contract exposes a function named `balance_of` returning a u128.
pub fn balance_of(&self, owner: &Address) -> u64 {
pub fn balance_of(&self, _owner: &Address) -> u64 {
// Similar to the ReputationClient, you would call the contract.
// For illustration, we'll return a dummy value.
5 // dummy NFT balance (voting power)
Expand Down
3 changes: 1 addition & 2 deletions contracts/dao_governance/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::types::{Proposal, ProposalStatus, Vote, VoteType};
use soroban_sdk::{symbol_short, Address, Env, Symbol, Val, Vec};
use soroban_sdk::{symbol_short, Address, Env, Symbol};

const PROPOSAL_CREATED: Symbol = symbol_short!("PROP_CRT");
const VOTE_CAST: Symbol = symbol_short!("VOTE_CST");
Expand Down
6 changes: 3 additions & 3 deletions contracts/dao_governance/src/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use crate::events::{
emit_proposal_created, emit_proposal_executed, emit_proposal_finalized, emit_vote_cast,
};
use crate::storage::{
get_config, get_proposal, get_proposal_count, has_voted, increment_proposal_count,
get_config, get_proposal, has_voted, increment_proposal_count,
save_proposal, save_vote,
};
use crate::types::{DaoError, Proposal, ProposalStatus, ProposalType, Vote, VoteType};
use core::cmp::max;
use soroban_sdk::{Address, Env, String, Vec};
use soroban_sdk::{Address, Env, String};

pub fn create_proposal(
env: &Env,
Expand Down Expand Up @@ -118,7 +118,7 @@ pub fn finalize_proposal(env: &Env, proposal_id: u32) -> Result<(), DaoError> {
}

let total_votes = proposal.upvotes + proposal.downvotes;
let config = get_config(env);
let _config = get_config(env);
if total_votes < proposal.minimum_quorum {
proposal.status = ProposalStatus::Rejected;
save_proposal(env, &proposal);
Expand Down
4 changes: 2 additions & 2 deletions contracts/dao_governance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod governance;
mod storage;
mod types;

use types::{DaoConfig, DaoError, Proposal, ProposalStatus, ProposalType, VoteType};
use types::{DaoConfig, DaoError, Proposal, ProposalType, VoteType};

#[contract]
pub struct DaoContract;
Expand Down Expand Up @@ -88,7 +88,7 @@ impl DaoContract {
}

// Finalize a proposal
pub fn finalize_proposal(env: Env, caller: Address, proposal_id: u32) -> Result<(), DaoError> {
pub fn finalize_proposal(env: Env, _caller: Address, proposal_id: u32) -> Result<(), DaoError> {
governance::finalize_proposal(&env, proposal_id)
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/dao_governance/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use soroban_sdk::{contracterror, contracttype, Address, String, Vec};
use soroban_sdk::{contracterror, contracttype, Address, String};

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
#[repr(u32)]
Expand Down
2 changes: 1 addition & 1 deletion contracts/nft-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]
crate-type = ["cdylib", "rlib"]
doctest = false

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion contracts/nft-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_std]
use soroban_sdk::{contract, contractimpl, Address, Env, String, Vec};

mod types;
pub mod types;
mod storage;
mod minting;
mod admin;
Expand Down
10 changes: 9 additions & 1 deletion contracts/nft-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,12 @@ pub enum NFTError {
InvalidRecipient = 18,
BatchTooLarge = 19,
ContractError = 20,
}


IDInvalid = 21,
BadgeNotFound = 22,
OrganizationNotAuthorized = 23,
MetadataInvalid = 24,
TokenCannotBeTransferred = 25,
UnauthorizedOwner = 26,
}
1 change: 1 addition & 0 deletions contracts/recognition-system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ doctest = false

[dependencies]
soroban-sdk = { workspace = true }
nft-core = { path = "../nft-core" }
reputation-system = { path = "../reputation-system" }

[dev-dependencies]
Expand Down
16 changes: 1 addition & 15 deletions contracts/recognition-system/src/datatype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,4 @@ pub enum AdminError {
UnauthorizedSender = 2,
}

/// @notice NFT-related error codes
#[contracterror]
#[derive(Debug, Clone, PartialEq)]
pub enum NFTError {
IDExists = 1,
IDInvalid = 2,
UnauthorizedOwner = 3,
BadgeNotFound = 4,
VolunteerNotEndorsed = 5,
OrganizationNotAuthorized = 6,
MetadataInvalid = 7,
EventNotFound = 8,
TokenCannotBeTransferred = 9,
OperationNotPermitted = 10,
}

4 changes: 3 additions & 1 deletion contracts/recognition-system/src/distribution.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use nft_core::NFTError;
use crate::{
datatype::{NFTError, RecognitionNFT},
datatype::RecognitionNFT,
interfaces::DistributionOperations,
RecognitionSystemContract,
};

use soroban_sdk::{Address, Env, Map, Symbol, Vec};

impl DistributionOperations for RecognitionSystemContract {
Expand Down
3 changes: 2 additions & 1 deletion contracts/recognition-system/src/interfaces.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::datatype::{NFTError, NFTMetadata};
use crate::datatype::{AdminError, DataKeys, NFTMetadata, RecognitionNFT};
use nft_core::NFTError;
use soroban_sdk::{Address, Env, String};

#[allow(dead_code)]
Expand Down
Loading