Skip to content

Commit

Permalink
all points in issues #246 & #247 except voting weights
Browse files Browse the repository at this point in the history
  • Loading branch information
ndkazu committed Feb 18, 2023
1 parent 01c9339 commit 8fd7e3f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion pallets/asset_management/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ impl<T: Config> Pallet<T> {

//check how many rents were payed
let payed = (time as u128 - remaining_p as u128) * rent.clone();
let asset_account = tenant.asset_account.unwrap();
let asset_account = tenant.asset_account.clone().unwrap();
let asset_account_free_balance =
<T as Config>::Currency::free_balance(&asset_account);

Expand Down Expand Up @@ -337,6 +337,15 @@ impl<T: Config> Pallet<T> {
//Reserve maintenance fees
let reservation =
<T as Config>::Currency::reserve(&asset_account, maintenance.into());

//Emmit maintenance fee payment event
Self::deposit_event(Event::MaintenanceFeesPayment {
tenant: tenant.account_id.clone(),
when: now,
asset_account: tenant.asset_account.unwrap(),
amount: maintenance.clone(),

});

debug_assert!(reservation.is_ok());

Expand Down
9 changes: 9 additions & 0 deletions pallets/asset_management/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ pub mod pallet {
amount: Payment::BalanceOf<T>,
when: BlockNumberOf<T>,
},

//Asset maintenance fees, have been taken from the rent received, and reserved
MaintenanceFeesPayment
{
tenant: T::AccountId,
when: BlockNumberOf<T>,
asset_account: T::AccountId,
amount: BalanceOf<T>,
},
}

// Errors inform users that something went wrong.
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ parameter_types! {

impl frame_system::Config for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = frame_support::traits::Everything;
type BaseCallFilter = DontAllowCollectiveAndDemocracy;
/// Block & extrinsics weights: base values and limits.
type BlockWeights = RuntimeBlockWeights;
/// The maximum length of a block (in bytes).
Expand Down

0 comments on commit 8fd7e3f

Please sign in to comment.