Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
f5a6148
feat: interact with an ERC20 contract via fungibles
franciscoaguirre Feb 28, 2025
cc0826a
Merge branch 'master' into erc20-transactor
franciscoaguirre Mar 13, 2025
663dc31
feat(pallet-revive): implement burn_from and mint_into
franciscoaguirre Mar 25, 2025
dec5a16
WIP
franciscoaguirre Mar 25, 2025
0e30d61
Merge branch 'master' into erc20-transactor
franciscoaguirre Apr 16, 2025
d1d3200
Merge branch 'master' into erc20-transactor
franciscoaguirre Apr 16, 2025
69d8188
test(asset-hub-westend-integration-tests): handle erc20 with xcm
franciscoaguirre Apr 17, 2025
c3ea080
chore: remove erc20.txt
franciscoaguirre Apr 17, 2025
f47caff
doc(assets-common): add docs to public items
franciscoaguirre Apr 17, 2025
3ff6618
test(pallet-revive): total issuance
franciscoaguirre Apr 21, 2025
42525b5
Merge branch 'master' into erc20-transactor
franciscoaguirre Apr 23, 2025
b7e7292
chore: some tweaks
franciscoaguirre May 10, 2025
1a3ca40
feat(xcm-executor): integrate fees to withdraw and deposit in a simpl…
franciscoaguirre May 11, 2025
3c91d8c
test(asset-hub-westend): ERC20s weighing more than regular assets
franciscoaguirre May 11, 2025
bea5b5c
chore(xcm-executor): add new trait fn to avoid breaking change
franciscoaguirre May 11, 2025
4b8300b
doc(xcm-executor): add some doc comments
franciscoaguirre May 11, 2025
c7d53e9
chore(erc20-transactor): clean up errors
franciscoaguirre May 11, 2025
3c27b62
test(asset-hub-westend): add refund_surplus to ERC20Transactor test
franciscoaguirre May 11, 2025
1f9eaed
fix(xcm-executor): actually accrue surplus after deposit
franciscoaguirre May 11, 2025
6b00997
doc: add prdoc
franciscoaguirre May 11, 2025
7efef14
feat(xcm-executor): also take into account surplus on transfer_asset
franciscoaguirre May 11, 2025
feb9883
Merge branch 'master' into erc20-transactor
franciscoaguirre May 12, 2025
4b55188
fix: feature propagation
franciscoaguirre May 12, 2025
9b4f1ce
fix: taplo
franciscoaguirre May 12, 2025
311dcee
fix: fmt
franciscoaguirre May 12, 2025
9db097f
fix(erc20-transactor): make sure we don't panic
franciscoaguirre May 13, 2025
85c36ab
enhance erc20 transactor
acatangiu May 12, 2025
a8a7c09
test(erc20-transactor): non-existent and non-erc20 contracts
franciscoaguirre May 13, 2025
a02574c
Update cumulus/parachains/runtimes/assets/common/src/lib.rs
franciscoaguirre May 13, 2025
89580be
Update polkadot/xcm/xcm-executor/src/traits/transact_asset.rs
franciscoaguirre May 13, 2025
21f947e
Update polkadot/xcm/xcm-executor/src/traits/transact_asset.rs
franciscoaguirre May 13, 2025
41dc734
Update polkadot/xcm/xcm-executor/src/traits/transact_asset.rs
franciscoaguirre May 13, 2025
d1d25f6
fix(erc20-transactor): use a specific checking account
franciscoaguirre May 13, 2025
e750fd0
chore(erc20-transactor): rename checking account
franciscoaguirre May 13, 2025
c25e04e
doc(erc20-transactor): improve doc comments
franciscoaguirre May 13, 2025
16e71c0
fix: fmt
franciscoaguirre May 13, 2025
5b84a77
Merge branch 'master' into erc20-transactor
franciscoaguirre May 13, 2025
f7777e6
fix: checking account
franciscoaguirre May 14, 2025
7eecb15
Merge branch 'master' into erc20-transactor
franciscoaguirre May 14, 2025
559988d
fix(erc20-transactor): disallow teleports
franciscoaguirre May 14, 2025
063c31d
Merge branch 'master' into erc20-transactor
franciscoaguirre May 14, 2025
74b2932
Merge branch 'master' into erc20-transactor
franciscoaguirre May 14, 2025
5452f4c
fix(erc20-transactor): license
franciscoaguirre May 14, 2025
9f475a1
Merge branch 'master' into erc20-transactor
franciscoaguirre May 14, 2025
357f392
Merge branch 'master' into erc20-transactor
franciscoaguirre May 14, 2025
e19d44d
Merge branch 'master' into erc20-transactor
franciscoaguirre May 15, 2025
3d97b16
fix(assets-common): unresolved link
franciscoaguirre May 15, 2025
18a6ed3
fix(assets-common): propagate try-runtime feature from pallet-revive
franciscoaguirre May 15, 2025
eee48ef
Merge branch 'master' into erc20-transactor
franciscoaguirre May 15, 2025
754677c
chore: move erc20 interface to its own crate
franciscoaguirre May 19, 2025
c7b0d41
fix: zepter and taplo
franciscoaguirre May 19, 2025
3d7e538
fix: copy polkavm blob instead of moving it
franciscoaguirre May 19, 2025
b696d4e
test: contract that returns more data
franciscoaguirre May 19, 2025
77f7723
test: scenarios with different contracts
franciscoaguirre May 19, 2025
793d1e0
fix: add storage deposit limits
franciscoaguirre May 19, 2025
d9c830c
Merge branch 'master' into erc20-transactor
franciscoaguirre May 19, 2025
5323bb8
chore(pallet-revive-fixtures): rename function
franciscoaguirre May 19, 2025
4c0d7fc
chore(pallet-revive): refactor magic number to constant
franciscoaguirre May 19, 2025
4cd4230
fix: add new crate to umbrella
franciscoaguirre May 20, 2025
129b93b
doc: update prdoc
franciscoaguirre May 20, 2025
11ce20f
Merge branch 'master' into erc20-transactor
franciscoaguirre May 20, 2025
43f027d
Merge branch 'master' into erc20-transactor
franciscoaguirre May 26, 2025
219eac4
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_c…
franciscoaguirre May 26, 2025
7d9a360
chore: move IERC20 and validate all decoding
franciscoaguirre May 26, 2025
f53ee34
fix: fmt
franciscoaguirre May 26, 2025
989abbc
Merge branch 'master' into erc20-transactor
franciscoaguirre May 26, 2025
8640566
fix: add max weight to a test
franciscoaguirre May 26, 2025
6937b11
chore: move erc20 transactor tests to asset-hub unit tests
franciscoaguirre May 27, 2025
3eeaa8d
fix: fmt
franciscoaguirre May 27, 2025
64f1397
Merge branch 'master' into erc20-transactor
franciscoaguirre May 27, 2025
5adbd29
fix: clippy
franciscoaguirre May 27, 2025
065a40c
fix: zepter
franciscoaguirre May 27, 2025
b72c080
Merge branch 'master' into erc20-transactor
franciscoaguirre May 27, 2025
a70edad
chore(pallet-revive): move feature gate to module itself
franciscoaguirre May 28, 2025
d383df3
chore(asset-hub-westend-emulated-chain): rename contracts to revive
franciscoaguirre May 28, 2025
4412d17
chore(assets-common): remove alloy-core dependency
franciscoaguirre May 28, 2025
dd389f9
chore: remove a space
franciscoaguirre May 28, 2025
1392670
chore(asset-hub-westend-runtime): remove dependency on revive fixtures
franciscoaguirre May 28, 2025
c42cf06
chore(pallet-revive): specify imports instead of glob
franciscoaguirre May 28, 2025
765d5ba
Merge branch 'master' into erc20-transactor
franciscoaguirre May 28, 2025
f8b59a4
chore(asset-hub-westend-runtime): add reference contracts
franciscoaguirre May 28, 2025
946842e
fix(pallet-revive): fungibles tests
franciscoaguirre May 28, 2025
39db981
revert(yet-another-parachain): taplo
franciscoaguirre May 28, 2025
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
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ decl_test_parachains! {
PoolAssets: asset_hub_westend_runtime::PoolAssets,
AssetConversion: asset_hub_westend_runtime::AssetConversion,
SnowbridgeSystemFrontend: asset_hub_westend_runtime::SnowbridgeSystemFrontend,
Revive: asset_hub_westend_runtime::Revive,
}
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ runtime-benchmarks = [
"xcm/runtime-benchmarks",
]
try-runtime = [
"assets-common/try-runtime",
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-weight-reclaim/try-runtime",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ snowbridge-pallet-system-frontend = { workspace = true }
snowbridge-runtime-common = { workspace = true }

[dev-dependencies]
alloy-core = { workspace = true, features = ["sol-types"] }
asset-test-utils = { workspace = true, default-features = true }
pallet-revive-fixtures = { workspace = true, default-features = true }
parachains-runtimes-test-utils = { workspace = true, default-features = true }

[build-dependencies]
Expand Down Expand Up @@ -163,6 +165,7 @@ runtime-benchmarks = [
"xcm/runtime-benchmarks",
]
try-runtime = [
"assets-common/try-runtime",
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-weight-reclaim/try-runtime",
Expand Down Expand Up @@ -204,6 +207,7 @@ try-runtime = [
"sp-runtime/try-runtime",
]
std = [
"alloy-core/std",
"assets-common/std",
"bp-asset-hub-rococo/std",
"bp-asset-hub-westend/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
mod pallet_xcm_benchmarks_fungible;
mod pallet_xcm_benchmarks_generic;

use crate::{xcm_config::MaxAssetsIntoHolding, Runtime};
use crate::{
xcm_config::{ERC20TransferGasLimit, MaxAssetsIntoHolding},
Runtime,
};
use alloc::vec::Vec;
use frame_support::weights::Weight;
use assets_common::IsLocalAccountKey20;
use frame_support::{traits::Contains, weights::Weight};
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
use sp_runtime::BoundedVec;
Expand Down Expand Up @@ -54,9 +58,33 @@ impl WeighAssets for AssetFilter {
}
}

trait WeighAsset {
/// Return one worst-case estimate: `weight`, or another.
fn weigh_asset(&self, weight: Weight) -> Weight;
}

impl WeighAsset for Asset {
fn weigh_asset(&self, weight: Weight) -> Weight {
// If the asset is a smart contract ERC20, then we know the gas limit,
// else we return the weight that was passed in, that's already
// the worst case for non-ERC20 assets.
if IsLocalAccountKey20::contains(&self.id.0) {
ERC20TransferGasLimit::get()
} else {
weight
}
}
}

impl WeighAssets for Assets {
fn weigh_assets(&self, weight: Weight) -> Weight {
weight.saturating_mul(self.inner().iter().count() as u64)
// We start with zero.
let mut final_weight = Weight::zero();
// For each asset, we add weight depending on the type of asset.
for asset in self.inner().iter() {
final_weight = final_weight.saturating_add(asset.weigh_asset(weight));
}
final_weight
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use frame_support::{
tokens::imbalance::{ResolveAssetTo, ResolveTo},
ConstU32, Contains, Equals, Everything, LinearStoragePrice, PalletInfoAccess,
},
PalletId,
};
use frame_system::EnsureRoot;
use pallet_xcm::{AuthorizedAliasers, XcmPassthrough};
Expand Down Expand Up @@ -209,13 +210,39 @@ pub type PoolFungiblesTransactor = FungiblesAdapter<
CheckingAccount,
>;

parameter_types! {
/// Taken from the real gas and deposits of a standard ERC20 transfer call.
pub const ERC20TransferGasLimit: Weight = Weight::from_parts(700_000_000, 200_000);
pub const ERC20TransferStorageDepositLimit: Balance = 10_200_000_000;
pub ERC20TransfersCheckingAccount: AccountId = PalletId(*b"py/revch").into_account_truncating();
}

/// Transactor for ERC20 tokens.
pub type ERC20Transactor = assets_common::ERC20Transactor<
// We need this for accessing pallet-revive.
Runtime,
// The matcher for smart contracts.
assets_common::ERC20Matcher,
// How to convert from a location to an account id.
LocationToAccountId,
// The maximum gas that can be used by a standard ERC20 transfer.
ERC20TransferGasLimit,
// The maximum storage deposit that can be used by a standard ERC20 transfer.
ERC20TransferStorageDepositLimit,
// We're generic over this so we can't escape specifying it.
AccountId,
// Checking account for ERC20 transfers.
ERC20TransfersCheckingAccount,
>;

/// Means for transacting assets on this chain.
pub type AssetTransactors = (
FungibleTransactor,
FungiblesTransactor,
ForeignFungiblesTransactor,
PoolFungiblesTransactor,
UniquesTransactor,
ERC20Transactor,
);

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
Expand Down
Loading
Loading