git.delta.rocks / unique-network / refs/commits / d035b5d10ee1

difftreelog

Fixes after review

Max Andreev2023-03-29parent: #1550f8c.patch.diff
in: master

6 files changed

modified.docker/xcm-config/launch-config-xcm-quartz.j2diffbeforeafterboth
169 {169 {
170 "bin": "/astar/target/release/astar",170 "bin": "/astar/target/release/astar",
171 "id": "2007",171 "id": "2007",
172 "chain": "astar-dev",172 "chain": "shiden-dev",
173 "balance": "1000000000000000000000000",173 "balance": "1000000000000000000000000",
174 "nodes": [174 "nodes": [
175 {175 {
224 },224 },
225 {225 {
226 "sender": 2007,226 "sender": 2007,
227 "recipient": 1000,227 "recipient": 2095,
228 "maxCapacity": 8,228 "maxCapacity": 8,
229 "maxMessageSize": 512229 "maxMessageSize": 512
230 },230 },
231 {231 {
232 "sender": 1000,232 "sender": 2095,
233 "recipient": 2007,233 "recipient": 2007,
234 "maxCapacity": 8,234 "maxCapacity": 8,
235 "maxMessageSize": 512235 "maxMessageSize": 512
modified.docker/xcm-config/launch-config-xcm-unique.j2diffbeforeafterboth
224 },224 },
225 {225 {
226 "sender": 2006,226 "sender": 2006,
227 "recipient": 1000,227 "recipient": 2037,
228 "maxCapacity": 8,228 "maxCapacity": 8,
229 "maxMessageSize": 512229 "maxMessageSize": 512
230 },230 },
231 {231 {
232 "sender": 1000,232 "sender": 2037,
233 "recipient": 2006,233 "recipient": 2006,
234 "maxCapacity": 8,234 "maxCapacity": 8,
235 "maxMessageSize": 512235 "maxMessageSize": 512
modifiedtests/src/util/index.tsdiffbeforeafterboth
11import config from '../config';11import config from '../config';
12import {ChainHelperBase} from './playgrounds/unique';12import {ChainHelperBase} from './playgrounds/unique';
13import {ILogger} from './playgrounds/types';13import {ILogger} from './playgrounds/types';
14import {DevUniqueHelper, SilentLogger, SilentConsole, DevMoonbeamHelper, DevMoonriverHelper, DevAcalaHelper, DevKaruraHelper, DevRelayHelper, DevWestmintHelper, DevStatemineHelper, DevStatemintHelper, DevAstarHelper} from './playgrounds/unique.dev';14import {DevUniqueHelper, SilentLogger, SilentConsole, DevMoonbeamHelper, DevMoonriverHelper, DevAcalaHelper, DevKaruraHelper, DevRelayHelper, DevWestmintHelper, DevStatemineHelper, DevStatemintHelper, DevAstarHelper, DevShidenHelper} from './playgrounds/unique.dev';
15import {dirname} from 'path';15import {dirname} from 'path';
16import {fileURLToPath} from 'url';16import {fileURLToPath} from 'url';
1717
105 return usingPlaygroundsGeneral<DevAstarHelper>(DevAstarHelper, url, code);105 return usingPlaygroundsGeneral<DevAstarHelper>(DevAstarHelper, url, code);
106};106};
107107
108export const usingShidenPlaygrounds = (url: string, code: (helper: DevShidenHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
109 return usingPlaygroundsGeneral<DevShidenHelper>(DevShidenHelper, url, code);
110};
108111
109export const MINIMUM_DONOR_FUND = 100_000n;112export const MINIMUM_DONOR_FUND = 100_000n;
110export const DONOR_FUNDING = 2_000_000n;113export const DONOR_FUNDING = 2_000_000n;
modifiedtests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth
184 }184 }
185}185}
186
187export class DevShidenHelper extends AstarHelper {
188 wait: WaitGroup;
189
190 constructor(logger: { log: (msg: any, level: any) => void, level: any }, options: {[key: string]: any} = {}) {
191 options.helperBase = options.helperBase ?? DevShidenHelper;
192
193 super(logger, options);
194 this.wait = new WaitGroup(this);
195 }
196}
186197
187export class DevAcalaHelper extends AcalaHelper {198export class DevAcalaHelper extends AcalaHelper {
188 wait: WaitGroup;199 wait: WaitGroup;
modifiedtests/src/xcm/xcmQuartz.test.tsdiffbeforeafterboth
18import {blake2AsHex} from '@polkadot/util-crypto';18import {blake2AsHex} from '@polkadot/util-crypto';
19import config from '../config';19import config from '../config';
20import {XcmV2TraitsError} from '../interfaces';20import {XcmV2TraitsError} from '../interfaces';
21import {itSub, expect, describeXCM, usingPlaygrounds, usingKaruraPlaygrounds, usingRelayPlaygrounds, usingMoonriverPlaygrounds, usingStateminePlaygrounds, usingAstarPlaygrounds} from '../util';21import {itSub, expect, describeXCM, usingPlaygrounds, usingKaruraPlaygrounds, usingRelayPlaygrounds, usingMoonriverPlaygrounds, usingStateminePlaygrounds, usingShidenPlaygrounds} from '../util';
2222
23const QUARTZ_CHAIN = 2095;23const QUARTZ_CHAIN = 2095;
24const STATEMINE_CHAIN = 1000;24const STATEMINE_CHAIN = 1000;
983983
984describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {984describeXCM('[XCM] Integration test: Exchanging tokens with Shiden', () => {
985 let alice: IKeyringPair;985 let alice: IKeyringPair;
986 let randomAccount: IKeyringPair;986 let sender: IKeyringPair;
987987
988 // Quartz -> Shiden
988 const shidenInitialBalance = 1n * (10n ** 18n);989 const shidenInitialBalance = 1n * (10n ** 18n); // 1 SHD, existencial deposit required in order to perform XCM call
990 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?
989 const qtzToShidenAmount = 10n * (10n ** 18n);991 const qtzToShidenTransferred = 10n * (10n ** 18n); // 10 QTZ
992 const qtzToShidenArrived = 9_999_999_999_088_000_000n; // 9.999 ... QTZ, Shiden takes a commision in foreign tokens
993 const senderIinitialBalanceQTZ = 100n * (10n ** 18n); // How many QTZ sender has initially
994 const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... QTZ after XCM call
995
996 // Shiden -> Quartz
997 const qtzFromShidenTransfered = 5n * (10n ** 18n); // 5 QTZ
998 const qtzOnShidenLeft = qtzToShidenArrived - qtzFromShidenTransfered; // 4.999_999_999_088_000_000n QTZ
990999
991 before(async () => {1000 before(async () => {
992 await usingPlaygrounds(async (helper, privateKey) => {1001 await usingPlaygrounds(async (helper, privateKey) => {
993 alice = await privateKey('//Alice');1002 alice = await privateKey('//Alice');
994 [randomAccount] = await helper.arrange.createAccounts([100n], alice);1003 [sender] = await helper.arrange.createAccounts([100n], alice);
995 console.log('randomAccount', randomAccount.address);1004 console.log('sender', sender.address);
996 });1005 });
9971006
998 await usingAstarPlaygrounds(shidenUrl, async (helper) => {1007 await usingShidenPlaygrounds(shidenUrl, async (helper) => {
999 console.log('1. Create foreign asset and metadata');1008 console.log('1. Create foreign asset and metadata');
1000 await helper.assets.create(1009 await helper.assets.create(
1001 alice,1010 alice,
1027 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.registerAssetLocation', [assetLocation, 1]);1036 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.registerAssetLocation', [assetLocation, 1]);
10281037
1029 console.log('3. Set payment for computation');1038 console.log('3. Set payment for computation');
1030 // TODO this is Phala's price, what price will be for Unique?
1031 const unitsPerSecond = 228_000_000_000n;
1032 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.setAssetUnitsPerSecond', [assetLocation, unitsPerSecond]);1039 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.setAssetUnitsPerSecond', [assetLocation, unitsPerSecond]);
10331040
1034 console.log('4. Transfer 1 SDN to recepient');1041 console.log('4. Transfer 1 SDN to recepient');
1035 await helper.balance.transferToSubstrate(alice, randomAccount.address, shidenInitialBalance);1042 await helper.balance.transferToSubstrate(alice, sender.address, shidenInitialBalance);
1036 });1043 });
1037 });1044 });
10381045
1055 X1: {1062 X1: {
1056 AccountId32: {1063 AccountId32: {
1057 network: 'Any',1064 network: 'Any',
1058 id: randomAccount.addressRaw,1065 id: sender.addressRaw,
1059 },1066 },
1060 },1067 },
1061 },1068 },
1072 },1079 },
1073 },1080 },
1074 fun: {1081 fun: {
1075 Fungible: qtzToShidenAmount,1082 Fungible: qtzToShidenTransferred,
1076 },1083 },
1077 },1084 },
1078 ],1085 ],
1079 };1086 };
10801087
1081 // Initial balance is 100 UNQ1088 // Initial balance is 100 QTZ
1082 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(100n * (10n ** 18n));1089 const balanceBefore = await helper.balance.getSubstrate(sender.address);
1090 console.log(`Initial balance is: ${balanceBefore}`);
1091 expect(balanceBefore).to.eq(senderIinitialBalanceQTZ);
10831092
1084 const feeAssetItem = 0;1093 const feeAssetItem = 0;
1085 await helper.xcm.limitedReserveTransferAssets(randomAccount, destination, beneficiary, assets, feeAssetItem, 'Unlimited');1094 await helper.xcm.limitedReserveTransferAssets(sender, destination, beneficiary, assets, feeAssetItem, 'Unlimited');
10861095
1087 // Balance after reserve transfer is less than 901096 // Balance after reserve transfer is less than 90
1088 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(89_941967662676666465n);1097 const balanceAfter = await helper.balance.getSubstrate(sender.address);
1098 console.log(`QTZ Balance on Quartz after XCM is: ${balanceAfter}`);
1099 console.log(`Quartz's QTZ commission is: ${balanceBefore - balanceAfter}`);
1100 expect(balanceAfter).to.eq(senderBalanceAfterXCM);
10891101
1090 await usingAstarPlaygrounds(shidenUrl, async (helper) => {1102 await usingShidenPlaygrounds(shidenUrl, async (helper) => {
1091 await helper.wait.newBlocks(3);1103 await helper.wait.newBlocks(3);
1092 const xcUNQbalance = await helper.assets.account(1, randomAccount.address);1104 const xcQTZbalance = await helper.assets.account(1, sender.address);
1093 const astarBalance = await helper.balance.getSubstrate(randomAccount.address);1105 const shidenBalance = await helper.balance.getSubstrate(sender.address);
1106
1107 console.log(`xcQTZ balance on Shiden after XCM is: ${xcQTZbalance}`);
1108 console.log(`Shiden's QTZ commission is: ${qtzToShidenTransferred - xcQTZbalance!}`);
10941109
1095 expect(xcUNQbalance).to.eq(9_999_999_999_088_000_000n);1110 expect(xcQTZbalance).to.eq(qtzToShidenArrived);
1096 // Astar balance does not changed1111 // SHD balance does not changed:
1097 expect(astarBalance).to.eq(1_000_000_000_000_000_000n);1112 expect(shidenBalance).to.eq(shidenInitialBalance);
1098 });1113 });
1099 });1114 });
11001115
1101 itSub.only('Should connect to Shiden and send QTZ back', async ({helper}) => {1116 itSub.only('Should connect to Shiden and send QTZ back', async ({helper}) => {
1102 await usingAstarPlaygrounds(shidenUrl, async (helper) => {1117 await usingShidenPlaygrounds(shidenUrl, async (helper) => {
1103 const destination = {1118 const destination = {
1104 V1: {1119 V1: {
1105 parents: 1,1120 parents: 1,
1118 X1: {1133 X1: {
1119 AccountId32: {1134 AccountId32: {
1120 network: 'Any',1135 network: 'Any',
1121 id: randomAccount.addressRaw,1136 id: sender.addressRaw,
1122 },1137 },
1123 },1138 },
1124 },1139 },
1139 },1154 },
1140 },1155 },
1141 fun: {1156 fun: {
1142 Fungible: 5_000_000_000_000_000_000n,1157 Fungible: qtzFromShidenTransfered,
1143 },1158 },
1144 },1159 },
1145 ],1160 ],
1146 };1161 };
11471162
1148 // Initial balance is 1 SDN1163 // Initial balance is 1 SDN
1149 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(1_000_000_000_000_000_000n);1164 const balanceSDNbefore = await helper.balance.getSubstrate(sender.address);
1165 console.log(`SDN balance is: ${balanceSDNbefore}, it does not changed`);
1166 expect(balanceSDNbefore).to.eq(shidenInitialBalance);
11501167
1151 const feeAssetItem = 0;1168 const feeAssetItem = 0;
1169 // this is non-standard polkadotXcm extension for Astar only. It calls InitiateReserveWithdraw
1152 await helper.executeExtrinsic(randomAccount, 'api.tx.polkadotXcm.reserveWithdrawAssets', [destination, beneficiary, assets, feeAssetItem]);1170 await helper.executeExtrinsic(sender, 'api.tx.polkadotXcm.reserveWithdrawAssets', [destination, beneficiary, assets, feeAssetItem]);
11531171
1154 // Balance after reserve transfer is less than 1 SDN1172 // Balance after reserve transfer is less than 1 SDN
1155 const xcUNQbalance = await helper.assets.account(1, randomAccount.address);1173 const xcQTZbalance = await helper.assets.account(1, sender.address);
1156 const balanceSDN = await helper.balance.getSubstrate(randomAccount.address);1174 const balanceSDN = await helper.balance.getSubstrate(sender.address);
1175 console.log(`xcQTZ balance on Shiden after XCM is: ${xcQTZbalance}`);
11571176
1158 // Assert: xcQTZ balance decreased1177 // Assert: xcQTZ balance correctly decreased
1159 expect(xcUNQbalance).to.eq(4_999_999_999_088_000_000n);1178 expect(xcQTZbalance).to.eq(qtzOnShidenLeft);
1160 // Assert: SDN balance is 0.996...1179 // Assert: SDN balance is 0.996...
1161 expect(balanceSDN / (10n ** 15n)).to.eq(996n);1180 expect(balanceSDN / (10n ** 15n)).to.eq(996n);
1162 });1181 });
11631182
1164 await helper.wait.newBlocks(3);1183 await helper.wait.newBlocks(3);
1165 const balanceUNQ = await helper.balance.getSubstrate(randomAccount.address);1184 const balanceQTZ = await helper.balance.getSubstrate(sender.address);
1185 console.log(`QTZ Balance on Quartz after XCM is: ${balanceQTZ}`);
1166 expect(balanceUNQ).to.eq(89_941967662676666465n + 5_000_000_000_000_000_000n);1186 expect(balanceQTZ).to.eq(senderBalanceAfterXCM + qtzFromShidenTransfered);
1167 });1187 });
1168});1188});
11691189
modifiedtests/src/xcm/xcmUnique.test.tsdiffbeforeafterboth
987 let alice: IKeyringPair;987 let alice: IKeyringPair;
988 let randomAccount: IKeyringPair;988 let randomAccount: IKeyringPair;
989989
990 // Unique -> Astar
990 const astarInitialBalance = 1n * (10n ** 18n);991 const astarInitialBalance = 1n * (10n ** 18n); // 1 ASTR. Existencial deposit required in order to perform XCM call
992 const unitsPerSecond = 228_000_000_000n; // This is Phala's value. What will be ours?
991 const unqToAstarAmount = 10n * (10n ** 18n);993 const unqToAstarTransferred = 10n * (10n ** 18n); // 10 UNQ
994 const unqToAstarArrived = 9_999_999_999_088_000_000n; // 9.999 ... UNQ, Shiden takes a commision in foreign tokens
995 const senderIinitialBalanceUNQ = 100n * (10n ** 18n); // How many UNQ sender has initially
996 const senderBalanceAfterXCM = 89_941967662676666465n; // 89.94... UNQ after XCM call
997
998 // Astar -> Unique
999 const unqFromAstarTransfered = 5n * (10n ** 18n); // 5 UNQ
1000 const unqOnAstarLeft = unqToAstarArrived - unqFromAstarTransfered; // 4.999_999_999_088_000_000n UNQ
9921001
993 before(async () => {1002 before(async () => {
994 await usingPlaygrounds(async (helper, privateKey) => {1003 await usingPlaygrounds(async (helper, privateKey) => {
1029 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.registerAssetLocation', [assetLocation, 1]);1038 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.registerAssetLocation', [assetLocation, 1]);
10301039
1031 console.log('3. Set payment for computation');1040 console.log('3. Set payment for computation');
1032 // TODO this is Phala's price, what price will be for Unique?
1033 const unitsPerSecond = 228_000_000_000n;
1034 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.setAssetUnitsPerSecond', [assetLocation, unitsPerSecond]);1041 await helper.getSudo().executeExtrinsic(alice, 'api.tx.xcAssetConfig.setAssetUnitsPerSecond', [assetLocation, unitsPerSecond]);
10351042
1036 console.log('4. Transfer 1 ASTR to recepient');1043 console.log('4. Transfer 1 ASTR to recepient');
1074 },1081 },
1075 },1082 },
1076 fun: {1083 fun: {
1077 Fungible: unqToAstarAmount,1084 Fungible: unqToAstarTransferred,
1078 },1085 },
1079 },1086 },
1080 ],1087 ],
1081 };1088 };
10821089
1083 // Initial balance is 100 UNQ1090 // Initial balance is 100 UNQ
1084 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(100n * (10n ** 18n));1091 const balanceBefore = await helper.balance.getSubstrate(randomAccount.address);
1092 console.log(`Initial balance is: ${balanceBefore}`);
1093 expect(balanceBefore).to.eq(senderIinitialBalanceUNQ);
10851094
1086 const feeAssetItem = 0;1095 const feeAssetItem = 0;
1087 await helper.xcm.limitedReserveTransferAssets(randomAccount, destination, beneficiary, assets, feeAssetItem, 'Unlimited');1096 await helper.xcm.limitedReserveTransferAssets(randomAccount, destination, beneficiary, assets, feeAssetItem, 'Unlimited');
10881097
1089 // Balance after reserve transfer is less than 901098 // Balance after reserve transfer is less than 90
1090 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(89_941967662676666465n);1099 const balanceAfter = await helper.balance.getSubstrate(randomAccount.address);
1100 console.log(`UNQ Balance on Unique after XCM is: ${balanceAfter}`);
1101 console.log(`Unique's UNQ commission is: ${balanceBefore - balanceAfter}`);
1102 expect(balanceAfter).to.eq(senderBalanceAfterXCM);
10911103
1092 await usingAstarPlaygrounds(astarUrl, async (helper) => {1104 await usingAstarPlaygrounds(astarUrl, async (helper) => {
1093 await helper.wait.newBlocks(3);1105 await helper.wait.newBlocks(3);
1094 const xcUNQbalance = await helper.assets.account(1, randomAccount.address);1106 const xcUNQbalance = await helper.assets.account(1, randomAccount.address);
1095 const astarBalance = await helper.balance.getSubstrate(randomAccount.address);1107 const astarBalance = await helper.balance.getSubstrate(randomAccount.address);
1108
1109 console.log(`xcUNQ balance on Astar after XCM is: ${xcUNQbalance}`);
1110 console.log(`Astar's UNQ commission is: ${unqToAstarTransferred - xcUNQbalance!}`);
10961111
1097 expect(xcUNQbalance).to.eq(9_999_999_999_088_000_000n);1112 expect(xcUNQbalance).to.eq(unqToAstarArrived);
1098 // Astar balance does not changed1113 // Astar balance does not changed
1099 expect(astarBalance).to.eq(1_000_000_000_000_000_000n);1114 expect(astarBalance).to.eq(astarInitialBalance);
1100 });1115 });
1101 });1116 });
11021117
1141 },1156 },
1142 },1157 },
1143 fun: {1158 fun: {
1144 Fungible: 5_000_000_000_000_000_000n,1159 Fungible: unqFromAstarTransfered,
1145 },1160 },
1146 },1161 },
1147 ],1162 ],
1148 };1163 };
11491164
1150 // Initial balance is 1 ASTR1165 // Initial balance is 1 ASTR
1151 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(1_000_000_000_000_000_000n);1166 const balanceASTRbefore = await helper.balance.getSubstrate(randomAccount.address);
1167 console.log(`ASTR balance is: ${balanceASTRbefore}, it does not changed`);
1168 expect(balanceASTRbefore).to.eq(astarInitialBalance);
11521169
1153 const feeAssetItem = 0;1170 const feeAssetItem = 0;
1171 // this is non-standard polkadotXcm extension for Astar only. It calls InitiateReserveWithdraw
1154 await helper.executeExtrinsic(randomAccount, 'api.tx.polkadotXcm.reserveWithdrawAssets', [destination, beneficiary, assets, feeAssetItem]);1172 await helper.executeExtrinsic(randomAccount, 'api.tx.polkadotXcm.reserveWithdrawAssets', [destination, beneficiary, assets, feeAssetItem]);
11551173
1156 const xcUNQbalance = await helper.assets.account(1, randomAccount.address);1174 const xcUNQbalance = await helper.assets.account(1, randomAccount.address);
1157 const balanceAstar = await helper.balance.getSubstrate(randomAccount.address);1175 const balanceAstar = await helper.balance.getSubstrate(randomAccount.address);
1176 console.log(`xcUNQ balance on Astar after XCM is: ${xcUNQbalance}`);
11581177
1159 // Assert: xcUNQ balance decreased1178 // Assert: xcUNQ balance correctly decreased
1160 expect(xcUNQbalance).to.eq(4_999_999_999_088_000_000n);1179 expect(xcUNQbalance).to.eq(unqOnAstarLeft);
1161 // Assert: ASTR balance is 0.996...1180 // Assert: ASTR balance is 0.996...
1162 expect(balanceAstar / (10n ** 15n)).to.eq(996n);1181 expect(balanceAstar / (10n ** 15n)).to.eq(996n);
1163 });1182 });
11641183
1165 await helper.wait.newBlocks(3);1184 await helper.wait.newBlocks(3);
1166 const balanceUNQ = await helper.balance.getSubstrate(randomAccount.address);1185 const balanceUNQ = await helper.balance.getSubstrate(randomAccount.address);
1186 console.log(`UNQ Balance on Unique after XCM is: ${balanceUNQ}`);
1167 expect(balanceUNQ).to.eq(89_941967662676666465n + 5_000_000_000_000_000_000n);1187 expect(balanceUNQ).to.eq(senderBalanceAfterXCM + unqFromAstarTransfered);
1168 });1188 });
11691189
1170 itSub.skip('Should not accept limitedReserveTransfer of UNQ from ASTAR', async ({helper}) => {1190 itSub.skip('Should not accept limitedReserveTransfer of UNQ from ASTAR', async ({helper}) => {
1208 },1228 },
1209 },1229 },
1210 fun: {1230 fun: {
1211 Fungible: 5_000_000_000_000_000_000n, // TODO set another value1231 Fungible: unqFromAstarTransfered,
1212 },1232 },
1213 },1233 },
1214 ],1234 ],
1215 };1235 };
12161236
1217 // Initial balance is 1 ASTAR1237 // Initial balance is 1 ASTAR
1218 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(1_000_000_000_000_000_000n);1238 expect(await helper.balance.getSubstrate(randomAccount.address)).to.eq(astarInitialBalance);
12191239
1220 const feeAssetItem = 0;1240 const feeAssetItem = 0;
1241 // TODO: expect rejected:
1221 await helper.xcm.limitedReserveTransferAssets(randomAccount, destination, beneficiary, assets, feeAssetItem, 'Unlimited');1242 await helper.xcm.limitedReserveTransferAssets(randomAccount, destination, beneficiary, assets, feeAssetItem, 'Unlimited');
1222
1223 // Balance after reserve transfer is less than 1 ASTAR
1224 const xcUNQbalance = await helper.assets.account(1, randomAccount.address);
1225 const balanceAstar = await helper.balance.getSubstrate(randomAccount.address);
1226
1227 // xcUNQ balance decreased
1228 expect(xcUNQbalance).to.eq(4_999_999_999_088_000_000n);
1229 // Astar balance is 0.997...
1230 expect(balanceAstar / (10n ** 15n)).to.eq(997n);
1231 });1243 });
1232
1233 await helper.wait.newBlocks(3);
1234 const balanceUNQ = await helper.balance.getSubstrate(randomAccount.address);
1235 expect(balanceUNQ).to.eq(89_941967662676666465n + 5_000_000_000_000_000_000n);
1236 });1244 });
1237});1245});
12381246