Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Solver workspace #156

Merged
merged 7 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.PHONY: clean
clean:
rm -rf node_modules
npm run clean
cd solana && $(MAKE) clean

.PHONY: clean-install
Expand Down
7 changes: 5 additions & 2 deletions evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
"build:esm": "tsc -p tsconfig.esm.json",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build": "npm run build:esm && npm run build:cjs",
"generate": "typechain --target=ethers-v5 --out-dir=ts/src/types out/*/*.json"
"generate": "typechain --target=ethers-v5 --out-dir=ts/src/types out/*/*.json",
"clean":"rm -rf dist && rm -rf node_modules"
},
"dependencies": {
"@wormhole-foundation/sdk":"^0.7.0-beta.3",
"@wormhole-foundation/sdk-base":"^0.7.0-beta.4",
"@wormhole-foundation/sdk-definitions":"^0.7.0-beta.4",
"@wormhole-foundation/sdk-evm":"^0.7.0-beta.4",
"@wormhole-foundation/example-liquidity-layer-definitions":"0.0.1",
"ethers": "^5.7.2"
},
Expand Down
3 changes: 2 additions & 1 deletion evm/ts/scripts/set_fast_transfer_parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { getConfig } from "./helpers";
import { ITokenRouter__factory } from "../src/types/factories/ITokenRouter__factory";
import { ITokenRouter, FastTransferParametersStruct } from "../src/types/ITokenRouter";
import { ethers } from "ethers";
import { Chain, toChainId, toNative, toUniversal, toChain } from "@wormhole-foundation/sdk";
import { toChain, toChainId } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";

export function getArgs() {
const argv = require("yargs")
Expand Down
3 changes: 2 additions & 1 deletion evm/ts/scripts/setup_matching_engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { getConfig, ZERO_BYTES32 } from "./helpers";
import { IMatchingEngine__factory, IMatchingEngine } from "../src/types/";
import { RouterEndpointStruct } from "../src/types/IMatchingEngine";
import { ethers } from "ethers";
import { ChainId, toChain, toChainId, toNative, toUniversal } from "@wormhole-foundation/sdk";
import { ChainId, toChain, toChainId } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";

export function getArgs() {
const argv = require("yargs")
Expand Down
4 changes: 3 additions & 1 deletion evm/ts/scripts/setup_token_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { ITokenRouter__factory } from "../src/types/factories/ITokenRouter__fact
import { ITokenRouter } from "../src/types/ITokenRouter";
import { EndpointStruct } from "../src/types/ITokenRouter";
import { ethers } from "ethers";
import { toChain, toChainId, toNative, toUniversal } from "@wormhole-foundation/sdk";
import { toChain, toChainId } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";
import "@wormhole-foundation/sdk-evm";

export function getArgs() {
const argv = require("yargs")
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/src/MatchingEngine/evm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "@wormhole-foundation/sdk";
import { ChainId } from "@wormhole-foundation/sdk-base";
import { ethers } from "ethers";
import { RouterEndpoint, LiveAuctionData, MatchingEngine, RedeemParameters } from ".";
import { LiquidityLayerTransactionResult } from "..";
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/src/TokenRouter/evm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "@wormhole-foundation/sdk";
import { ChainId } from "@wormhole-foundation/sdk-base";
import { ethers } from "ethers";
import { Endpoint, OrderResponse, TokenRouter, FastTransferParameters } from ".";
import { LiquidityLayerTransactionResult } from "..";
Expand Down
1 change: 0 additions & 1 deletion evm/ts/src/TokenRouter/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { VAA } from "@wormhole-foundation/sdk";
import { LiquidityLayerTransactionResult, PreparedInstruction } from "..";
import { ethers } from "ethers";
export * from "./evm";
Expand Down
5 changes: 0 additions & 5 deletions evm/ts/src/consts.ts

This file was deleted.

1 change: 0 additions & 1 deletion evm/ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ethers } from "ethers";

export * from "./MatchingEngine";
export * from "./TokenRouter";
export * from "./consts";
export * from "./error";
export * from "./messages";
export * from "./utils";
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
messages,
payloads,
} from "@wormhole-foundation/example-liquidity-layer-definitions";
import { toChainId } from "@wormhole-foundation/sdk";
import { toChainId } from "@wormhole-foundation/sdk-base";

export type LiquidityLayerMessageBody = {
fill?: Fill;
Expand Down
4 changes: 2 additions & 2 deletions evm/ts/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Message } from "@wormhole-foundation/example-liquidity-layer-definitions";
import { ChainId, toChain, toUniversal } from "@wormhole-foundation/sdk";
import { ChainId, toChain } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";
import { ethers } from "ethers";
import { CoreBridgeLiquidityLayerMessage, MessageDecoder } from "./messages";

Expand Down
4 changes: 3 additions & 1 deletion evm/ts/tests/01__registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
LiquidityLayerEnv,
} from "./helpers";
import { expect } from "chai";
import { toChainId, toNative, toUniversal } from "@wormhole-foundation/sdk";
import { toChainId } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";
import "@wormhole-foundation/sdk-evm";

