Skip to content

Commit

Permalink
feat: Import constants-v2 (#964)
Browse files Browse the repository at this point in the history
* feat: Import constants-v2

Signed-off-by: nicholaspai <npai.nyc@gmail.com>

* Update package.json

---------

Signed-off-by: nicholaspai <npai.nyc@gmail.com>
  • Loading branch information
nicholaspai authored Oct 3, 2023
1 parent fc471e1 commit 9da0a15
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"@across-protocol/contracts-v2": "2.4.3",
"@across-protocol/constants-v2": "1.0.4",
"@across-protocol/sdk-v2": "0.16.4",
"@arbitrum/sdk": "^3.1.3",
"@defi-wonderland/smock": "^2.3.5",
Expand Down
3 changes: 1 addition & 2 deletions src/clients/AcrossAPIClient.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { winston, BigNumber, getL2TokenAddresses } from "../utils";
import axios, { AxiosError } from "axios";
import { HubPoolClient } from "./HubPoolClient";
import { constants } from "@across-protocol/sdk-v2";
import { TOKEN_SYMBOLS_MAP, CHAIN_IDs } from "@across-protocol/constants-v2";
import { SpokePoolClientsByChain } from "../interfaces";
import _ from "lodash";
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs } = constants;

export interface DepositLimits {
maxDeposit: BigNumber;
Expand Down
4 changes: 2 additions & 2 deletions src/clients/ProfitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import * as constants from "../common/Constants";
import { assert, BigNumber, formatFeePct, max, winston, toBNWei, toBN, assign } from "../utils";
import { HubPoolClient } from ".";
import { Deposit, DepositWithBlock, L1Token, SpokePoolClientsByChain } from "../interfaces";
import { constants as sdkConstants, priceClient, relayFeeCalculator, utils as sdkUtils } from "@across-protocol/sdk-v2";
import { priceClient, relayFeeCalculator, utils as sdkUtils } from "@across-protocol/sdk-v2";
import { TOKEN_SYMBOLS_MAP, CHAIN_IDs } from "@across-protocol/constants-v2";

const { formatEther } = ethersUtils;
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs } = sdkConstants;
const { fixedPointAdjustment: fixedPoint } = sdkUtils;

// We use wrapped ERC-20 versions instead of the native tokens such as ETH, MATIC for ease of computing prices.
Expand Down
3 changes: 1 addition & 2 deletions src/clients/bridges/ArbitrumAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import {
import { SpokePoolClient } from "../../clients";
import { BaseAdapter } from "./BaseAdapter";
import { SortableEvent, OutstandingTransfers } from "../../interfaces";
import { constants } from "@across-protocol/sdk-v2";
import { CONTRACT_ADDRESSES } from "../../common";
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs } = constants;
import { TOKEN_SYMBOLS_MAP, CHAIN_IDs } from "@across-protocol/constants-v2";

// TODO: Move to ../../common/ContractAddresses.ts
// These values are obtained from Arbitrum's gateway router contract.
Expand Down
3 changes: 1 addition & 2 deletions src/clients/bridges/PolygonAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import {
import { SpokePoolClient } from "../../clients";
import { BaseAdapter } from "./";
import { SortableEvent, OutstandingTransfers } from "../../interfaces";
import { constants } from "@across-protocol/sdk-v2";
import { CONTRACT_ADDRESSES } from "../../common";
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs } = constants;
import { TOKEN_SYMBOLS_MAP, CHAIN_IDs } from "@across-protocol/constants-v2";

// ether bridge = 0x8484Ef722627bf18ca5Ae6BcF031c23E6e922B30
// erc20 bridge = 0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf
Expand Down
3 changes: 2 additions & 1 deletion src/utils/TokenUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { constants, utils } from "@across-protocol/sdk-v2";
import { CONTRACT_ADDRESSES } from "../common";
import { BigNumberish, utils as ethersUtils } from "ethers";
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs, ZERO_ADDRESS } = constants;
const { ZERO_ADDRESS } = constants;
import { TOKEN_SYMBOLS_MAP, CHAIN_IDs } from "@across-protocol/constants-v2";

export const { fetchTokenInfo } = utils;

Expand Down
3 changes: 1 addition & 2 deletions test/AdapterManager.SendTokensCrossChain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { constants } from "@across-protocol/sdk-v2";
import * as zksync from "zksync-web3";
import { SpokePoolClient } from "../src/clients";
import { AdapterManager } from "../src/clients/bridges"; // Tested
Expand All @@ -18,7 +17,7 @@ import {
toBN,
winston,
} from "./utils";
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs } = constants;
import { TOKEN_SYMBOLS_MAP, CHAIN_IDs } from "@across-protocol/constants-v2";

let hubPoolClient: MockHubPoolClient;
const mockSpokePoolClients: {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"@uma/common" "^2.17.0"
hardhat "^2.9.3"

"@across-protocol/constants-v2@1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.4.tgz#df31c81038982a25de2b1b8f7604875f3de1186c"
integrity sha512-Nzl8Z1rZFvcpuKQu7CmBVfvgB13/NoulcsRVYBSkG90imS/e6mugxzqD9UrUb+WOL0ODMCANCAoDw54ZBBzNiQ==

"@across-protocol/contracts-v2@2.4.3", "@across-protocol/contracts-v2@^2.4.3":
version "2.4.3"
resolved "https://registry.yarnpkg.com/@across-protocol/contracts-v2/-/contracts-v2-2.4.3.tgz#9cc0b1f52b4f819b32ca1524ef84af9dfed8687a"
Expand Down

0 comments on commit 9da0a15

Please sign in to comment.