Skip to content

Commit

Permalink
add liquid crowdloan (#109)
Browse files Browse the repository at this point in the history
* add liquid crowdloan

* update
  • Loading branch information
xlc authored Sep 11, 2023
1 parent 6cb3697 commit 24cd89e
Show file tree
Hide file tree
Showing 10 changed files with 469 additions and 31 deletions.
24 changes: 24 additions & 0 deletions networks/acala-next.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Config } from './types'

import acalaConfig, { Vars } from './acala'

export default {
...acalaConfig,
polkadot: {
...acalaConfig.polkadot,
name: 'acalaNext' as const,
},
kusama: {
...acalaConfig.kusama,
name: 'karuraNext' as const,
},
config: (opt) => ({
...acalaConfig.config(opt),
options: {
wasmOverride: {
polkadot: './wasm/acala_runtime.wasm',
kusama: './wasm/karura_runtime.wasm',
}[opt.network],
},
}),
} satisfies Config<Vars>
1 change: 1 addition & 0 deletions networks/acala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const acala = {
wbtc: { ForeignAsset: 5 },
ausd: { Token: 'AUSD' },
aca: { Token: 'ACA' },
lcdot: { LiquidCrowdloan: 13 },
} as const

export const karura = {
Expand Down
2 changes: 2 additions & 0 deletions networks/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Config } from './types'

import acala2200Config from './acala2200'
import acalaConfig from './acala'
import acalaNextConfig from './acala-next'
import astarConfig from './astar'
import bifrostConfig from './bifrost'
import centrifugeConfig from './centrifuge'
Expand All @@ -20,6 +21,7 @@ const all = {
acala: acalaConfig,
astar: astarConfig,
acala2200: acala2200Config,
acalaNext: acalaNextConfig,
moonbeam: moonbeamConfig,
hydraDX: hydraDXConfig,
bifrost: bifrostConfig,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"@polkadot/api": "^10.9.1"
},
"dependencies": {
"@acala-network/chopsticks": "^0.8.0-5",
"@acala-network/chopsticks-testing": "^0.8.0-5",
"@acala-network/chopsticks": "^0.8.0-6",
"@acala-network/chopsticks-testing": "^0.8.0-6",
"@acala-network/sdk": "^4.1.9-2",
"@acala-network/sdk-core": "^4.1.9-2",
"@polkadot/api": "^10.9.1",
Expand Down
298 changes: 298 additions & 0 deletions tests/acala/__snapshots__/liquid-crowdloan.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`liquid crowdloan > works > after all transfer relaychain events 1`] = `
[
{
"data": {
"id": "(hash)",
"origin": {
"Ump": {
"Para": 2000,
},
},
"success": false,
"weightUsed": {
"proofSize": 0,
"refTime": 1000000000,
},
},
"method": "Processed",
"section": "messageQueue",
},
{
"data": [
{
"Complete": {
"proofSize": 0,
"refTime": 2000000000,
},
},
],
"method": "Attempted",
"section": "xcmPallet",
},
{
"data": {
"result": "Ok",
},
"method": "ProxyExecuted",
"section": "proxy",
},
{
"data": {
"id": "(hash)",
"origin": {
"Ump": {
"Para": 2000,
},
},
"success": true,
"weightUsed": {
"proofSize": "(rounded 66000)",
"refTime": 55000000000,
},
},
"method": "Processed",
"section": "messageQueue",
},
]
`;

exports[`liquid crowdloan > works > after all transfer ump 1`] = `
[
{
"v2": [
{
"withdrawAsset": [
{
"fun": {
"fungible": 20000000000,
},
"id": {
"concrete": {
"interior": {
"here": null,
},
"parents": 0,
},
},
},
],
},
{
"buyExecution": {
"fees": {
"fun": {
"fungible": 20000000000,
},
"id": {
"concrete": {
"interior": {
"here": null,
},
"parents": 0,
},
},
},
"weightLimit": {
"unlimited": null,
},
},
},
{
"transact": {
"call": {
"encoded": "0x1d000059fe89295c2e57d7b4d4d8be9e00a3802e513703ab4b5b424ed0a646e899d3c900630803000100411f03000101006d6f646c6163612f6c71636c000000000000000000000000000000000000000003040000000013e7db26b01ac758030000000000",
},
"originType": "SovereignAccount",
"requireWeightAtMost": 50000000000,
},
},
{
"refundSurplus": null,
},
{
"depositAsset": {
"assets": {
"wild": {
"all": null,
},
},
"beneficiary": {
"interior": {
"x1": {
"parachain": 2000,
},
},
"parents": 0,
},
"maxAssets": 1,
},
},
],
},
]
`;

exports[`liquid crowdloan > works > first redeem 1`] = `
[
{
"data": {
"amount": 90000000000,
"currencyId": {
"Token": "DOT",
},
},
"method": "Redeemed",
"section": "liquidCrowdloan",
},
]
`;

exports[`liquid crowdloan > works > pallet account balance 1`] = `
{
"free": 99999216661,
"frozen": 0,
"reserved": 0,
}
`;

exports[`liquid crowdloan > works > pallet account balance after all transfer 1`] = `
{
"free": "0x00000000000000000358c71d041ad811",
"frozen": 0,
"reserved": 0,
}
`;

exports[`liquid crowdloan > works > second redeem 1`] = `
[
{
"data": {
"amount": 4000000000000,
"currencyId": {
"Token": "DOT",
},
},
"method": "Redeemed",
"section": "liquidCrowdloan",
},
]
`;

exports[`liquid crowdloan > works > system events 1`] = `
[
{
"data": [
{
"Complete": {
"proofSize": 0,
"refTime": 2000000000,
},
},
],
"method": "Attempted",
"section": "xcmPallet",
},
{
"data": {
"result": "Ok",
},
"method": "ProxyExecuted",
"section": "proxy",
},
{
"data": {
"id": "(hash)",
"origin": {
"Ump": {
"Para": 2000,
},
},
"success": true,
"weightUsed": {
"proofSize": "(rounded 66000)",
"refTime": 55000000000,
},
},
"method": "Processed",
"section": "messageQueue",
},
]
`;

exports[`liquid crowdloan > works > ump 1`] = `
[
{
"v2": [
{
"withdrawAsset": [
{
"fun": {
"fungible": 20000000000,
},
"id": {
"concrete": {
"interior": {
"here": null,
},
"parents": 0,
},
},
},
],
},
{
"buyExecution": {
"fees": {
"fun": {
"fungible": 20000000000,
},
"id": {
"concrete": {
"interior": {
"here": null,
},
"parents": 0,
},
},
},
"weightLimit": {
"unlimited": null,
},
},
},
{
"transact": {
"call": {
"encoded": "0x1d000059fe89295c2e57d7b4d4d8be9e00a3802e513703ab4b5b424ed0a646e899d3c900630803000100411f03000101006d6f646c6163612f6c71636c00000000000000000000000000000000000000000304000000000700e87648170000000000",
},
"originType": "SovereignAccount",
"requireWeightAtMost": 50000000000,
},
},
{
"refundSurplus": null,
},
{
"depositAsset": {
"assets": {
"wild": {
"all": null,
},
},
"beneficiary": {
"interior": {
"x1": {
"parachain": 2000,
},
},
"parents": 0,
},
"maxAssets": 1,
},
},
],
},
]
`;
Loading

0 comments on commit 24cd89e

Please sign in to comment.