Skip to content

Commit 129619f

Browse files
JuaniRioslrazovic
authored andcommitted
Replace WETH with ETH
1 parent c121786 commit 129619f

File tree

30 files changed

+106
-166
lines changed

30 files changed

+106
-166
lines changed

integration-tests/chopsticks/overrides/polimec.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@ const dot_location = {
2323
},
2424
};
2525

26-
export const weth_location = {
26+
export const eth_location = {
2727
parents: 2,
2828
interior: {
29-
x2: [
29+
x1: [
3030
{
3131
globalConsensus: {
3232
ethereum: {
3333
chainId: 1n,
3434
},
3535
},
3636
},
37-
{
38-
accountKey20: {
39-
key: WETH_ADDRESS,
40-
},
41-
},
4237
],
4338
},
4439
};
@@ -81,7 +76,7 @@ export const polimec_storage = {
8176
// Note: We can remove Asset and Metadata from the storage override as soon we set them on-chain.
8277
Asset: [
8378
[
84-
[weth_location],
79+
[eth_location],
8580
{
8681
owner: Accounts.ALICE,
8782
issuer: Accounts.ALICE,
@@ -98,8 +93,6 @@ export const polimec_storage = {
9893
},
9994
],
10095
],
101-
Metadata: [
102-
[[weth_location], { symbol: 'Wrapped Ether', name: 'WETH', decimals: 18, isFrozen: false }],
103-
],
96+
Metadata: [[[eth_location], { symbol: 'Ether', name: 'ETH', decimals: 18, isFrozen: false }]],
10497
},
10598
} as const;

integration-tests/chopsticks/overrides/polkadot-hub.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { INITIAL_BALANCES } from '@/constants';
22
import { Accounts, Asset } from '@/types';
3-
import { weth_location } from './polimec';
3+
import { eth_location } from './polimec';
44

55
export const polkadot_hub_storage = {
66
System: {
@@ -35,7 +35,7 @@ export const polkadot_hub_storage = {
3535
ForeignAssets: {
3636
Account: [
3737
[
38-
[weth_location, Accounts.POLIMEC],
38+
[eth_location, Accounts.POLIMEC],
3939
{
4040
balance: INITIAL_BALANCES.WETH,
4141
},

integration-tests/chopsticks/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ export const DERIVE_PATHS = {
2323
export const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
2424
export const DEFAULT_TOPIC = FixedSizeBinary.fromArray(Array(32).fill(1));
2525
export const FEE_AMOUNT = 40_000_000_000n;
26-
export const WETH_AMOUNT = 15_000_000_000_000n;
26+
export const ETH_AMOUNT = 15_000_000_000_000n;

integration-tests/chopsticks/src/managers/BridgeHubManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ export class BridgerHubManagaer extends BaseChainManager {
4646
return AssetSourceRelation.Sibling;
4747
case Asset.USDC:
4848
return AssetSourceRelation.Sibling;
49-
case Asset.WETH:
49+
case Asset.ETH:
5050
// TODO: Check it Placeholder
5151
return AssetSourceRelation.Self;
5252
}
53+
54+
return AssetSourceRelation.Self;
5355
}
5456

5557
// Note: On BridgeHub, there should be no balance for any asset.

integration-tests/chopsticks/src/managers/PolimecManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class PolimecManager extends BaseChainManager {
4747
return AssetSourceRelation.Sibling;
4848
case Asset.USDC:
4949
return AssetSourceRelation.Sibling;
50-
case Asset.WETH:
50+
case Asset.ETH:
5151
// Placeholder
5252
return AssetSourceRelation.Self;
5353
case Asset.PLMC:

integration-tests/chopsticks/src/managers/PolkadotHubManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class PolkadotHubManager extends BaseChainManager {
4343
return AssetSourceRelation.Self;
4444
case Asset.USDC:
4545
return AssetSourceRelation.Self;
46-
case Asset.WETH:
46+
case Asset.ETH:
4747
// This is not actually used, so we use Self as a placeholder
4848
return AssetSourceRelation.Self;
4949
case Asset.PLMC:

integration-tests/chopsticks/src/managers/PolkadotManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ export class PolkadotManager extends BaseChainManager {
4444
case Asset.USDC:
4545
// Placeholder
4646
return AssetSourceRelation.Self;
47-
case Asset.WETH:
47+
case Asset.ETH:
4848
// Placeholder
4949
return AssetSourceRelation.Self;
5050
}
51+
52+
return AssetSourceRelation.Self;
5153
}
5254

5355
async getAssetBalanceOf(account: Accounts, asset: Asset): Promise<bigint> {

integration-tests/chopsticks/src/tests/bridge.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ describe('Bridge Hub -> Polimec Transfer Tests', () => {
2222
afterAll(async () => await chainSetup.cleanup());
2323

2424
test(
25-
'Send WETH to Polimec',
25+
'Send ETH to Polimec',
2626
() =>
2727
transferTest.testTransfer({
2828
account: Accounts.ALICE,
29-
assets: [[Asset.WETH, TRANSFER_AMOUNTS.BRIDGED, AssetSourceRelation.Self]],
29+
assets: [[Asset.ETH, TRANSFER_AMOUNTS.BRIDGED, AssetSourceRelation.Self]],
3030
}),
31-
{ timeout: 25000 },
31+
{ timeout: 40000 },
3232
);
3333
});

integration-tests/chopsticks/src/transfers/BridgeToPolimec.ts

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from 'bun:test';
2-
import { DEFAULT_TOPIC, FEE_AMOUNT, WETH_ADDRESS, WETH_AMOUNT } from '@/constants';
2+
import { DEFAULT_TOPIC, ETH_AMOUNT, FEE_AMOUNT, WETH_ADDRESS } from '@/constants';
33
import type { BridgerHubManagaer } from '@/managers/BridgeHubManager';
44
import type { PolimecManager } from '@/managers/PolimecManager';
55
import type { PolkadotHubManager } from '@/managers/PolkadotHubManager';
@@ -102,7 +102,10 @@ export class BridgeToPolimecTransfer extends BaseTransferTest {
102102
(event) => event.type === 'ForeignAssets' && event.value.type === 'Issued',
103103
);
104104

105-
// TODO: Check why we have 3 events instead of 2 (WETH + DOT). Curently we have 3 events (WETH + DOT + DOT)
105+
console.log('Issued Events on Destination: \n');
106+
console.dir(issuedEventsOnDest, { depth: null });
107+
108+
// TODO: Check why we have 3 events instead of 2 (ETH + DOT). Curently we have 3 events (ETH + DOT + DOT)
106109
expect(issuedEventsOnDest.length).toBe(3);
107110

108111
return { sourceBlock, destBlock };
@@ -147,15 +150,11 @@ export class BridgeToPolimecTransfer extends BaseTransferTest {
147150
{
148151
id: XcmV3MultiassetAssetId.Concrete({
149152
parents: 2,
150-
interior: XcmV3Junctions.X2([
153+
interior: XcmV3Junctions.X1(
151154
XcmV3Junction.GlobalConsensus(XcmV3JunctionNetworkId.Ethereum({ chain_id: 1n })),
152-
XcmV3Junction.AccountKey20({
153-
network: undefined,
154-
key: FixedSizeBinary.fromHex(WETH_ADDRESS),
155-
}),
156-
]),
155+
),
157156
}),
158-
fun: XcmV3MultiassetFungibility.Fungible(WETH_AMOUNT),
157+
fun: XcmV3MultiassetFungibility.Fungible(ETH_AMOUNT),
159158
},
160159
]),
161160

@@ -190,15 +189,11 @@ export class BridgeToPolimecTransfer extends BaseTransferTest {
190189
{
191190
id: XcmV3MultiassetAssetId.Concrete({
192191
parents: 2,
193-
interior: XcmV3Junctions.X2([
192+
interior: XcmV3Junctions.X1(
194193
XcmV3Junction.GlobalConsensus(XcmV3JunctionNetworkId.Ethereum({ chain_id: 1n })),
195-
XcmV3Junction.AccountKey20({
196-
network: undefined,
197-
key: FixedSizeBinary.fromHex(WETH_ADDRESS),
198-
}),
199-
]),
194+
),
200195
}),
201-
fun: XcmV3MultiassetFungibility.Fungible(WETH_AMOUNT),
196+
fun: XcmV3MultiassetFungibility.Fungible(ETH_AMOUNT),
202197
},
203198
]),
204199
dest: {
@@ -250,15 +245,11 @@ export class BridgeToPolimecTransfer extends BaseTransferTest {
250245
{
251246
id: XcmV3MultiassetAssetId.Concrete({
252247
parents: 2,
253-
interior: XcmV3Junctions.X2([
248+
interior: XcmV3Junctions.X1(
254249
XcmV3Junction.GlobalConsensus(XcmV3JunctionNetworkId.Ethereum({ chain_id: 1n })),
255-
XcmV3Junction.AccountKey20({
256-
network: undefined,
257-
key: FixedSizeBinary.fromHex(WETH_ADDRESS),
258-
}),
259-
]),
250+
),
260251
}),
261-
fun: XcmV3MultiassetFungibility.Fungible(WETH_AMOUNT),
252+
fun: XcmV3MultiassetFungibility.Fungible(ETH_AMOUNT),
262253
},
263254
]),
264255

integration-tests/chopsticks/src/transfers/PolimecToHub.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,6 @@ export class PolimecToHubTransfer extends BaseTransferTest {
6464
return { asset_balances: [{ source, destination }] };
6565
}
6666

67-
// verifyFinalBalances(
68-
// initialBalances: BalanceCheck[],
69-
// finalBalances: BalanceCheck[],
70-
// options: TransferOptions,
71-
// ) {
72-
// // TODO: At the moment we exclude fees from the balance check since the PAPI team is wotking on some utilies to calculate fees.
73-
// const initialBalance =
74-
// options.assets[0][0] === Asset.DOT
75-
// ? INITIAL_BALANCES.DOT
76-
// : options.assets[0][0] === Asset.USDT
77-
// ? INITIAL_BALANCES.USDT
78-
// : INITIAL_BALANCES.USDC;
79-
// for (let i = 0; i < options.assets.length; i++) {
80-
// expect(initialBalances[i].destination).toBe(0n);
81-
// expect(initialBalances[i].source).toBe(initialBalance);
82-
// expect(finalBalances[i].source).toBeLessThan(initialBalances[i].source);
83-
// expect(finalBalances[i].destination).toBeGreaterThan(initialBalances[i].destination);
84-
// }
85-
// }
86-
8767
async verifyFinalBalances(
8868
assetInitialBalances: PolimecBalanceCheck[],
8969
assetFinalBalances: PolimecBalanceCheck[],

0 commit comments

Comments
 (0)