Skip to content

Commit

Permalink
fix: remove v2/v3 references (#656)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Rice <[email protected]>
  • Loading branch information
mrice32 authored May 31, 2024
1 parent 46196cd commit 018f013
Show file tree
Hide file tree
Showing 30 changed files with 73 additions and 78 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Across SDK V2
# Across SDK

Across is a system that uses UMA contracts to quickly move tokens across chains. This repository contains shareable code and libraries for Across V2.
Across is a system that quickly moves tokens across chains. This repository contains shareable code and libraries for Across.

## Modules
| Name | Description | README | Source Code |
Expand Down Expand Up @@ -111,6 +111,6 @@ There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinio
For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.

## Publishing a new version
1. Bump version in package.json and merge to master. Example: https://github.com/across-protocol/sdk-v2/pull/67
2. Create a new release with a new tag (version number should be incremented): https://github.com/across-protocol/sdk-v2/releases
3. Update any upstream repos/binaries that depend on sdk-v2 such as https://github.com/across-protocol/frontend-v2. Example: https://github.com/across-protocol/frontend-v2/pull/202
1. Bump version in package.json and merge to master. Example: https://github.com/across-protocol/sdk/pull/67
2. Create a new release with a new tag (version number should be incremented): https://github.com/across-protocol/sdk/releases
3. Update any upstream repos/binaries that depend on the sdk such as https://github.com/across-protocol/frontend. Example: https://github.com/across-protocol/frontend/pull/202
2 changes: 1 addition & 1 deletion contracts/MockAcrossMessageContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.0;

// This interface is expected to be implemented by any contract
// that expects to receive messages from the SpokePool.
// Retrieved from https://github.com/across-protocol/contracts-v2/blob/master/contracts/SpokePool.sol
// Retrieved from https://github.com/across-protocol/contracts/blob/master/contracts/SpokePool.sol
interface AcrossMessageHandler {
function handleV3AcrossMessage(address, uint256, address, bytes memory message) external;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/MockSpokePool.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "@across-protocol/contracts-v2/contracts/test/MockSpokePool.sol";
import "@across-protocol/contracts/contracts/test/MockSpokePool.sol";

/**
* @title MockSpokePool
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@across-protocol/sdk-v2",
"name": "@across-protocol/sdk",
"author": "UMA Team",
"version": "0.24.4",
"version": "3.0.0",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/reference/sdk",
"files": [
Expand Down Expand Up @@ -40,11 +40,11 @@
"sideEffects": false,
"size-limit": [
{
"path": "dist/sdk-v2.cjs.production.min.js",
"path": "dist/sdk.cjs.production.min.js",
"limit": "10 KB"
},
{
"path": "dist/sdk-v2.esm.js",
"path": "dist/sdk.esm.js",
"limit": "10 KB"
}
],
Expand Down Expand Up @@ -99,8 +99,8 @@
},
"dependencies": {
"@across-protocol/across-token": "^1.0.0",
"@across-protocol/constants-v2": "^1.1.0",
"@across-protocol/contracts-v2": "2.5.9",
"@across-protocol/constants": "^3.0.0",
"@across-protocol/contracts": "^3.0.0",
"@eth-optimism/sdk": "^3.3.1",
"@pinata/sdk": "^2.1.0",
"@types/mocha": "^10.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/clients/SpokePoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ export class SpokePoolClient extends BaseAbstractClient {
// token address to the wrapped token address. This is because the OVM_SpokePool modifies the l2TokenAddress prop
// in _bridgeTokensToHubPool before emitting the ExecutedRelayerRefundLeaf event.
// Here is the contract code referenced:
// - https://github.com/across-protocol/contracts-v2/blob/954528a4620863d1c868e54a370fd8556d5ed05c/contracts/Ovm_SpokePool.sol#L142
// - https://github.com/across-protocol/contracts/blob/954528a4620863d1c868e54a370fd8556d5ed05c/contracts/Ovm_SpokePool.sol#L142
if (
(chainId === 10 || chainId === 8453) &&
eventL2Token.toLowerCase() === "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000"
Expand Down
8 changes: 4 additions & 4 deletions src/clients/mocks/MockEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ export class EventManager {
this.blockNumber = blockNumber;

transactionIndex ??= random(1, 32, false);
const transactionHash = id(`Across-v2-${event}-${blockNumber}-${transactionIndex}-${random(1, 100_000)}`);
const transactionHash = id(`Across-${event}-${blockNumber}-${transactionIndex}-${random(1, 100_000)}`);

const _logIndex = `${blockNumber}-${transactionIndex}`;
this.logIndexes[_logIndex] ??= 0;
const logIndex = this.logIndexes[_logIndex]++;

const decodeError = new Error(`${event} decoding error`);
const parentHash = id(`Across-v2-blockHash-${random(1, 100_000)}`);
const blockHash = id(`Across-v2-blockHash-${parentHash}-${random(1, 100_000)}`);
const parentHash = id(`Across-blockHash-${random(1, 100_000)}`);
const blockHash = id(`Across-blockHash-${parentHash}-${random(1, 100_000)}`);

// getBlock() may later be used to retrieve (for example) the block timestamp.
// @todo: If multiple events coincide on the same block number, this callback should return the same Block object.
Expand Down Expand Up @@ -115,7 +115,7 @@ export class EventManager {
transactionHash,
removed: false,
address,
data: data ?? id(`Across-v2-random-txndata-${random(1, 100_000)}`),
data: data ?? id(`Across-random-txndata-${random(1, 100_000)}`),
topics,
args,
blockHash,
Expand Down
2 changes: 1 addition & 1 deletion src/coingecko/Coingecko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class Coingecko {
return await this._callBasic(path, this.basicApiTimeout);
} catch (err) {
this.logger.debug({
at: "sdk-v2/coingecko",
at: "sdk/coingecko",
message: `Basic CG url request failed, falling back to CG PRO host ${proHost}`,
errMessage: (err as AxiosError).message,
});
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export {
PUBLIC_NETWORKS,
TESTNET_CHAIN_IDs,
TOKEN_SYMBOLS_MAP,
} from "@across-protocol/constants-v2";
} from "@across-protocol/constants";

export const { AddressZero: ZERO_ADDRESS } = ethersConstants;

Expand Down
2 changes: 1 addition & 1 deletion src/lpFeeCalculator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Calculates LP fee percentages when doing a transfer.
See tests for more documentation: [LP Fee Calculator Test]("./lpFeeCalculator.test.ts")

```ts
import * as across from "@across/sdk-v2"
import * as across from "@across/sdk"

const { calculateApyFromUtilization, calculateRealizedLpFeePct } = across.lpFeeCalculator

Expand Down
2 changes: 1 addition & 1 deletion src/lpFeeCalculator/lpFeeCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class LPFeeCalculator {
): BN {
const apy = this.calculateApyFromUtilization(toBN(utilizationBeforeDeposit), toBN(utilizationAfterDeposit));

// ACROSS-V2 UMIP requires that the realized fee percent is floor rounded as decimal to 6 decimals.
// ACROSS UMIP requires that the realized fee percent is floor rounded as decimal to 6 decimals.
return truncateDecimals ? truncate18DecimalBN(convertApyToWeeklyFee(apy), 6) : convertApyToWeeklyFee(apy);
}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/merkleDistributor/MerkleDistributor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MerkleTree } from "@across-protocol/contracts-v2/dist/utils/MerkleTree";
import { MerkleTree } from "@across-protocol/contracts/dist/utils/MerkleTree";
import { ethers } from "ethers";
import { DistributionRecipientsWithProofs, DistributionRecipient } from "./model";

Expand Down
2 changes: 1 addition & 1 deletion src/merkleDistributor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Also, `MerkleDistributor` is a wrapper around the Merkle tree which is used for
See tests for more documentation: [MerkleDistributor]("./test/MerkleDistributor.test.ts")

```ts
import * as across from "@across-protocol/sdk-v2";
import * as across from "@across-protocol/sdk";

const { MerkleDistributor, MerkleTree, DistributionRecipient } = across.merkleDistributor;

Expand Down
2 changes: 1 addition & 1 deletion src/relayFeeCalculator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Calculates relay fee percentages for a relay deposit.
See tests for more documentation: [Relay Fee Calculator Test]("./relayFeeDetails.test.ts")

```ts
import * as across from "@across/sdk-v2"
import * as across from "@across/sdk"
import {ethers} from 'ethers'

const {RelayFeeCalculator, DefaultQueries} = across.relayFeeCalculator
Expand Down
4 changes: 2 additions & 2 deletions src/relayFeeCalculator/chain-queries/factory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants-v2";
import { getDeployedAddress } from "@across-protocol/contracts-v2";
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
import { getDeployedAddress } from "@across-protocol/contracts";
import { asL2Provider } from "@eth-optimism/sdk";
import { providers } from "ethers";
import { DEFAULT_SIMULATED_RELAYER_ADDRESS } from "../../constants";
Expand Down
6 changes: 3 additions & 3 deletions src/relayFeeCalculator/relayFeeCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class RelayFeeCalculator {

const getGasCosts = this.queries.getGasCosts(deposit, relayerAddress).catch((error) => {
this.logger.error({
at: "sdk-v2/gasFeePercent",
at: "sdk/gasFeePercent",
message: "Error while fetching gas costs",
error,
simulateZeroFill,
Expand All @@ -251,7 +251,7 @@ export class RelayFeeCalculator {
});
const getTokenPrice = this.queries.getTokenPrice(token.symbol).catch((error) => {
this.logger.error({
at: "sdk-v2/gasFeePercent",
at: "sdk/gasFeePercent",
message: "Error while fetching token price",
error,
destinationChainId: deposit.destinationChainId,
Expand Down Expand Up @@ -284,7 +284,7 @@ export class RelayFeeCalculator {
const tokenCostConfig = this.capitalCostsConfig[_tokenSymbol.toUpperCase()];
if (!isDefined(tokenCostConfig)) {
this.logger.error({
at: "sdk-v2/capitalFeePercent",
at: "sdk/capitalFeePercent",
message: `No capital fee available for token ${_tokenSymbol}`,
});
throw new Error(`No capital cost config available for token ${_tokenSymbol}`);
Expand Down
22 changes: 11 additions & 11 deletions src/typechain.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/**
* This file re-exports some of the typechain bindings so that they can be tree-shaken in the final frontend bundle.
* Currently, the packages `@across-protocol/contracts-v2` and `@across-protocol/across-token` are not optimized for tree-shaking
* Currently, the packages `@across-protocol/contracts` and `@across-protocol/across-token` are not optimized for tree-shaking
* and contain modules that are not compatible in a browser environment. This is a temporary solution until we can fix the issue upstream.
*/
import type { TypedEvent, TypedEventFilter } from "@across-protocol/contracts-v2/dist/typechain/common";
import type { TypedEvent, TypedEventFilter } from "@across-protocol/contracts/dist/typechain/common";

export type { TypedEvent, TypedEventFilter };
export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts-v2/dist/typechain/factories/contracts/merkle-distributor/AcrossMerkleDistributor__factory";
export { AcrossConfigStore__factory } from "@across-protocol/contracts-v2/dist/typechain/factories/contracts/AcrossConfigStore__factory";
export { HubPool__factory } from "@across-protocol/contracts-v2/dist/typechain/factories/contracts/HubPool__factory";
export { SpokePool__factory } from "@across-protocol/contracts-v2/dist/typechain/factories/contracts/SpokePool.sol/SpokePool__factory";
export { ERC20__factory } from "@across-protocol/contracts-v2/dist/typechain/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory";
export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/merkle-distributor/AcrossMerkleDistributor__factory";
export { AcrossConfigStore__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/AcrossConfigStore__factory";
export { HubPool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/HubPool__factory";
export { SpokePool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePool.sol/SpokePool__factory";
export { ERC20__factory } from "@across-protocol/contracts/dist/typechain/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory";

export { AcceleratingDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/AcceleratingDistributor__factory";
export { ClaimAndStake__factory } from "@across-protocol/across-token/dist/typechain/factories/ClaimAndStake__factory";
Expand All @@ -19,12 +19,12 @@ export { MerkleDistributor__factory } from "@across-protocol/across-token/dist/t
export type {
AcrossMerkleDistributor,
AcrossMerkleDistributorInterface,
} from "@across-protocol/contracts-v2/dist/typechain/contracts/merkle-distributor/AcrossMerkleDistributor";
} from "@across-protocol/contracts/dist/typechain/contracts/merkle-distributor/AcrossMerkleDistributor";
export type {
AcrossConfigStore,
AcrossConfigStoreInterface,
} from "@across-protocol/contracts-v2/dist/typechain/contracts/AcrossConfigStore";
export type { HubPool, HubPoolInterface } from "@across-protocol/contracts-v2/dist/typechain/contracts/HubPool";
} from "@across-protocol/contracts/dist/typechain/contracts/AcrossConfigStore";
export type { HubPool, HubPoolInterface } from "@across-protocol/contracts/dist/typechain/contracts/HubPool";
export type {
SpokePool,
SpokePoolInterface,
Expand All @@ -33,7 +33,7 @@ export type {
RequestedSpeedUpDepositEvent,
V3FundsDepositedEvent,
FilledV3RelayEvent,
} from "@across-protocol/contracts-v2/dist/typechain/contracts/SpokePool.sol/SpokePool";
} from "@across-protocol/contracts/dist/typechain/contracts/SpokePool.sol/SpokePool";

export type {
AcceleratingDistributor,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/BigNumberUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function toGWei(num: BigNumberish): BN {
* @param num The number to parse.
* @param rounding The rounding method to use if the number has a decimal point. Defaults to "floor" or rounding down. Valid values are "floor", "round", and "ceil".
* @returns The parsed BigNumber.
* @note This is a temporary function until we can backport support for decimal points to @across-protocol/sdk-v2.
* @note This is a temporary function until we can backport support for decimal points to @across-protocol/sdk.
*/
export const toBN = (num: BigNumberish, rounding: "floor" | "round" | "ceil" = "floor"): BN => {
// If the string version of the num contains a `.` then it is a number which needs to be parsed to a string int.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/DeploymentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export {
getContractInfoFromAddress,
getDeployedAddress,
getDeployedBlockNumber,
} from "@across-protocol/contracts-v2/dist/src/DeploymentUtils";
} from "@across-protocol/contracts/dist/src/DeploymentUtils";
2 changes: 1 addition & 1 deletion src/utils/TokenUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function resolveSymbolOnChain(chainId: number, symbol: string): L1Token {
* Returns the contract address for a given token symbol and chainId.
* @param symbol A case-insensitive token symbol.
* @param chainId The chainId to resolve the contract address for.
* @param tokenMapping A parameter to determine where to source token information. Defaults to the constants-v2 variant.
* @param tokenMapping A parameter to determine where to source token information. Defaults to the constants variant.
* @returns The contract address for the given token symbol and chainId, or undefined if the token symbol is not supported.
*/
export const resolveContractFromSymbol = (
Expand Down
2 changes: 1 addition & 1 deletion test/ConfigStoreClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AcrossConfigStore } from "@across-protocol/contracts-v2";
import { AcrossConfigStore } from "@across-protocol/contracts";
import { constants } from "../src";
import { GLOBAL_CONFIG_STORE_KEYS } from "../src/clients";
import { SpokePoolTargetBalance } from "../src/interfaces";
Expand Down
2 changes: 1 addition & 1 deletion test/MerkleDistributor.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MerkleTree } from "@across-protocol/contracts-v2";
import { MerkleTree } from "@across-protocol/contracts";
import { MerkleDistributor, DistributionRecipient, DistributionRecipientWithProof } from "../src/merkleDistributor";
import { expect } from "./utils";

Expand Down
2 changes: 1 addition & 1 deletion test/common.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from "assert";
import { SpokePool, SpokePool__factory } from "@across-protocol/contracts-v2";
import { SpokePool, SpokePool__factory } from "@across-protocol/contracts";
import dotenv from "dotenv";
import { providers } from "ethers";
import {
Expand Down
2 changes: 1 addition & 1 deletion test/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as contracts from "@across-protocol/contracts-v2/dist/test-utils"; // Contains all the Across contract constants.
import * as contracts from "@across-protocol/contracts/dist/test-utils"; // Contains all the Across contract constants.
import { DEFAULT_CONFIG_STORE_VERSION } from "./mocks";

export const {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/UmaEcosystemFixture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { identifier } from "@across-protocol/contracts-v2/dist/test-utils";
import { identifier } from "@across-protocol/contracts/dist/test-utils";
import { refundProposalLiveness } from "../constants";
import { Contract, getContractFactory, SignerWithAddress, utf8ToHex } from "../utils";

Expand Down
4 changes: 2 additions & 2 deletions test/relayFeeCalculator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import {
randomAddress,
setupTokensForWallet,
} from "./utils";
import { TOKEN_SYMBOLS_MAP } from "@across-protocol/constants-v2";
import { TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
import { EMPTY_MESSAGE, ZERO_ADDRESS } from "../src/constants";
import { SpokePool } from "@across-protocol/contracts-v2";
import { SpokePool } from "@across-protocol/contracts";
import { QueryBase, QueryBase__factory } from "../src/relayFeeCalculator";

dotenv.config({ path: ".env" });
Expand Down
2 changes: 1 addition & 1 deletion test/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HardhatEthersHelpers } from "@nomiclabs/hardhat-ethers/types";
import type { ethers } from "ethers";
import winston from "winston";
import * as utils from "@across-protocol/contracts-v2/dist/test-utils";
import * as utils from "@across-protocol/contracts/dist/test-utils";
import { sinon } from "../utils";

export type EthersTestLibrary = typeof ethers & HardhatEthersHelpers;
Expand Down
2 changes: 1 addition & 1 deletion test/utils/UBAUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { clients, constants } from "@across-protocol/sdk-v2";
import { clients, constants } from "@across-protocol/sdk";

/**
* This is a helper function to generate an array of empty objects that are typed as SpokePoolClients.
Expand Down
2 changes: 1 addition & 1 deletion test/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * as contractsV2Utils from "@across-protocol/contracts-v2/dist/test-utils";
export * as contractsV2Utils from "@across-protocol/contracts/dist/test-utils";
export { ethers } from "hardhat";
export { smock } from "@defi-wonderland/smock";

Expand Down
4 changes: 2 additions & 2 deletions test/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from "@across-protocol/contracts-v2/dist/test-utils";
import * as utils from "@across-protocol/contracts/dist/test-utils";
import { BigNumber, BigNumberish, Contract, providers } from "ethers";
import {
AcrossConfigStoreClient as ConfigStoreClient,
Expand Down Expand Up @@ -34,7 +34,7 @@ import {
MAX_REFUNDS_PER_RELAYER_REFUND_LEAF,
sampleRateModel,
} from "../constants";
import { AcrossConfigStore } from "@across-protocol/contracts-v2";
import { AcrossConfigStore } from "@across-protocol/contracts";
import chai, { expect } from "chai";
import chaiExclude from "chai-exclude";
import _ from "lodash";
Expand Down
Loading

0 comments on commit 018f013

Please sign in to comment.