Skip to content

Commit

Permalink
Revert "Revert "Pallet bridge using new pallet fees (#933)" (#963)" (#…
Browse files Browse the repository at this point in the history
…978)

This reverts commit 3fa2008.
  • Loading branch information
lemunozm authored Sep 19, 2022
1 parent 8e45549 commit d899a8d
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 475 deletions.
6 changes: 2 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
};

# This is a hash of all the Cargo dependencies, for reproducibility.
cargoSha256 = "sha256-GE+oVLoSq2GHK2wqCtHG0uVcSa17xeTXLC0XNZ9F5fg";
cargoSha256 = "sha256-q3gwCT8dCrkMshGhHnMDPjuYXjbZJbyJwcnCaRElcIU=";

nativeBuildInputs = with pkgs; [ clang git-mock pkg-config ];
buildInputs = with pkgs; [ openssl ] ++ (
Expand Down
6 changes: 0 additions & 6 deletions libs/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ pub mod constants {
/// Value for a not specified fee key.
pub const DEFAULT_FEE_VALUE: Balance = 1 * CFG;

/// Additional fee charged when moving native tokens to target chains (in CFGs).
pub const NATIVE_TOKEN_TRANSFER_FEE: Balance = 2000 * CFG;

/// Additional fee charged when moving NFTs to target chains (in CFGs).
pub const NFT_TOKEN_TRANSFER_FEE: Balance = 20 * CFG;

/// Additional fee charged when validating NFT proofs
pub const NFT_PROOF_VALIDATION_FEE: Balance = 10 * CFG;

Expand Down
12 changes: 7 additions & 5 deletions libs/traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,11 @@ pub mod fees {
author: &Self::AccountId,
fee: Fee<Self::Balance, Self::FeeKey>,
) -> DispatchResult {
let balance = Self::balance(fee);
S::get().with(|state| {
state.borrow_mut().author_fees.push(FeeState {
author: author.clone(),
balance: Self::balance(fee),
balance,
});
});
Ok(())
Expand All @@ -649,10 +650,11 @@ pub mod fees {
author: &Self::AccountId,
fee: Fee<Self::Balance, Self::FeeKey>,
) -> DispatchResult {
let balance = Self::balance(fee);
S::get().with(|state| {
state.borrow_mut().burn_fees.push(FeeState {
author: author.clone(),
balance: Self::balance(fee),
balance,
});
});
Ok(())
Expand All @@ -662,11 +664,11 @@ pub mod fees {
author: &Self::AccountId,
fee: Fee<Self::Balance, Self::FeeKey>,
) -> DispatchResult {
let value = S::get();
value.with(|state| {
let balance = Self::balance(fee);
S::get().with(|state| {
state.borrow_mut().treasury_fees.push(FeeState {
author: author.clone(),
balance: Self::balance(fee),
balance,
});
});
Ok(())
Expand Down
28 changes: 10 additions & 18 deletions pallets/bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,28 @@ version = '2.0.0'
targets = ['x86_64-unknown-linux-gnu']

[dependencies]
# Substrate basic primitives
codec = { package = "parity-scale-codec", version = "3.0", default-features = false }
scale-info = { version = "2.0", default-features = false, features = ["derive"] }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.26" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.26" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.26" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.26" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.26" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.26" }

# Centrifuge Chain dependencies
chainbridge = { git = "https://github.com/centrifuge/chainbridge-substrate.git", default-features = false, branch = "polkadot-v0.9.26" }
pallet-nft = { path = "../nft", default-features = false }
cfg-traits = { path = "../../libs/traits", default-features = false }

[dev-dependencies]
# Testing/mocking dependencies
pallet-anchors = { path = "../anchors", default-features = true }
pallet-bridge-mapping = { path = "../bridge-mapping", default-features = true }
pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.26" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.26" }
proofs = { path = "../../libs/proofs", default-features = true }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.26" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.26" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = true, branch = "polkadot-v0.9.26" }
cfg-types = { path = "../../libs/types", default-features = true}
cfg-primitives= { path = "../../libs/primitives", default-features = true}

sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
pallet-fees = { path = "../fees"}
runtime-common = { path = "../../runtime/common" }
cfg-primitives = { path = "../../libs/primitives" }
cfg-types = { path = "../../libs/types" }

[features]
default = ['std']
Expand All @@ -49,11 +43,9 @@ std = [
'scale-info/std',
'frame-support/std',
'frame-system/std',
'pallet-balances/std',
'sp-core/std',
'sp-runtime/std',
'sp-std/std',
'chainbridge/std',
'pallet-nft/std',
'cfg-traits/std',
]
Loading

0 comments on commit d899a8d

Please sign in to comment.