Skip to content

Commit

Permalink
0.7.7 reservoir (#347)
Browse files Browse the repository at this point in the history
* temp save

* temp save

* feat: add new pallet reservoir

* feat: expire event

* feat: adaptation reservoir
  • Loading branch information
ytqaljn authored May 10, 2024
1 parent 1fb60b2 commit 42ef77c
Show file tree
Hide file tree
Showing 13 changed files with 624 additions and 20 deletions.
15 changes: 15 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ pallet-cess-treasury = { path = "pallets/cess-treasury", default-features = fals
pallet-evm-account-mapping = { path = "pallets/evm-account-mapping", default-features = false }
pallet-file-bank = { path = "pallets/file-bank", default-features = false }
pallet-oss = { path = "pallets/oss", default-features = false }
pallet-reservoir = { path= "pallets/reservoir", default-features = false }
pallet-scheduler-credit = { path = "pallets/scheduler-credit", default-features = false }
pallet-sminer = { path = "pallets/sminer", default-features = false }
pallet-storage-handler = { path = "pallets/storage-handler", default-features = false }
Expand Down
9 changes: 1 addition & 8 deletions pallets/audit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,15 @@ cp-cess-common = { workspace = true }
cp-enclave-verify = { workspace = true }
pallet-cess-treasury = { workspace = true }

# polkadot
frame-benchmarking = { workspace = true, optional = true }

frame-support = { workspace = true }

frame-system = { workspace = true }

sp-io = { workspace = true }

sp-std = { workspace = true }

pallet-balances = { workspace = true }

sp-core = { workspace = true }

pallet-timestamp = { workspace = true }

sp-runtime = { workspace = true }

# local dependencies
Expand Down
30 changes: 30 additions & 0 deletions pallets/reservoir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "pallet-reservoir"
authors = ["CESS LAB"]
version = "0.7.7"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/CESSProject/cess"
description = "FRAME pallet for segment management"
readme = "README.md"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { workspace = true, features = ["derive"] }
sp-std = { workspace = true }
sp-runtime = { workspace = true }

# substrate
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-balances = { workspace = true }

[features]
default = ["std"]
std = [
"codec/std",
"scale-info/std",
"sp-std/std",
"frame-support/std",
"frame-system/std",
]
21 changes: 21 additions & 0 deletions pallets/reservoir/src/impls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use super::*;
use sp_runtime::traits::Zero;

impl<Balance: Zero> Default for ReservoirInfo<Balance> {
fn default() -> Self {
ReservoirInfo::<Balance> {
free_balance: Balance::zero(),
borrow_balance: Balance::zero(),
store_balance: Balance::zero(),
}
}
}

impl<Balance: Zero> Default for UserHold<Balance> {
fn default() -> Self {
UserHold::<Balance> {
free: Balance::zero(),
staking: Balance::zero(),
}
}
}
Loading

0 comments on commit 42ef77c

Please sign in to comment.