Skip to content

Commit

Permalink
Merge branch 'sdk-3.3.30' into gas-costs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Jan 7, 2025
2 parents 1e0ec98 + 581a689 commit 78a79d7
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 30 deletions.
21 changes: 13 additions & 8 deletions api/limits.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as sdk from "@across-protocol/sdk";
import { VercelResponse } from "@vercel/node";
import { BigNumber, ethers } from "ethers";
import { DEFAULT_SIMULATED_RECIPIENT_ADDRESS } from "./_constants";
import { CHAIN_IDs, DEFAULT_SIMULATED_RECIPIENT_ADDRESS } from "./_constants";
import { TokenInfo, TypedVercelRequest } from "./_types";
import { object, assert, Infer, optional, string } from "superstruct";

Expand Down Expand Up @@ -358,13 +358,18 @@ const handler = async (
.mul(maxDepositShortDelay)
.div(sdk.utils.fixedPointAdjustment);

const maximumDeposit = getMaxDeposit(
liquidReserves,
bufferedMaxDepositShortDelay,
limitsBufferMultiplier,
chainHasMaxBoundary,
routeInvolvesLiteChain
);
// FIXME: Remove after campaign is complete
const maximumDeposit =
destinationChainId === CHAIN_IDs.ZK_SYNC &&
computedOriginChainId === CHAIN_IDs.MAINNET
? liquidReserves
: getMaxDeposit(
liquidReserves,
bufferedMaxDepositShortDelay,
limitsBufferMultiplier,
chainHasMaxBoundary,
routeInvolvesLiteChain
);

const responseJson = {
// Absolute minimum may be overridden by the environment.
Expand Down
32 changes: 24 additions & 8 deletions api/suggested-fees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { type, assert, Infer, optional, string, enums } from "superstruct";
import {
DEFAULT_SIMULATED_RECIPIENT_ADDRESS,
DEFAULT_QUOTE_BLOCK_BUFFER,
CHAIN_IDs,
} from "./_constants";
import { TypedVercelRequest } from "./_types";
import {
Expand Down Expand Up @@ -274,15 +275,30 @@ const handler = async (
));
}

// TODO: Remove after campaign is complete
/**
* Override estimated fill time for ZK Sync deposits.
* @todo Remove after campaign is complete
* @see Change in {@link ./limits.ts}
*/
const estimatedTimingOverride =
computedOriginChainId === CHAIN_IDs.MAINNET &&
destinationChainId === CHAIN_IDs.ZK_SYNC &&
amount.gte(limits.maxDepositShortDelay)
? 9600
: undefined;

const responseJson = {
estimatedFillTimeSec: amount.gte(maxDepositInstant)
? resolveRebalanceTiming(String(destinationChainId))
: resolveTiming(
String(computedOriginChainId),
String(destinationChainId),
inputToken.symbol,
amountInUsd
),
estimatedFillTimeSec:
estimatedTimingOverride ??
(amount.gte(maxDepositInstant)
? resolveRebalanceTiming(String(destinationChainId))
: resolveTiming(
String(computedOriginChainId),
String(destinationChainId),
inputToken.symbol,
amountInUsd
)),
capitalFeePct: relayerFeeDetails.capitalFeePercent,
capitalFeeTotal: relayerFeeDetails.capitalFeeTotal,
relayGasFeePct: relayerFeeDetails.gasFeePercent,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@across-protocol/constants": "^3.1.24",
"@across-protocol/contracts": "^3.0.19",
"@across-protocol/contracts-v3.0.6": "npm:@across-protocol/[email protected]",
"@across-protocol/sdk": "^3.3.27",
"@across-protocol/sdk": "^3.3.30",
"@amplitude/analytics-browser": "^2.3.5",
"@balancer-labs/sdk": "1.1.6-beta.16",
"@emotion/react": "^11.13.0",
Expand Down
6 changes: 1 addition & 5 deletions src/views/Bridge/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { CHAIN_IDs } from "@across-protocol/constants";
import { BigNumber } from "ethers";
import {
Route,
Expand Down Expand Up @@ -151,10 +150,7 @@ export function getInitialRoute(filter: RouteFilter = {}) {
const routeFromFilter = findEnabledRoute({
inputTokenSymbol:
filter.inputTokenSymbol ??
(filter?.fromChain === CHAIN_IDs.ALEPH_ZERO ||
filter?.fromChain === CHAIN_IDs.POLYGON
? "WETH"
: "ETH"),
(nonEthChains.includes(filter?.fromChain ?? -1) ? "WETH" : "ETH"),
fromChain: filter.fromChain || hubPoolChainId,
toChain: filter.toChain,
});
Expand Down
46 changes: 38 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.24.tgz#01fe49330bb467dd01813387ddbac741bc74a035"
integrity sha512-guKtvIbif//vsmSZbwGubTWVtfkWiyWenr2sVyo63U/68GOW89ceJRLu4efLjeLVGiSrNAJtFUCv9dTwrrosWA==

"@across-protocol/constants@^3.1.25":
version "3.1.25"
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.25.tgz#60d6d9814582ff91faf2b6d9f51d6dccb447b4ce"
integrity sha512-GpZoYn7hETYL2BPMM2GqXAer6+l/xuhder+pvpb00HJcb/sqCjF7vaaeKxjKJ3jKtyeulYmdu0NDkeNm5KbNWA==

"@across-protocol/constants@^3.1.9":
version "3.1.13"
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.13.tgz#b4caf494e9d9fe50290cca91b7883ea408fdb90a"
Expand Down Expand Up @@ -83,13 +88,13 @@
yargs "^17.7.2"
zksync-web3 "^0.14.3"

"@across-protocol/sdk@^3.3.27":
version "3.3.27"
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.3.27.tgz#ca58012c30e7d489ba5493981447c8cf2b82ef58"
integrity sha512-TebERt9Z0CF3NzD4dkurrgEqHn7gqidgoUrvk0kMUy2HzrlZilYj3oKgn+Kevn4XqomPfdWOkuAyiWDV5uNYew==
"@across-protocol/sdk@^3.3.30":
version "3.4.5"
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.4.5.tgz#343f53be92e92afd2fd4dbea16f180533093ea26"
integrity sha512-o1DovRfSriL0GTa304rd2KcBDwWYbK2SHT8mElyCLg6beX5RnJKT0YiMUMuCMfZ7MZJscdGzV023e5BhbyeP5A==
dependencies:
"@across-protocol/across-token" "^1.0.0"
"@across-protocol/constants" "^3.1.24"
"@across-protocol/constants" "^3.1.25"
"@across-protocol/contracts" "^3.0.19"
"@eth-optimism/sdk" "^3.3.1"
"@ethersproject/bignumber" "^5.7.0"
Expand Down Expand Up @@ -22961,7 +22966,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -22996,6 +23001,15 @@ string-width@^3.0.0, string-width@^3.1.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
Expand Down Expand Up @@ -23070,7 +23084,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -23098,6 +23112,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2"
Expand Down Expand Up @@ -25814,7 +25835,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down Expand Up @@ -25849,6 +25870,15 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.0.1, wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 78a79d7

Please sign in to comment.