Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizdave97 committed Oct 11, 2024
1 parent 344bc24 commit 7dddf4c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
21 changes: 12 additions & 9 deletions modules/ismp/pallets/token-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@ The first step is to implement the pallet config for the runtime.

```rust,ignore
use frame_support::parameter_types;
use ismp::Error;
use ismp::host::StateMachine;
use ismp::module::IsmpModule;
use ismp::router::{IsmpRouter, Post, Response, Timeout};
use ismp::router::IsmpRouter;
parameter_types! {
// The Native asset Id for the native currency, for parachains this would be the XCM location for the parachain
// For standalone chains, a constant value that can be used to identify the native currency
pub const NativeAssetId: Location = Location::here();
// A constant that should represent the native asset id
pub const NativeAssetId: u32 = 0;
// Set the correct decimals for the native currency
pub const Decimals: u8 = 12;
}
Expand All @@ -38,13 +35,14 @@ impl pallet_ismp::Config for Runtime {
type Currency = Balances;
// The Native asset Id
type NativeAssetId = NativeAssetId;
// A type that allows token gateway to create local asset Ids
// An implementation is required to receive asset creation messages from Hyperbridge
// A type that provides a function for creating unique asset ids
// An implementation is required for asset creation calls or messages
type CreateAsset = ();
// The decimals value of the native asset
type Decimals = Decimals;
}
// Add the pallet to your ISMP router
#[derive(Default)]
struct Router;
impl IsmpRouter for Router {
Expand All @@ -69,9 +67,14 @@ The pallet requires some setting up before the teleport function is available fo

## Dispatchable Functions

- `teleport` - This function is used to bridge assets to EVM chains through Hyperbridge.
- `teleport` - This function is used to bridge assets to through Hyperbridge.
- `set_token_gateway_addresses` - This call allows the `AdminOrigin` origin to set the token gateway address for EVM chains.
- `create_erc6160_asset` - This call dispatches a request to Hyperbridge to create multi chain native assets on token gateway deployments

## Asset creation
When creating assets, the metadata needs to be set, the account set as the admin is the pallet account, depending on the fungibles implementation,
funding the pallet account might be required for the asset creation to succeed.

## License

This library is licensed under the Apache 2.0 License, Copyright (c) 2024 Polytope Labs.
3 changes: 1 addition & 2 deletions modules/ismp/pallets/token-gateway/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ pub struct TeleportParams<AssetId, Balance> {
#[derive(Clone, Encode, Decode, scale_info::TypeInfo, PartialEq, Eq, RuntimeDebug)]
pub struct AssetMap<AssetId> {
/// Local Asset Id if the asset exists already
/// If the asset exists, it's decimal will be updated to 18
/// other metadata will not be changed
/// If the asset exists, it's metadata will not be changed
pub local_id: Option<AssetId>,
/// MNT Asset registration details
pub reg: ERC6160AssetRegistration,
Expand Down
4 changes: 2 additions & 2 deletions parachain/runtimes/gargantua/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ impl pallet_utility::Config for Runtime {
}

parameter_types! {
pub const SpendingPeriod: BlockNumber = 6 * DAYS;
pub const SpendingPeriod: BlockNumber = 24 * DAYS;
pub const TreasuryPalletId: PalletId = PalletId(*b"hb/trsry");
pub const PayoutPeriod: BlockNumber = 14 * DAYS;
pub const PayoutPeriod: BlockNumber = 30 * DAYS;
pub const MaxBalance: Balance = Balance::max_value();
pub TreasuryAccount: AccountId = Treasury::account_id();
pub const TechnicalMotionDuration: BlockNumber = 5 * DAYS;
Expand Down
4 changes: 2 additions & 2 deletions parachain/runtimes/nexus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,9 @@ impl pallet_mmr::Config for Runtime {
}

parameter_types! {
pub const SpendingPeriod: BlockNumber = 6 * DAYS;
pub const SpendingPeriod: BlockNumber = 24 * DAYS;
pub const TreasuryPalletId: PalletId = PalletId(*b"hb/trsry");
pub const PayoutPeriod: BlockNumber = 14 * DAYS;
pub const PayoutPeriod: BlockNumber = 30 * DAYS;
pub const MaxBalance: Balance = Balance::max_value();
pub TreasuryAccount: AccountId = Treasury::account_id();
pub const TechnicalMotionDuration: BlockNumber = 5 * DAYS;
Expand Down

0 comments on commit 7dddf4c

Please sign in to comment.