Skip to content

chore: resync epic branch with master #1029

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

Merged
merged 33 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
460e9ab
refactor(BundleDataClient): Remove unused function and test (#971)
nicholaspai Apr 21, 2025
758b83c
improve: Handle deposits referencing input/output/repayment tokens th…
nicholaspai Apr 22, 2025
43d2b2a
feat: enable support for SVM in hubpool client (#956)
james-a-morris Apr 23, 2025
9bce8dd
improve: refactor common interfaces (#940)
james-a-morris Apr 23, 2025
e56c9c3
Revert "improve: refactor common interfaces (#940)" (#986)
pxrl Apr 24, 2025
99124bc
fix: Remove fromLiteChain from Fill object published to Arweave (#987)
nicholaspai Apr 24, 2025
e823de9
improve: Remove unused functions related to resolving token mappings …
nicholaspai Apr 25, 2025
400d76a
refactor(EventUtils): Skip transactionIndex check in event sorting (#…
pxrl Apr 25, 2025
ae5519e
improve: refactor common interfaces (#992)
james-a-morris Apr 28, 2025
3ad3082
Feat/chain specific overrides relay fee calculator (#997)
gsteenkamp89 Apr 29, 2025
9d8527a
improve: Remove unused functions (#996)
nicholaspai Apr 29, 2025
0a1a471
chore: bump constants (#999)
bmzig Apr 29, 2025
dd60af5
fix(EventUtils): Refine sorting types (#1003)
pxrl Apr 30, 2025
3ef0608
fix(TokenUtils): Handle testnet chainId being passed into getL1TokenI…
nicholaspai Apr 30, 2025
39d835e
chore: Bump package version (#1004)
nicholaspai Apr 30, 2025
16d068f
chore: Bump constants (#1005)
pxrl Apr 30, 2025
729808d
chore: Bump constants and add USDT-BNB to stablecoin mapping (#1006)
nicholaspai Apr 30, 2025
a63bf86
chore: add BNB Smart Chain to `DETERMINISTIC_MULTICALL_CHAINS` (#1009)
grasphoper May 1, 2025
31ab751
improve: Use legacy gas price oracle for BSC (#1008)
nicholaspai May 1, 2025
012ef02
feat: Add BSC constants (#1000)
gsteenkamp89 May 1, 2025
64d90a2
fix: Fix DETERMINISTIC_MULTICALL_CHAINS
nicholaspai May 1, 2025
4701b4a
fix(providers): Load BSC alchemy url correctly (#1012)
nicholaspai May 1, 2025
4b856bd
improve(HubPoolClient): Avoid loading rate model if paymentChain == o…
nicholaspai May 1, 2025
44a31f4
chore: bump contracts (#1013)
bmzig May 2, 2025
1240d49
fix: relay fee calculator gas fee denomination (#1016)
dohaki May 3, 2025
72dfbbb
fix(HubPoolClient): Skip computing LP fees for deposits with no LP ro…
nicholaspai May 5, 2025
55efa40
fix: capital cost config validation (#1020)
dohaki May 6, 2025
6cf5cc8
fix(DataworkerUtils): Don't create empty PoolRebalanceLeaf for bundle…
nicholaspai May 6, 2025
1f41ea6
feat(relayFeeCalculator): add support for origin chain config overrid…
gsteenkamp89 May 6, 2025
841252f
release (#1022)
gsteenkamp89 May 6, 2025
ecbb02c
improve(SpokeUtils): Use viem for RelayData hash computation (#979)
pxrl May 7, 2025
50716a7
improve(TokenUtils): Replace getL1TokenInfo (#1024)
nicholaspai May 7, 2025
b1e9679
Merge branch 'master' into bz/merge-master
bmzig May 9, 2025
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
30 changes: 5 additions & 25 deletions e2e/queries.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ describe("Queries", function () {
undefined,
process.env.COINGECKO_PRO_API_KEY
);
await Promise.all([
arbitrumQueries.getGasCosts(),
arbitrumQueries.getTokenDecimals("USDC"),
arbitrumQueries.getTokenPrice("USDC"),
]);
await Promise.all([arbitrumQueries.getGasCosts(), arbitrumQueries.getTokenPrice("USDC")]);
});
it("Boba", async function () {
const provider = new providers.JsonRpcProvider(process.env.NODE_URL_288);
Expand All @@ -44,11 +40,7 @@ describe("Queries", function () {
undefined,
process.env.COINGECKO_PRO_API_KEY
);
await Promise.all([
bobaQueries.getGasCosts(),
bobaQueries.getTokenDecimals("USDC"),
bobaQueries.getTokenPrice("USDC"),
]);
await Promise.all([bobaQueries.getGasCosts(), bobaQueries.getTokenPrice("USDC")]);
});
it("Ethereum", async function () {
const provider = new providers.JsonRpcProvider(process.env.NODE_URL_1);
Expand All @@ -60,11 +52,7 @@ describe("Queries", function () {
undefined,
process.env.COINGECKO_PRO_API_KEY
);
await Promise.all([
ethereumQueries.getGasCosts(),
ethereumQueries.getTokenDecimals("USDC"),
ethereumQueries.getTokenPrice("USDC"),
]);
await Promise.all([ethereumQueries.getGasCosts(), ethereumQueries.getTokenPrice("USDC")]);
});
it("Optimism", async function () {
const provider = new providers.JsonRpcProvider(process.env.NODE_URL_10);
Expand All @@ -76,11 +64,7 @@ describe("Queries", function () {
undefined,
process.env.COINGECKO_PRO_API_KEY
);
await Promise.all([
optimismQueries.getGasCosts(),
optimismQueries.getTokenDecimals("USDC"),
optimismQueries.getTokenPrice("USDC"),
]);
await Promise.all([optimismQueries.getGasCosts(), optimismQueries.getTokenPrice("USDC")]);
});
it("Polygon", async function () {
const provider = new providers.JsonRpcProvider(process.env.NODE_URL_137);
Expand All @@ -92,10 +76,6 @@ describe("Queries", function () {
undefined,
process.env.COINGECKO_PRO_API_KEY
);
await Promise.all([
polygonQueries.getGasCosts(),
polygonQueries.getTokenDecimals("USDC"),
polygonQueries.getTokenPrice("USDC"),
]);
await Promise.all([polygonQueries.getGasCosts(), polygonQueries.getTokenPrice("USDC")]);
});
});
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@across-protocol/sdk",
"author": "UMA Team",
"version": "4.1.44",
"version": "4.1.62",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/reference/sdk",
"files": [
Expand Down Expand Up @@ -104,8 +104,8 @@
},
"dependencies": {
"@across-protocol/across-token": "^1.0.0",
"@across-protocol/constants": "^3.1.51",
"@across-protocol/contracts": "^4.0.5",
"@across-protocol/constants": "^3.1.64",
"@across-protocol/contracts": "^4.0.9",
"@coral-xyz/anchor": "^0.30.1",
"@eth-optimism/sdk": "^3.3.1",
"@ethersproject/bignumber": "^5.7.0",
Expand Down
5 changes: 3 additions & 2 deletions src/arch/svm/SpokeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
SvmAddress,
getTokenInformationFromAddress,
BigNumber,
isDefined,
isUnsafeDepositId,
Expand All @@ -10,6 +9,7 @@ import {
keccak256,
chainIsSvm,
chunk,
getTokenInfo,
} from "../../utils";
import { SvmSpokeClient } from "@across-protocol/contracts";
import { getStatePda, SvmCpiEventsClient, getFillStatusPda, unwrapEventData, getEventAuthority } from "./";
Expand All @@ -32,6 +32,7 @@ import assert from "assert";
import { Logger } from "winston";
import { fetchState, decodeFillStatusAccount } from "@across-protocol/contracts/dist/src/svm/clients/SvmSpoke";
import { SVMEventNames, SVMProvider } from "./types";
import { CHAIN_IDs } from "../../constants";

/**
* @param spokePool SpokePool Contract instance.
Expand Down Expand Up @@ -383,7 +384,7 @@ export async function createApproveInstruction(

// If no mint decimals were supplied, then assign it to whatever value we have in TOKEN_SYMBOLS_MAP.
// If this token is not in TOKEN_SYMBOLS_MAP, then throw an error.
mintDecimals ??= getTokenInformationFromAddress(mint.toBase58())?.decimals;
mintDecimals ??= getTokenInfo(mint.toBase58(), CHAIN_IDs.SOLANA)?.decimals;
if (!isDefined(mintDecimals)) {
throw new Error(`No mint decimals found for token ${mint.toBase58()}`);
}
Expand Down
32 changes: 17 additions & 15 deletions src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
DisabledChainsUpdate,
GlobalConfigUpdate,
LiteChainsIdListUpdate,
Log,
ParsedTokenConfig,
RateModelUpdate,
RouteRateModelUpdate,
Expand All @@ -43,8 +42,8 @@ type ConfigStoreUpdateSuccess = {
chainId: number;
searchEndBlock: number;
events: {
updatedTokenConfigEvents: Log[];
updatedGlobalConfigEvents: Log[];
updatedTokenConfigEvents: SortableEvent[];
updatedGlobalConfigEvents: SortableEvent[];
globalConfigUpdateTimes: number[];
};
};
Expand Down Expand Up @@ -341,8 +340,13 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
paginatedEventQuery(this.configStore, this.configStore.filters.UpdatedGlobalConfig(), searchConfig),
]);

const updatedTokenConfigSortableEvents = updatedTokenConfigEvents.map(spreadEventWithBlockNumber);
const updatedGlobalConfigSortableEvents = updatedGlobalConfigEvents.map(spreadEventWithBlockNumber);

// Events *should* normally be received in ascending order, but explicitly enforce the ordering.
[updatedTokenConfigEvents, updatedGlobalConfigEvents].forEach((events) => sortEventsAscendingInPlace(events));
[updatedTokenConfigSortableEvents, updatedGlobalConfigSortableEvents].forEach((events) =>
sortEventsAscendingInPlace(events)
);

const globalConfigUpdateTimes = (
await Promise.all(updatedGlobalConfigEvents.map((event) => this.configStore.provider.getBlock(event.blockNumber)))
Expand All @@ -353,8 +357,8 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
chainId,
searchEndBlock: searchConfig.to,
events: {
updatedTokenConfigEvents,
updatedGlobalConfigEvents,
updatedTokenConfigEvents: updatedTokenConfigSortableEvents,
updatedGlobalConfigEvents: updatedGlobalConfigSortableEvents,
globalConfigUpdateTimes,
},
};
Expand All @@ -380,13 +384,11 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
// Save new TokenConfig updates.
for (const event of updatedTokenConfigEvents) {
// If transaction hash is known to be invalid, skip it immediately to avoid creating extra logs.
if (KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES.includes(event.transactionHash.toLowerCase())) {
if (KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES.includes(event.txnRef.toLowerCase())) {
continue;
}

const args = {
...(spreadEventWithBlockNumber(event) as TokenConfig),
};
const args = event as TokenConfig;

try {
const { rateModel, routeRateModel, spokeTargetBalances } = this.validateTokenConfigUpdate(args);
Expand Down Expand Up @@ -418,7 +420,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
this.logger.debug({
at: "ConfigStoreClient::update",
message: `Skipping invalid historical update at block ${event.blockNumber}`,
transactionHash: event.transactionHash,
txnRef: event.txnRef,
});
}
continue;
Expand All @@ -427,7 +429,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {

// Save new Global config updates.
for (let i = 0; i < updatedGlobalConfigEvents.length; i++) {
const args = spreadEventWithBlockNumber(updatedGlobalConfigEvents[i]) as SortableEvent & {
const args = updatedGlobalConfigEvents[i] as SortableEvent & {
key: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value: any;
Expand Down Expand Up @@ -562,7 +564,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
rateModel: string | undefined;
routeRateModel: RouteRateModelUpdate["routeRateModel"];
} {
const { value, key, transactionHash } = args;
const { value, key, txnRef } = args;
const parsedValue = parseJSONWithNumericString(value) as ParsedTokenConfig;
const l1Token = key;

Expand All @@ -578,7 +580,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
const rateModel = parsedValue.rateModel;
assert(
this.isValidRateModel(rateModel),
`Invalid rateModel UBar for ${l1Token} at transaction ${transactionHash}, ${JSON.stringify(rateModel)}`
`Invalid rateModel UBar for ${l1Token} at transaction ${txnRef}, ${JSON.stringify(rateModel)}`
);
rateModelForToken = JSON.stringify(rateModel);

Expand All @@ -601,7 +603,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
Object.entries(parsedValue.routeRateModel).map(([path, routeRateModel]) => {
assert(
this.isValidRateModel(routeRateModel) &&
`Invalid routeRateModel UBar for ${path} for ${l1Token} at transaction ${transactionHash}, ${JSON.stringify(
`Invalid routeRateModel UBar for ${path} for ${l1Token} at transaction ${txnRef}, ${JSON.stringify(
routeRateModel
)}`
);
Expand Down
Loading