Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2574,7 +2574,7 @@ dependencies = [

[[package]]
name = "integritee-cli"
version = "0.16.4"
version = "0.16.5"
dependencies = [
"array-bytes 6.1.0",
"base58",
Expand Down Expand Up @@ -2632,7 +2632,7 @@ dependencies = [

[[package]]
name = "integritee-service"
version = "0.16.4"
version = "0.16.5"
dependencies = [
"anyhow",
"async-trait",
Expand Down
46 changes: 40 additions & 6 deletions app-libs/assets-map/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,18 @@ pub enum AssetId {
BTC = 36,
/// ethereum-wrapped Bitcoin
WBTC_E = 37,

// other ERC20 tokens
/// PEPE meme token, minted on Ethereum
PEPE_E = 40,
}

const USDC_E_MAINNET_CONTRACT_ADDRESS: [u8; 20] = hex!("a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48");
const EURC_E_MAINNET_CONTRACT_ADDRESS: [u8; 20] = hex!("1abaea1f7c830bd89acc67ec4af516284b1bc33c");
const USDT_E_MAINNET_CONTRACT_ADDRESS: [u8; 20] = hex!("dac17f958d2ee523a2206206994597c13d831ec7");
const WETH_SEPOLIA_CONTRACT_ADDRESS: [u8; 20] = hex!("fff9976782d46cc05630d1f6ebab18b2324d6b14");
const WBTC_E_MAINNET_CONTRACT_ADDRESS: [u8; 20] = hex!("2260fac5e5542a773aa44fbcfedf7c193bc2c599");
const PEPE_E_MAINNET_CONTRACT_ADDRESS: [u8; 20] = hex!("6982508145454ce325ddbe47a25d4ec3d2311933");

/// The AssetId type we use on L2 to map all possible locations/instances
/// This type must contain unique definitions for any token we may want to shield on any shielding target
Expand All @@ -104,6 +109,7 @@ impl std::fmt::Display for AssetId {
AssetId::WETH => write!(f, "WETH"),
AssetId::BTC => write!(f, "BTC"),
AssetId::WBTC_E => write!(f, "WBTC.e"),
AssetId::PEPE_E => write!(f, "PEPE.e"),
}
}
}
Expand All @@ -122,6 +128,7 @@ impl TryFrom<&str> for AssetId {
"ETH" => Ok(AssetId::ETH),
"WETH" => Ok(AssetId::WETH),
"WBTC.e" => Ok(AssetId::WBTC_E),
"PEPE.e" => Ok(AssetId::PEPE_E),
_ => Err(()),
}
}
Expand Down Expand Up @@ -149,6 +156,7 @@ impl AssetId {
AssetId::WETH => Some(FOREIGN_ASSETS),
AssetId::BTC => None,
AssetId::WBTC_E => Some(FOREIGN_ASSETS),
AssetId::PEPE_E => Some(FOREIGN_ASSETS),
}
}

Expand All @@ -157,12 +165,13 @@ impl AssetId {
AssetId::USDT => 1_000_000,
AssetId::USDT_E => 1_000_000, // 6 decimals
AssetId::USDC => 1_000_000,
AssetId::USDC_E => 1_000_000, // 6 decimals
AssetId::EURC_E => 1_000_000, // 6 decimals
AssetId::ETH => 1_000_000_000_000_000_000, // 18 decimals
AssetId::WETH => 1_000_000_000_000_000_000, // 18 decimals
AssetId::BTC => 100_000_000, // 8 decimals
AssetId::WBTC_E => 100_000_000, // 8 decimals
AssetId::USDC_E => 1_000_000, // 6 decimals
AssetId::EURC_E => 1_000_000, // 6 decimals
AssetId::ETH => 1_000_000_000_000_000_000, // 18 decimals
AssetId::WETH => 1_000_000_000_000_000_000, // 18 decimals
AssetId::BTC => 100_000_000, // 8 decimals
AssetId::WBTC_E => 100_000_000, // 8 decimals
AssetId::PEPE_E => 1_000_000_000_000_000_000, // 18 decimals
}
}

