-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: apply workspace #1609 to pool-fees dummy
- Loading branch information
Showing
5 changed files
with
108 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,37 @@ | ||
[package] | ||
authors = ["Centrifuge <[email protected]>"] | ||
description = "Pool Fees Pallet" | ||
edition = "2021" | ||
license = "LGPL-3.0" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
homepage.workspace = true | ||
documentation.workspace = true | ||
name = "pallet-pool-fees" | ||
repository = "https://github.com/centrifuge/centrifuge-chain" | ||
version = "0.1.0" | ||
description = "Pool Fees Pallet" | ||
version = "0.0.1" | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } | ||
log = { version = "0.4.0", default-features = false } | ||
scale-info = { version = "2.3.0", default-features = false, features = ["derive"] } | ||
[dev-dependencies] | ||
|
||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" } | ||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" } | ||
[dependencies] | ||
codec = { package = "parity-scale-codec", workspace = true, features = ["derive"] } | ||
log = { workspace = true } | ||
scale-info = { workspace = true, features = ["derive"] } | ||
|
||
cfg-primitives = { path = "../../libs/primitives", default-features = false } | ||
cfg-traits = { path = "../../libs/traits", default-features = false } | ||
cfg-types = { path = "../../libs/types", default-features = false } | ||
frame-benchmarking.workspace = true | ||
frame-support.workspace = true | ||
frame-system.workspace = true | ||
pallet-timestamp.workspace = true | ||
sp-arithmetic.workspace = true | ||
sp-core.workspace = true | ||
sp-io.workspace = true | ||
sp-runtime.workspace = true | ||
sp-std.workspace = true | ||
|
||
[dev-dependencies] | ||
bitflags = "1.3" | ||
cfg-primitives.workspace = true | ||
cfg-traits.workspace = true | ||
cfg-types.workspace = true | ||
|
||
[features] | ||
default = ["std"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright 2023 Centrifuge Foundation (centrifuge.io). | ||
|
||
// Centrifuge is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version (see http://www.gnu.org/licenses). | ||
|
||
// Centrifuge is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
use cfg_primitives::{AccountId, LoanId}; | ||
use codec::{Decode, Encode, MaxEncodedLen}; | ||
use frame_support::dispatch::TypeInfo; | ||
|
||
#[derive(Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] | ||
enum FeeRate<Rate> { | ||
ShareOfPortfolioValuation(Rate), | ||
// Future options: AmountPerYear, AmountPerMonth, ... | ||
} | ||
|
||
#[derive(Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] | ||
|
||
enum FeeAmount<Rate> { | ||
/// A fixed fee is deducted automatically every epoch | ||
Fixed { amount: FeeRate<Rate> }, | ||
|
||
/// A fee can be charged up to a limit, paid every epoch | ||
ChargedUpTo { limit: FeeRate<Rate> }, | ||
} | ||
|
||
#[derive(Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] | ||
|
||
enum FeeEditor<AccountId> { | ||
Root, | ||
Account(AccountId), | ||
} | ||
|
||
#[derive(Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] | ||
|
||
enum FeeBucket { | ||
/// Fees that are charged first, before any redemptions, investments, | ||
/// repayments or originations | ||
Top, | ||
// Future: AfterTranche(TrancheId) | ||
} | ||
|
||
#[derive(Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] | ||
|
||
struct Fee<AccountId, Rate> { | ||
/// Account that the fees are sent to | ||
pub destination: AccountId, | ||
|
||
/// Account that can update this fee | ||
pub editor: FeeEditor<AccountId>, | ||
|
||
/// Amount of fees that can be charged | ||
pub amount: FeeAmount<Rate>, | ||
} | ||
|
||
// NOTE: Remark feature will be a separate feature in the future (post Pool Fees | ||
// MVP). The following enum is necessary to deliver the MVP. | ||
#[derive(Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] | ||
|
||
enum Remark<Hash, LoanId, Meta> { | ||
Loan { id: LoanId, meta: Meta }, | ||
IpfsHash(Hash), | ||
Metadata(Meta), | ||
} | ||
|
||
type IpfsHash = [u8; 46]; |