-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #518 from galacticcouncil/feat/fees
fix: fees adjusted
- Loading branch information
Showing
14 changed files
with
161 additions
and
31 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
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,49 @@ | ||
#![cfg(test)] | ||
|
||
use crate::kusama_test_net::*; | ||
use basilisk_runtime::TransactionPayment; | ||
use frame_support::weights::GetDispatchInfo; | ||
use sp_runtime::codec::Encode; | ||
use xcm_emulator::TestExt; | ||
|
||
#[test] | ||
// #[ignore] | ||
//TODO: fix this, fees calculcated in this test are apporx 2bsx off. | ||
fn transfer_transaction_fees() { | ||
//This test is not correct | ||
Basilisk::execute_with(|| { | ||
let call = orml_currencies::Call::<basilisk_runtime::Runtime>::transfer { | ||
dest: AccountId::from(ALICE), | ||
currency_id: 0, | ||
amount: 50 * UNITS, | ||
}; | ||
|
||
let info = call.get_dispatch_info(); | ||
let len = call.encoded_size() as u32; | ||
let fees = TransactionPayment::compute_fee(len, &info, 0); | ||
|
||
//This test is not correct it's approx 1bsx of from real fees | ||
println!("transfer cost {:?} BSX", fees / UNITS); | ||
}); | ||
} | ||
|
||
#[test] | ||
fn nft_mint_transaction_fees() { | ||
Basilisk::execute_with(|| { | ||
let call = pallet_nft::Call::<basilisk_runtime::Runtime>::mint { | ||
class_id: 0, | ||
instance_id: 0, | ||
metadata: b"ipfs://QmQu2jUmtFNPd86tEHFs6hmAArKYyjEC3xuwVWpFGjcMgm" | ||
.to_vec() | ||
.try_into() | ||
.unwrap(), | ||
}; | ||
|
||
let info = call.get_dispatch_info(); | ||
let len = call.encoded_size() as u32; | ||
let fees = TransactionPayment::compute_fee(len, &info, 0); | ||
|
||
//This test is not correct it's approx 1bsx of from real fees | ||
println!("mint nft cost {:?} BSX", fees / UNITS); | ||
}); | ||
} |
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,4 +1,5 @@ | ||
mod cross_chain_transfer; | ||
mod fees; | ||
mod kusama_test_net; | ||
mod nft_marketplace; | ||
mod non_native_fee; |
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
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
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
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,81 @@ | ||
// This file is part of Basilisk-node. | ||
|
||
// Copyright (C) 2020-2021 Intergalactic, Limited (GIB). | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//! Autogenerated weights for pallet_nft | ||
//! | ||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev | ||
//! DATE: 2022-07-06, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] | ||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 | ||
// Executed Command: | ||
// target/release/basilisk | ||
// benchmark | ||
// --chain=dev | ||
// --steps=5 | ||
// --repeat=20 | ||
// --execution=wasm | ||
// --wasm-execution=compiled | ||
// --heap-pages=4096 | ||
// --template=.maintain/pallet-weight-template-no-back.hbs | ||
// --pallet=pallet_nft | ||
// --output=nft.rs | ||
// --extrinsic=* | ||
#![allow(unused_parens)] | ||
#![allow(unused_imports)] | ||
#![allow(clippy::unnecessary_cast)] | ||
|
||
use frame_support::{ | ||
traits::Get, | ||
weights::{constants::RocksDbWeight, Weight}, | ||
}; | ||
use sp_std::marker::PhantomData; | ||
|
||
use pallet_nft::weights::WeightInfo; | ||
|
||
pub struct BasiliskWeight<T>(PhantomData<T>); | ||
|
||
//This consts are here to make `create_class()` and `mint()` more expensive. | ||
const CREATE_CLASS_OFFSET: u64 = 160; | ||
const MINT_OFFSET: u64 = 120; | ||
|
||
impl<T: frame_system::Config> WeightInfo for BasiliskWeight<T> { | ||
fn create_class() -> Weight { | ||
(CREATE_CLASS_OFFSET * 41_173_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(2 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(4 as Weight)) | ||
} | ||
fn mint() -> Weight { | ||
(MINT_OFFSET * 55_520_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(4 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(5 as Weight)) | ||
} | ||
fn transfer() -> Weight { | ||
(46_700_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(3 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(3 as Weight)) | ||
} | ||
fn destroy_class() -> Weight { | ||
(63_644_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(4 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(5 as Weight)) | ||
} | ||
fn burn() -> Weight { | ||
(58_040_000 as Weight) | ||
.saturating_add(T::DbWeight::get().reads(4 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(5 as Weight)) | ||
} | ||
} |
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