Skip to content

Commit

Permalink
release 10041.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kkast committed Dec 4, 2023
1 parent 3f8a629 commit 35a4c6f
Show file tree
Hide file tree
Showing 7 changed files with 1,542 additions and 227 deletions.
36 changes: 18 additions & 18 deletions code/Cargo.lock

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

10 changes: 5 additions & 5 deletions code/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu
orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae", default-features = false }
orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "7ecebeab7e3dbc2226ed58d32ee159271a8176ae", default-features = false }

ibc = { git = "https://github.com/ComposableFi/composable-ibc", rev = "d05ec4b3ebd32f4c86a392c0968f8af37ccb35d8", default-features = false }
ibc-rpc = { git = "https://github.com/ComposableFi/composable-ibc", rev = "d05ec4b3ebd32f4c86a392c0968f8af37ccb35d8", default-features = false }
ibc-primitives = { git = "https://github.com/ComposableFi/composable-ibc", rev = "d05ec4b3ebd32f4c86a392c0968f8af37ccb35d8", default-features = false }
ibc-runtime-api = { git = "https://github.com/ComposableFi/composable-ibc", rev = "d05ec4b3ebd32f4c86a392c0968f8af37ccb35d8", default-features = false }
pallet-ibc = { git = "https://github.com/ComposableFi/composable-ibc", rev = "d05ec4b3ebd32f4c86a392c0968f8af37ccb35d8", default-features = false }
ibc = { git = "https://github.com/ComposableFi/composable-ibc", rev = "698146a5a66ce9e5e7a21633ef60e39fa1c8840e", default-features = false }
ibc-rpc = { git = "https://github.com/ComposableFi/composable-ibc", rev = "698146a5a66ce9e5e7a21633ef60e39fa1c8840e", default-features = false }
ibc-primitives = { git = "https://github.com/ComposableFi/composable-ibc", rev = "698146a5a66ce9e5e7a21633ef60e39fa1c8840e", default-features = false }
ibc-runtime-api = { git = "https://github.com/ComposableFi/composable-ibc", rev = "698146a5a66ce9e5e7a21633ef60e39fa1c8840e", default-features = false }
pallet-ibc = { git = "https://github.com/ComposableFi/composable-ibc", rev = "698146a5a66ce9e5e7a21633ef60e39fa1c8840e", default-features = false }

xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
Expand Down
61 changes: 38 additions & 23 deletions code/parachain/frame/revenue-ibc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub mod pallet {
use pallet_ibc::{MultiAddress, TransferParams};

use sp_runtime::{
traits::{AccountIdConversion, Zero},
traits::{AccountIdConversion, CheckedSub, Zero},
AccountId32, Perbill,
};
pub use sp_std::{prelude::*, str::FromStr, vec};
Expand Down Expand Up @@ -288,31 +288,46 @@ pub mod pallet {
);
let old_balance = TokenPrevPeriodBalance::<T>::get(asset_id);
let asset_ed_res = T::AssetsRegistry::existential_deposit(asset_id.clone());
let mut skip = true;
// asset has ED
if let Ok(asset_ed) = asset_ed_res {
if new_balance > old_balance &&
percentage * (new_balance - old_balance) >= asset_ed
{
let amount = percentage * (new_balance - old_balance);
match T::Assets::transfer(
asset_id.clone(),
&<T as Config>::FeeAccount::get(),
&Self::pallet_account_id(),
percentage * (new_balance - old_balance),
Preservation::Expendable,
) {
Ok(_) => Self::deposit_event(Event::<T>::TransferSuccess {
asset_id: asset_id.clone(),
amount,
}),
Err(_) => Self::deposit_event(Event::<T>::TransferFail {
asset_id: asset_id.clone(),
amount,
}),
};
TokenPrevPeriodBalance::<T>::insert(asset_id, new_balance - amount);
let checked_revenue = new_balance.checked_sub(&old_balance);
// new balance is larger than the previous
if let Some(revenue) = checked_revenue {
// amount to transfer
let amount = percentage * revenue;
// balance after the percentage of revenue is transferred
let checked_prev_period_balance = new_balance.checked_sub(&amount);
if let Some(prev_period_balance) = checked_prev_period_balance {
if new_balance > old_balance && amount >= asset_ed {
match T::Assets::transfer(
asset_id.clone(),
&<T as Config>::FeeAccount::get(),
&Self::pallet_account_id(),
amount,
Preservation::Expendable,
) {
Ok(_) => Self::deposit_event(Event::<T>::TransferSuccess {
asset_id: asset_id.clone(),
amount,
}),
Err(_) => Self::deposit_event(Event::<T>::TransferFail {
asset_id: asset_id.clone(),
amount,
}),
};
TokenPrevPeriodBalance::<T>::insert(
asset_id,
prev_period_balance,
);
skip = false;
}
}
}
}
Self::deposit_event(Event::<T>::SkipAsset { asset_id: asset_id.clone() });
if skip {
Self::deposit_event(Event::<T>::SkipAsset { asset_id: asset_id.clone() });
}
});
if Self::transfer_from_intermediate().is_err() {
Self::deposit_event(Event::<T>::IntermediateTransferFail);
Expand Down
2 changes: 1 addition & 1 deletion code/parachain/runtime/composable/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
// `spec_version`, and `authoring_version` are the same between Wasm and native.
spec_version: 10041,
impl_version: 3,
impl_version: 4,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
state_version: 0,
Expand Down
2 changes: 1 addition & 1 deletion code/parachain/runtime/picasso/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
// `spec_version`, and `authoring_version` are the same between Wasm and native.
spec_version: 10041,
impl_version: 3,
impl_version: 4,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 0,
Expand Down
Loading

0 comments on commit 35a4c6f

Please sign in to comment.