const CHAIN_PATHWAYS: ValidNetwork[] = ["Ethereum", "Avalanche", "Base"];

Expand Down
3 changes: 2 additions & 1 deletion evm/ts/tests/02__configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
parseLiquidityLayerEnvFile,
} from "./helpers";
import { expect } from "chai";
import { toNative, toUniversal } from "@wormhole-foundation/sdk";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";
import "@wormhole-foundation/sdk-evm";

const CHAIN_PATHWAYS: ValidNetwork[] = ["Ethereum", "Avalanche", "Base"];

Expand Down
2 changes: 1 addition & 1 deletion evm/ts/tests/03__marketOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
parseLiquidityLayerEnvFile,
tryNativeToUint8Array,
} from "./helpers";
import { serialize, toChainId } from "@wormhole-foundation/sdk";
import { toChainId } from "@wormhole-foundation/sdk-base";

const CHAIN_PATHWAYS: ValidNetwork[][] = [
["Ethereum", "Avalanche"],
Expand Down
5 changes: 4 additions & 1 deletion evm/ts/tests/04__fastMarketOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ import {
mineToPenaltyPeriod,
tryNativeToUint8Array,
} from "./helpers";
import { deserialize, keccak256, toChainId, toUniversal } from "@wormhole-foundation/sdk";

import { toChainId } from "@wormhole-foundation/sdk-base";
import { deserialize, keccak256, toUniversal } from "@wormhole-foundation/sdk-definitions";
import "@wormhole-foundation/sdk-evm";

// Cannot send a fast market order from the matching engine chain.
const CHAIN_PATHWAYS: ValidNetwork[][] = [
Expand Down
2 changes: 1 addition & 1 deletion evm/ts/tests/helpers/mock/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chain } from "@wormhole-foundation/sdk";
import { Chain } from "@wormhole-foundation/sdk-base";
import { ethers } from "ethers";

export * from "./circleAttester";
Expand Down
4 changes: 2 additions & 2 deletions evm/ts/tests/helpers/mock/wormhole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { ethers } from "ethers";
import { EvmObserver } from ".";
import { parseEvmEvents, parseEvmEvent } from "../../../src";
import { GUARDIAN_PRIVATE_KEY, WORMHOLE_GUARDIAN_SET_INDEX } from "../consts";
import { Chain, VAA, contracts, serialize, toUniversal } from "@wormhole-foundation/sdk";
import { Chain, contracts } from "@wormhole-foundation/sdk-base";
import { serialize, toUniversal } from "@wormhole-foundation/sdk-definitions";
import { mocks } from "@wormhole-foundation/sdk-definitions/testing";
import { tryNativeToUint8Array } from "../utils";

export class GuardianNetwork implements EvmObserver<Uint8Array> {
guardians: mocks.MockGuardians;
Expand Down
3 changes: 2 additions & 1 deletion evm/ts/tests/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { IERC20 } from "../../src/types";
import { IUSDC__factory } from "../../src/types/factories/IUSDC__factory";
import { WALLET_PRIVATE_KEYS } from "./consts";
import { EvmMatchingEngine } from "../../src";
import { Chain, toUniversal } from "@wormhole-foundation/sdk";
import { Chain } from "@wormhole-foundation/sdk-base";
import { toUniversal } from "@wormhole-foundation/sdk-definitions";

export interface ScoreKeeper {
player: ethers.Wallet;
Expand Down
Loading
Loading