Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the pair creation #308

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions runtime/common/src/zenlink.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::traits::{fungibles, Get};
use frame_system::Config as SysConfig;
use pallet_assets::Config as AssetsConfig;
use sp_runtime::traits::Convert;
use sp_runtime::traits::{Convert, Zero};
use sp_std::marker::PhantomData;
use zenlink_protocol::GenerateLpAssetId;

Expand Down Expand Up @@ -43,16 +43,15 @@ where
let asset_id0: PeaqAssetId = (*asset0).try_into().ok()?;
let asset_id1: PeaqAssetId = (*asset1).try_into().ok()?;

let min = if ExistentialDeposit::get().is_zero() {
ExistentialDeposit::get() + 1u32.into()
} else {
ExistentialDeposit::get()
};
match (asset_id0, asset_id1) {
(PeaqAssetId::Token(symbol0), PeaqAssetId::Token(symbol1)) => {
let lp_currency = PeaqAssetId::LPToken(symbol0, symbol1);
Local::create(
lp_currency.try_into().ok()?,
AdminAccount::get(),
true,
ExistentialDeposit::get(),
)
.ok()?;
Local::create(lp_currency.try_into().ok()?, AdminAccount::get(), true, min).ok()?;
// Cannot setup the metadata for the LP asset because admin account doesn't have
// enough balance.
Some(())
Expand Down
1 change: 0 additions & 1 deletion runtime/krest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,6 @@ impl pallet_vesting::Config for Runtime {

parameter_types! {
pub const AssetDeposit: Balance = 20 * CENTS;
pub const AssetExistentialDeposit: Balance = ExistentialDeposit::get();
pub const AssetApprovalDeposit: Balance = 20 * MILLICENTS;
pub const AssetsStringLimit: u32 = 50;
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
Expand Down
6 changes: 3 additions & 3 deletions runtime/peaq-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2145,8 +2145,8 @@ impl pallet_vesting::Config for Runtime {
}

parameter_types! {
pub const AssetDeposit: Balance = ExistentialDeposit::get();
pub const AssetExistentialDeposit: Balance = ExistentialDeposit::get();
pub const AssetDeposit: Balance = 20 * CENTS;
pub const AssetApprovalDeposit: Balance = 20 * MILLICENTS;
pub const AssetsStringLimit: u32 = 50;
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
// https://github.com/paritytech/substrate/blob/069917b/frame/assets/src/lib.rs#L257L271
Expand All @@ -2166,7 +2166,7 @@ impl pallet_assets::Config for Runtime {
type MetadataDepositBase = MetadataDepositBase;
type MetadataDepositPerByte = MetadataDepositPerByte;
type AssetAccountDeposit = AssetAccountDeposit;
type ApprovalDeposit = AssetExistentialDeposit;
type ApprovalDeposit = AssetApprovalDeposit;
type StringLimit = AssetsStringLimit;
type Freezer = ();
type Extra = ();
Expand Down
1 change: 0 additions & 1 deletion runtime/peaq/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,6 @@ impl pallet_vesting::Config for Runtime {

parameter_types! {
pub const AssetDeposit: Balance = DOLLARS;
pub const AssetExistentialDeposit: Balance = ExistentialDeposit::get();
pub const AssetApprovalDeposit: Balance = 100 * MILLICENTS;
pub const AssetsStringLimit: u32 = 50;
/// Key = 32 bytes, Value = 36 bytes (32+1+1+1+1)
Expand Down
Loading