Skip to content

Commit 60b67ee

Browse files
authored
adjust fees per asset (#1711)
* adjust fees per asset * bump 0.16.3 * fix ETH location junction
1 parent 41e78ac commit 60b67ee

7 files changed

Lines changed: 28 additions & 19 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,7 @@ dependencies = [
25742574

25752575
[[package]]
25762576
name = "integritee-cli"
2577-
version = "0.16.2"
2577+
version = "0.16.3"
25782578
dependencies = [
25792579
"array-bytes 6.1.0",
25802580
"base58",
@@ -2632,7 +2632,7 @@ dependencies = [
26322632

26332633
[[package]]
26342634
name = "integritee-service"
2635-
version = "0.16.2"
2635+
version = "0.16.3"
26362636
dependencies = [
26372637
"anyhow",
26382638
"async-trait",

app-libs/assets-map/src/lib.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,18 @@ impl AssetTranslation for AssetId {
297297
Self: Sized,
298298
{
299299
if location.parents == 2 {
300-
if let X2(junctions) = &location.interior {
301-
match junctions.as_slice() {
300+
match &location.interior {
301+
X1(junctions) => match junctions.as_slice() {
302+
[GlobalConsensus(Ethereum { chain_id: ETHEREUM_MAINNET_CHAIN_ID })]
303+
if matches!(
304+
genesis_hash.into(),
305+
ASSET_HUB_POLKADOT_GENESIS_HASH_HEX
306+
| ASSET_HUB_LOCAL_TEST_GENESIS_HASH_HEX
307+
) =>
308+
Some(AssetId::ETH),
309+
_ => None,
310+
},
311+
X2(junctions) => match junctions.as_slice() {
302312
[GlobalConsensus(Ethereum { chain_id: ETHEREUM_MAINNET_CHAIN_ID }), AccountKey20 { key: contract, network: None }]
303313
if *contract == USDC_E_MAINNET_CONTRACT_ADDRESS
304314
&& matches!(
@@ -331,17 +341,9 @@ impl AssetTranslation for AssetId {
331341
| ASSET_HUB_LOCAL_TEST_GENESIS_HASH_HEX
332342
) =>
333343
Some(AssetId::WETH),
334-
[GlobalConsensus(Ethereum { chain_id: ETHEREUM_MAINNET_CHAIN_ID })]
335-
if matches!(
336-
genesis_hash.into(),
337-
ASSET_HUB_POLKADOT_GENESIS_HASH_HEX
338-
| ASSET_HUB_LOCAL_TEST_GENESIS_HASH_HEX
339-
) =>
340-
Some(AssetId::ETH),
341344
_ => None,
342-
}
343-
} else {
344-
None
345+
},
346+
_ => None,
345347
}
346348
} else {
347349
None

app-libs/stf/src/trusted_call.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,14 @@ fn get_fee_for(tc: &TrustedCallSigned, fee_asset: Option<AssetId>) -> Fee {
10041004
}
10051005
match fee_asset {
10061006
None => Fee::Native(fee_amount),
1007-
Some(asset_id) => Fee::Asset(fee_amount, asset_id),
1007+
Some(asset_id) => match asset_id {
1008+
AssetId::USDC | AssetId::USDT | AssetId::USDC_E | AssetId::USDT_E =>
1009+
Fee::Asset(fee_amount, asset_id),
1010+
// TODO: use TEEracle info from L1 for exchange rates. the hardcoded exchange rates are
1011+
// just to get started in the right order of magnitude
1012+
AssetId::ETH | AssetId::WETH => Fee::Asset(fee_amount / 2_000, asset_id),
1013+
AssetId::BTC | AssetId::WBTC_E => Fee::Asset(fee_amount / 70_000, asset_id),
1014+
},
10081015
}
10091016
}
10101017

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "integritee-cli"
3-
version = "0.16.2"
3+
version = "0.16.3"
44
authors = ["Integritee AG <hello@integritee.network>"]
55
edition = "2021"
66

enclave-runtime/Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ dependencies = [
771771

772772
[[package]]
773773
name = "enclave-runtime"
774-
version = "0.16.2"
774+
version = "0.16.3"
775775
dependencies = [
776776
"array-bytes 6.2.2",
777777
"cid",

enclave-runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "enclave-runtime"
3-
version = "0.16.2"
3+
version = "0.16.3"
44
authors = ["Integritee AG <hello@integritee.network>"]
55
edition = "2021"
66

service/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "integritee-service"
3-
version = "0.16.2"
3+
version = "0.16.3"
44
authors = ["Integritee AG <hello@integritee.network>"]
55
build = "build.rs"
66
edition = "2021"

0 commit comments

Comments
 (0)