Skip to content

Commit

Permalink
supports karura homa router (#58)
Browse files Browse the repository at this point in the history
* supports karura homa router

* use node 18

* update

* update url

* update url
  • Loading branch information
shunjizhan authored Jan 31, 2024
1 parent 6665ae3 commit f2b26a8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18

- name: setup yarn
run: npm install -g yarn
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine as relayer
FROM node:18-alpine as relayer
LABEL maintainer="[email protected]"

USER node
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acala-wormhole-relayer",
"version": "1.6.0",
"version": "1.6.1",
"description": "",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -22,7 +22,7 @@
},
"dependencies": {
"@acala-network/api": "~6.0.4",
"@acala-network/asset-router": "~1.0.13",
"@acala-network/asset-router": "~1.0.16",
"@acala-network/bodhi": "~2.7.13",
"@acala-network/contracts": "^4.5.0",
"@acala-network/eth-providers": "~2.7.14",
Expand Down
8 changes: 5 additions & 3 deletions src/api/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DOT } from '@acala-network/contracts/utils/AcalaTokens';
import { EuphratesFactory__factory, Factory__factory, HomaFactory__factory } from '@acala-network/asset-router/dist/typechain-types';
import { KSM } from '@acala-network/contracts/utils/KaruraTokens';
import { XcmInstructionsStruct } from '@acala-network/asset-router/dist/typechain-types/src/Factory';

import {
Expand Down Expand Up @@ -166,8 +167,8 @@ export const shouldRouteHoma = async ({ chain, destAddr }: RouteParamsHoma) =>
};

export const routeHoma = async ({ chain, destAddr }: RouteParamsHoma) => {
const { homaFactory, feeAddr } = await prepareRouteHoma(chain);
const tx = await homaFactory.deployHomaRouterAndRoute(feeAddr, toAddr32(destAddr), DOT);
const { homaFactory, feeAddr, routeToken } = await prepareRouteHoma(chain);
const tx = await homaFactory.deployHomaRouterAndRoute(feeAddr, toAddr32(destAddr), routeToken);
const receipt = await tx.wait();

return receipt.transactionHash;
Expand All @@ -179,8 +180,9 @@ const prepareRouteHoma = async (chain: Mainnet) => {
const { feeAddr, homaFactoryAddr, wallet } = chainConfig;

const homaFactory = HomaFactory__factory.connect(homaFactoryAddr!, wallet);
const routeToken = chain === Mainnet.Acala ? DOT : KSM;

return { homaFactory, feeAddr };
return { homaFactory, feeAddr, routeToken };
};

export const shouldRouteEuphrates = async (params: RouteParamsEuphrates) => {
Expand Down
6 changes: 3 additions & 3 deletions src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const enum FUJI_TOKEN {
};

export const WORMHOLE_GUARDIAN_RPC = {
TESTNET: ['https://wormhole-v2-testnet-api.certus.one'],
MAINNET: ['https://wormhole-v2-mainnet-api.certus.one'],
TESTNET: ['https://api.testnet.wormholescan.io'],
MAINNET: ['https://api.wormholescan.io'],
};

const RELAYER_BASE_URL = 'http://localhost:3111';
Expand Down Expand Up @@ -249,4 +249,4 @@ export const TESTNET_MODE_WARNING = `
export const EUPHRATES_ADDR = '0x7Fe92EC600F15cD25253b421bc151c51b0276b7D';
export const EUPHRATES_POOLS = ['0', '1', '2', '3'];

export const VERSION = '1.6.0';
export const VERSION = '1.6.1';
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"@acala-network/api-derive" "6.0.4"
"@acala-network/types" "6.0.4"

"@acala-network/asset-router@~1.0.13":
version "1.0.13"
resolved "https://registry.yarnpkg.com/@acala-network/asset-router/-/asset-router-1.0.13.tgz#0ad0e8ce8bd462a7291a6bf8f951bd24f83ea0e4"
integrity sha512-J0W5MSVKYIz/cgx9KVCqe9NLkg+FdRrAl6BqCZzZkj8JPcQhUlxgW7TP/s3yYr/5MXk3wDb69z/f2cBWGjhbxw==
"@acala-network/asset-router@~1.0.16":
version "1.0.16"
resolved "https://registry.yarnpkg.com/@acala-network/asset-router/-/asset-router-1.0.16.tgz#03e8ad6559fb7d84786ea34cbf6bb8ccfacefe3e"
integrity sha512-cgMU2d+kJVmPcaxyg0iIedi/Csl/5l8mPg4c4ZTkCZtYd8kB17WG2KqZ5sp2b6XvV/8+IAknagmtNEl3eXGwjQ==
dependencies:
"@acala-network/contracts" "^4.5.0"
"@acala-network/eth-providers" "^2.7.13"
Expand Down

0 comments on commit f2b26a8

Please sign in to comment.