Expand All @@ -183,6 +192,7 @@ impl AssetId {
AssetId::WETH,
AssetId::ETH,
AssetId::WBTC_E,
AssetId::PEPE_E,
],
ASSET_HUB_PASEO_GENESIS_HASH_HEX => vec![AssetId::USDT, AssetId::USDC, AssetId::WETH],
ASSET_HUB_POLKADOT_GENESIS_HASH_HEX => vec![
Expand All @@ -191,6 +201,7 @@ impl AssetId {
AssetId::EURC_E,
AssetId::ETH,
AssetId::WBTC_E,
AssetId::PEPE_E,
],
_ => vec![],
}
Expand Down Expand Up @@ -261,6 +272,21 @@ impl AssetTranslation for AssetId {
} else {
None
},
AssetId::PEPE_E =>
if matches!(
genesis_hash.into(),
ASSET_HUB_POLKADOT_GENESIS_HASH_HEX | ASSET_HUB_LOCAL_TEST_GENESIS_HASH_HEX
) {
Some(Location {
parents: 2,
interior: X2(Arc::new([
GlobalConsensus(Ethereum { chain_id: ETHEREUM_MAINNET_CHAIN_ID }),
AccountKey20 { key: PEPE_E_MAINNET_CONTRACT_ADDRESS, network: None },
])),
})
} else {
None
},
AssetId::WETH =>
if matches!(
genesis_hash.into(),
Expand Down Expand Up @@ -369,6 +395,14 @@ impl AssetTranslation for AssetId {
| ASSET_HUB_LOCAL_TEST_GENESIS_HASH_HEX
) =>
Some(AssetId::WBTC_E),
[GlobalConsensus(Ethereum { chain_id: ETHEREUM_MAINNET_CHAIN_ID }), AccountKey20 { key: contract, network: None }]
if *contract == PEPE_E_MAINNET_CONTRACT_ADDRESS
&& matches!(
genesis_hash.into(),
ASSET_HUB_POLKADOT_GENESIS_HASH_HEX
| ASSET_HUB_LOCAL_TEST_GENESIS_HASH_HEX
) =>
Some(AssetId::PEPE_E),
[GlobalConsensus(Ethereum { chain_id: ETHEREUM_SEPOLIA_CHAIN_ID }), AccountKey20 { key: contract, network: None }]
if *contract == WETH_SEPOLIA_CONTRACT_ADDRESS
&& matches!(
Expand Down
1 change: 1 addition & 0 deletions app-libs/stf/src/trusted_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@ fn get_fee_for(tc: &TrustedCallSigned, fee_asset: Option<AssetId>) -> Fee {
// just to get started in the right order of magnitude
AssetId::ETH | AssetId::WETH => Fee::Asset(fee_amount / 2_000, asset_id),
AssetId::BTC | AssetId::WBTC_E => Fee::Asset(fee_amount / 70_000, asset_id),
AssetId::PEPE_E => Fee::Asset(fee_amount / 17, asset_id),
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "integritee-cli"
version = "0.16.4"
version = "0.16.5"
authors = ["Integritee AG <hello@integritee.network>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion enclave-runtime/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ dependencies = [

[[package]]
name = "enclave-runtime"
version = "0.16.4"
version = "0.16.5"
dependencies = [
"array-bytes 6.2.2",
"cid",
Expand Down
2 changes: 1 addition & 1 deletion enclave-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "enclave-runtime"
version = "0.16.4"
version = "0.16.5"
authors = ["Integritee AG <hello@integritee.network>"]
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "integritee-service"
version = "0.16.4"
version = "0.16.5"
authors = ["Integritee AG <hello@integritee.network>"]
build = "build.rs"
edition = "2021"
Expand Down
Loading