-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip test maintenance mode * finish tests * add test for assets.transfer * simple test for xcm transactor, rest wip * finalise tests * apply feedback
- Loading branch information
1 parent
7a540e1
commit 4f7fae3
Showing
10 changed files
with
534 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import Keyring from "@polkadot/keyring"; | ||
import { expect } from "chai"; | ||
import { BN } from "@polkadot/util"; | ||
import { ALITH, ALITH_PRIV_KEY, BALTATHAR } from "../util/constants"; | ||
|
||
import { describeDevMoonbeam } from "../util/setup-dev-tests"; | ||
import { createBlockWithExtrinsic } from "../util/substrate-rpc"; | ||
import { mockAssetBalance } from "./test-precompile/test-precompile-assets-erc20"; | ||
|
||
const TEST_ACCOUNT = "0x1111111111111111111111111111111111111111"; | ||
|
||
describeDevMoonbeam("Pallet Assets Pallet - assets transfer", (context) => { | ||
let sudoAccount, assetId; | ||
before("Try turning maintenance mode on", async () => { | ||
const keyring = new Keyring({ type: "ethereum" }); | ||
sudoAccount = await keyring.addFromUri(ALITH_PRIV_KEY, null, "ethereum"); | ||
|
||
// We need to mint units with sudo.setStorage, as we dont have xcm mocker yet | ||
// And we need relay tokens for issuing a transaction to be executed in the relay | ||
const balance = context.polkadotApi.createType("Balance", 100000000000000); | ||
const assetBalance = context.polkadotApi.createType("PalletAssetsAssetBalance", { | ||
balance: balance, | ||
}); | ||
|
||
assetId = context.polkadotApi.createType( | ||
"u128", | ||
new BN("42259045809535163221576417993425387648") | ||
); | ||
const assetDetails = context.polkadotApi.createType("PalletAssetsAssetDetails", { | ||
supply: balance, | ||
}); | ||
|
||
await mockAssetBalance(context, assetBalance, assetDetails, sudoAccount, assetId, ALITH); | ||
|
||
await createBlockWithExtrinsic( | ||
context, | ||
sudoAccount, | ||
context.polkadotApi.tx.assets.transfer(assetId, BALTATHAR, 1000) | ||
); | ||
}); | ||
|
||
it("should transfer asset", async function () { | ||
// Baltathar balance is 1000 | ||
let baltatharBalance = (await context.polkadotApi.query.assets.account( | ||
assetId, | ||
BALTATHAR | ||
)) as any; | ||
expect(baltatharBalance.balance.eq(new BN(1000))).to.equal(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.