-
Notifications
You must be signed in to change notification settings - Fork 9
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
spike foreign fungibles v2 #474
base: main
Are you sure you want to change the base?
Conversation
@@ -499,7 +594,7 @@ pub mod pallet { | |||
fn weight(request: &Self::Read) -> Weight { | |||
use Read::*; | |||
match request { | |||
TotalSupply(_) => <T as Config>::WeightInfo::total_supply(), | |||
TotalSupply(id) => <T as Config>::WeightInfo::total_supply(weight_param(id)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hasn't been tested but applied to show how the weight can be handled for the read functions.
253d80e
to
142072c
Compare
@@ -108,10 +108,14 @@ mod benchmarks { | |||
|
|||
#[benchmark] | |||
// Storage: `Assets` | |||
fn total_supply() { | |||
fn total_supply(a: Linear<0, 1>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not tested but I was thinking to implement it this way if we went this route.
type TrustBackedAssetsInstance; | ||
/// The asset instance for foreign assets. | ||
type ForeignAssetsInstance; | ||
type Balance: Parameter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complex Balance type unfortunately
ChainExtensionMethodApi, Result, StatusCode, | ||
}; | ||
|
||
pub mod errors; | ||
pub mod events; | ||
pub mod traits; | ||
|
||
#[derive(Debug, PartialEq, Eq, Clone)] | ||
#[ink::scale_derive(Encode, Decode, TypeInfo)] | ||
pub enum TokenId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only change required in the fungibles api crate apart from the XCM stuff
(Close annotations in the
Files changed
section by clicking the right corner 3 dots when reviewing because I only pushed the relevant bits)Shows how we can implement the foreign fungibles functionality by creating a wrapper type in the fungibles pallet & api. This reduces the amount of duplicate code but adds some complexity to the pallet (i.e. benchmarking, types).
See latest commit to get a feel for the contract. This is just the fungibles contract updated and can both be used for the fungibles as foreign fungibles use case.
Fungibles contract without
foreign_fungibles
feature enabled: 14.5K (see latest commit), disabled: 22.8K (fungibles contract was 14.2K)Integrations tests for
transfer
andbalance_of
are working.