You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -2094,23 +2044,7 @@ To create the ERC-20 contract, you can follow the steps below:
2094
2044
3. Now, paste the following ERC-20 contract code into the editor:
2095
2045
2096
2046
```solidity title="MyToken.sol"
2097
-
// SPDX-License-Identifier: MIT
2098
-
// Compatible with OpenZeppelin Contracts ^5.0.0
2099
-
pragma solidity ^0.8.22;
2100
-
2101
-
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
2102
-
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
2103
-
2104
-
contract MyToken is ERC20, Ownable {
2105
-
constructor(address initialOwner)
2106
-
ERC20("MyToken", "MTK")
2107
-
Ownable(initialOwner)
2108
-
{}
2109
-
2110
-
function mint(address to, uint256 amount) public onlyOwner {
2111
-
_mint(to, amount);
2112
-
}
2113
-
}
2047
+
2114
2048
```
2115
2049
2116
2050
The key components of the code above are:
@@ -2261,26 +2195,7 @@ To create the NFT contract, you can follow the steps below:
2261
2195
3. Now, paste the following NFT contract code into the editor.
2262
2196
2263
2197
```solidity title="MyNFT.sol"
2264
-
// SPDX-License-Identifier: MIT
2265
-
// Compatible with OpenZeppelin Contracts ^5.0.0
2266
-
pragma solidity ^0.8.22;
2267
-
2268
-
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
2269
-
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
2270
-
2271
-
contract MyToken is ERC721, Ownable {
2272
-
uint256 private _nextTokenId;
2273
-
2274
-
constructor(address initialOwner)
2275
-
ERC721("MyToken", "MTK")
2276
-
Ownable(initialOwner)
2277
-
{}
2278
-
2279
-
function safeMint(address to) public onlyOwner {
2280
-
uint256 tokenId = _nextTokenId++;
2281
-
_safeMint(to, tokenId);
2282
-
}
2283
-
}
2198
+
2284
2199
```
2285
2200
2286
2201
The key components of the code above are:
@@ -5779,8 +5694,7 @@ The [`XcmRouter`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pa
5779
5694
For instance, the Kusama network employs the [`ChildParachainRouter`](https://paritytech.github.io/polkadot-sdk/master/polkadot_runtime_common/xcm_sender/struct.ChildParachainRouter.html){target=\_blank}, which restricts routing to [Downward Message Passing (DMP)](https://wiki.polkadot.com/learn/learn-xcm-transport/#dmp-downward-message-passing){target=\_blank} from the relay chain to parachains, ensuring secure and controlled communication.
For more details about XCM transport protocols, see the [XCM Channels](/develop/interoperability/xcm-channels/){target=\_blank} page.
@@ -6633,38 +6547,13 @@ The `xcm-emulator` provides macros for defining a mocked testing environment. Ch
6633
6547
- **[`decl_test_bridges`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2506-2/cumulus/xcm/xcm-emulator/src/lib.rs#L1221){target=\_blank}**: Creates bridges between chains, specifying the source, target, and message handler. Example:
6634
6548
6635
6549
```rust
6636
-
decl_test_bridges! {
6637
-
pub struct RococoWestendMockBridge {
6638
-
source = BridgeHubRococoPara,
6639
-
target = BridgeHubWestendPara,
6640
-
handler = RococoWestendMessageHandler
6641
-
},
6642
-
pub struct WestendRococoMockBridge {
6643
-
source = BridgeHubWestendPara,
6644
-
target = BridgeHubRococoPara,
6645
-
handler = WestendRococoMessageHandler
6646
-
}
6647
-
}
6550
+
6648
6551
```
6649
6552
6650
6553
- **[`decl_test_networks`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2506-2/cumulus/xcm/xcm-emulator/src/lib.rs#L958){target=\_blank}**: Defines a testing network with relay chains, parachains, and bridges, implementing message transport and processing logic. Example:
6651
6554
6652
6555
```rust
6653
-
decl_test_networks! {
6654
-
pub struct WestendMockNet {
6655
-
relay_chain = Westend,
6656
-
parachains = vec![
6657
-
AssetHubWestend,
6658
-
BridgeHubWestend,
6659
-
CollectivesWestend,
6660
-
CoretimeWestend,
6661
-
PeopleWestend,
6662
-
PenpalA,
6663
-
PenpalB,
6664
-
],
6665
-
bridge = ()
6666
-
},
6667
-
}
6556
+
6668
6557
```
6669
6558
6670
6559
By leveraging these macros, developers can customize their testing networks by defining relay chains and parachains tailored to their needs. For guidance on implementing a mock runtime for a Polkadot SDK-based chain, refer to the [Pallet Testing](/develop/parachains/testing/pallet-testing/){target=\_blank} article.
@@ -2706,23 +2656,7 @@ To create the ERC-20 contract, you can follow the steps below:
2706
2656
3. Now, paste the following ERC-20 contract code into the editor:
2707
2657
2708
2658
```solidity title="MyToken.sol"
2709
-
// SPDX-License-Identifier: MIT
2710
-
// Compatible with OpenZeppelin Contracts ^5.0.0
2711
-
pragma solidity ^0.8.22;
2712
-
2713
-
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
2714
-
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
2715
-
2716
-
contract MyToken is ERC20, Ownable {
2717
-
constructor(address initialOwner)
2718
-
ERC20("MyToken", "MTK")
2719
-
Ownable(initialOwner)
2720
-
{}
2721
-
2722
-
function mint(address to, uint256 amount) public onlyOwner {
2723
-
_mint(to, amount);
2724
-
}
2725
-
}
2659
+
2726
2660
```
2727
2661
2728
2662
The key components of the code above are:
@@ -2873,26 +2807,7 @@ To create the NFT contract, you can follow the steps below:
2873
2807
3. Now, paste the following NFT contract code into the editor.
2874
2808
2875
2809
```solidity title="MyNFT.sol"
2876
-
// SPDX-License-Identifier: MIT
2877
-
// Compatible with OpenZeppelin Contracts ^5.0.0
2878
-
pragma solidity ^0.8.22;
2879
-
2880
-
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
2881
-
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
2882
-
2883
-
contract MyToken is ERC721, Ownable {
2884
-
uint256 private _nextTokenId;
2885
-
2886
-
constructor(address initialOwner)
2887
-
ERC721("MyToken", "MTK")
2888
-
Ownable(initialOwner)
2889
-
{}
2890
-
2891
-
function safeMint(address to) public onlyOwner {
2892
-
uint256 tokenId = _nextTokenId++;
2893
-
_safeMint(to, tokenId);
2894
-
}
2895
-
}
2810
+
2896
2811
```
2897
2812
2898
2813
The key components of the code above are:
@@ -8809,8 +8724,7 @@ The [`XcmRouter`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pa
8809
8724
For instance, the Kusama network employs the [`ChildParachainRouter`](https://paritytech.github.io/polkadot-sdk/master/polkadot_runtime_common/xcm_sender/struct.ChildParachainRouter.html){target=\_blank}, which restricts routing to [Downward Message Passing (DMP)](https://wiki.polkadot.com/learn/learn-xcm-transport/#dmp-downward-message-passing){target=\_blank} from the relay chain to parachains, ensuring secure and controlled communication.
For more details about XCM transport protocols, see the [XCM Channels](/develop/interoperability/xcm-channels/){target=\_blank} page.
@@ -10031,38 +9945,13 @@ The `xcm-emulator` provides macros for defining a mocked testing environment. Ch
10031
9945
- **[`decl_test_bridges`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2506-2/cumulus/xcm/xcm-emulator/src/lib.rs#L1221){target=\_blank}**: Creates bridges between chains, specifying the source, target, and message handler. Example:
10032
9946
10033
9947
```rust
10034
-
decl_test_bridges! {
10035
-
pub struct RococoWestendMockBridge {
10036
-
source = BridgeHubRococoPara,
10037
-
target = BridgeHubWestendPara,
10038
-
handler = RococoWestendMessageHandler
10039
-
},
10040
-
pub struct WestendRococoMockBridge {
10041
-
source = BridgeHubWestendPara,
10042
-
target = BridgeHubRococoPara,
10043
-
handler = WestendRococoMessageHandler
10044
-
}
10045
-
}
9948
+
10046
9949
```
10047
9950
10048
9951
- **[`decl_test_networks`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2506-2/cumulus/xcm/xcm-emulator/src/lib.rs#L958){target=\_blank}**: Defines a testing network with relay chains, parachains, and bridges, implementing message transport and processing logic. Example:
10049
9952
10050
9953
```rust
10051
-
decl_test_networks! {
10052
-
pub struct WestendMockNet {
10053
-
relay_chain = Westend,
10054
-
parachains = vec![
10055
-
AssetHubWestend,
10056
-
BridgeHubWestend,
10057
-
CollectivesWestend,
10058
-
CoretimeWestend,
10059
-
PeopleWestend,
10060
-
PenpalA,
10061
-
PenpalB,
10062
-
],
10063
-
bridge = ()
10064
-
},
10065
-
}
9954
+
10066
9955
```
10067
9956
10068
9957
By leveraging these macros, developers can customize their testing networks by defining relay chains and parachains tailored to their needs. For guidance on implementing a mock runtime for a Polkadot SDK-based chain, refer to the [Pallet Testing](/develop/parachains/testing/pallet-testing/){target=\_blank} article.
@@ -11319,7 +11208,7 @@ This API can be used independently for dry-running, double-checking, or testing.
11319
11208
This API allows a dry-run of any extrinsic and obtaining the outcome if it fails or succeeds, as well as the local xcm and remote xcm messages sent to other chains.
This API allows the direct dry-run of an xcm message instead of an extrinsic one, checks if it will execute successfully, and determines what other xcm messages will be forwarded to other chains.
Calculates the weight required to execute a given XCM message. It is useful for estimating the execution cost of a cross-chain message in the destination chain before sending it.
Converts a given weight into the corresponding fee for a specified `AssetId`. It allows clients to determine the cost of execution in terms of the desired asset.
Retrieves the delivery fees for sending a specific XCM message to a designated destination. The fees are always returned in a specific asset defined by the destination chain.
0 commit comments