Skip to content

Commit 173e2eb

Browse files
committed
fix(ci): resolve lending build failure and clippy/format issues
- lending: move misplaced #[ink(storage)] attribute from above marketplace types to directly above pub struct PropertyLending (was unblocking the lending build) - lending: drop unused LoanPortfolio struct (and its #[allow(dead_code)] stop-gap) since it is never constructed anywhere in the codebase - traits/oracle: remove blank line between trait-section header comment block and pub trait Oracle to satisfy clippy::empty_line_after_outer_attr Verified locally: cargo clippy --features std -- -D warnings clean, cargo test --features std reports 30/30 passing on lending, cargo fmt --check clean.
1 parent f8d78ad commit 173e2eb

2 files changed

Lines changed: 17 additions & 38 deletions

File tree

contracts/lending/src/lib.rs

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -202,23 +202,6 @@ mod propchain_lending {
202202
pub borrower_approved: bool,
203203
pub lender_approved: bool,
204204
}
205-
206-
#[derive(
207-
Debug, Clone, PartialEq, scale::Encode, scale::Decode, ink::storage::traits::StorageLayout,
208-
)]
209-
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
210-
pub struct LoanPortfolio {
211-
pub owner: AccountId,
212-
pub loan_ids: Vec<u64>,
213-
pub total_loans: u32,
214-
pub approved_loans: u32,
215-
pub pending_loans: u32,
216-
pub total_requested: u128,
217-
pub total_approved: u128,
218-
pub total_collateral: u128,
219-
pub average_credit_score: u32,
220-
}
221-
222205
#[derive(
223206
Debug, Clone, PartialEq, scale::Encode, scale::Decode, ink::storage::traits::StorageLayout,
224207
)]
@@ -260,12 +243,17 @@ mod propchain_lending {
260243
pub total_borrowed: u128,
261244
}
262245

263-
#[ink(storage)]
264246
// ── #304: Loan Marketplace types ─────────────────────────────────────────
265247

266248
/// Status of a loan marketplace listing.
267249
#[derive(
268-
Debug, Clone, Copy, PartialEq, Eq, scale::Encode, scale::Decode,
250+
Debug,
251+
Clone,
252+
Copy,
253+
PartialEq,
254+
Eq,
255+
scale::Encode,
256+
scale::Decode,
269257
ink::storage::traits::StorageLayout,
270258
)]
271259
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
@@ -282,8 +270,7 @@ mod propchain_lending {
282270

283271
/// A borrower's public loan request listed on the marketplace (#304).
284272
#[derive(
285-
Debug, Clone, PartialEq, scale::Encode, scale::Decode,
286-
ink::storage::traits::StorageLayout,
273+
Debug, Clone, PartialEq, scale::Encode, scale::Decode, ink::storage::traits::StorageLayout,
287274
)]
288275
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
289276
pub struct LoanListing {
@@ -303,8 +290,7 @@ mod propchain_lending {
303290

304291
/// A lender's counter-offer in response to a marketplace listing (#304).
305292
#[derive(
306-
Debug, Clone, PartialEq, scale::Encode, scale::Decode,
307-
ink::storage::traits::StorageLayout,
293+
Debug, Clone, PartialEq, scale::Encode, scale::Decode, ink::storage::traits::StorageLayout,
308294
)]
309295
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo))]
310296
pub struct LoanOffer {
@@ -319,6 +305,7 @@ mod propchain_lending {
319305
pub created_at: u64,
320306
}
321307

308+
#[ink(storage)]
322309
pub struct PropertyLending {
323310
admin: AccountId,
324311
collateral_records: Mapping<u64, CollateralRecord>,
@@ -1334,10 +1321,7 @@ mod propchain_lending {
13341321
/// Accepting an offer transitions the listing to `OfferAccepted`, creates
13351322
/// the underlying `LoanApplication`, and marks the listing as `Originated`.
13361323
#[ink(message)]
1337-
pub fn accept_loan_offer(
1338-
&mut self,
1339-
offer_id: u64,
1340-
) -> Result<u64, LendingError> {
1324+
pub fn accept_loan_offer(&mut self, offer_id: u64) -> Result<u64, LendingError> {
13411325
let mut offer = self
13421326
.marketplace_offers
13431327
.get(offer_id)
@@ -1389,7 +1373,8 @@ mod propchain_lending {
13891373
listing.accepted_offer_id = Some(offer_id);
13901374

13911375
self.marketplace_offers.insert(offer_id, &offer);
1392-
self.marketplace_listings.insert(listing.listing_id, &listing);
1376+
self.marketplace_listings
1377+
.insert(listing.listing_id, &listing);
13931378

13941379
self.env().emit_event(LoanOfferAccepted {
13951380
listing_id: offer.listing_id,
@@ -1461,10 +1446,7 @@ mod propchain_lending {
14611446
/// Only the current admin may call this. The nominated `new_admin` must
14621447
/// confirm after `KEY_ROTATION_COOLDOWN_BLOCKS` blocks have elapsed.
14631448
#[ink(message)]
1464-
pub fn request_admin_rotation(
1465-
&mut self,
1466-
new_admin: AccountId,
1467-
) -> Result<(), LendingError> {
1449+
pub fn request_admin_rotation(&mut self, new_admin: AccountId) -> Result<(), LendingError> {
14681450
let caller = self.env().caller();
14691451
if caller != self.admin {
14701452
return Err(LendingError::Unauthorized);
@@ -1474,8 +1456,8 @@ mod propchain_lending {
14741456
}
14751457

14761458
let block = self.env().block_number();
1477-
let effective_at = block
1478-
.saturating_add(propchain_traits::constants::KEY_ROTATION_COOLDOWN_BLOCKS);
1459+
let effective_at =
1460+
block.saturating_add(propchain_traits::constants::KEY_ROTATION_COOLDOWN_BLOCKS);
14791461

14801462
self.pending_admin_rotation = Some(propchain_traits::KeyRotationRequest {
14811463
old_account: caller,
@@ -1558,9 +1540,7 @@ mod propchain_lending {
15581540

15591541
/// Get the pending admin rotation request, if any.
15601542
#[ink(message)]
1561-
pub fn get_pending_admin_rotation(
1562-
&self,
1563-
) -> Option<propchain_traits::KeyRotationRequest> {
1543+
pub fn get_pending_admin_rotation(&self) -> Option<propchain_traits::KeyRotationRequest> {
15641544
self.pending_admin_rotation.clone()
15651545
}
15661546

contracts/traits/src/oracle.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ pub struct OracleHistoryStatistics {
373373
/// ========================================================================
374374
// Trait Definitions
375375
// =========================================================================
376-
377376
/// Oracle trait for real-time property valuation
378377
#[ink::trait_definition]
379378
pub trait Oracle {

0 commit comments

Comments
 (0)