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

fix: increase relayer fee to reduce low relayer fee errors #5856

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion packages/agents/sdk-wrapper/src/lib/helpers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { providers } from "ethers";

import { UriInvalid, ApiRequestFailed, ParseConnextLogFailed } from "../errors/index";

export const relayerBufferPercentage = 20; // 20% bump on total estimated relayer fee
export const relayerBufferPercentage = 40; // 40% bump on total estimated relayer fee

export const getChainData = _getChainData;
export const domainToChainId = _domainToChainId;
Expand Down
2 changes: 1 addition & 1 deletion packages/agents/sdk/src/lib/helpers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { providers } from "ethers";

import { UriInvalid, ApiRequestFailed, ParseConnextLogFailed } from "../errors/index";

export const relayerBufferPercentage = 20; // 20% bump on total estimated relayer fee
export const relayerBufferPercentage = 40; // 40% bump on total estimated relayer fee

export const getChainData = _getChainData;
export const domainToChainId = _domainToChainId;
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/peripherals/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Logger, createLoggingContext, RequestContext } from "../logging";
import { ChainData } from "./chainData";
import { safeGetConversionRate, getGelatoEstimatedFee } from "./gelato";

const relayerBufferPercentage = 20; // 20% bump on total estimated relayer fee
const relayerBufferPercentage = 40; // 40% bump on total estimated relayer fee

export const calculateRelayerFee = async (
params: {
Expand Down
16 changes: 8 additions & 8 deletions packages/utils/test/peripherals/relayer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe("Peripherals:Relayer", () => {
logger,
);
// estimatedRelayerFee = (estimatedGelatoFee + estimatedGelatoFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice )
// ==> (10000 + 10000 x 20 / 100) x ( 1.5 / 1 ) = 18000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("18000"));
// ==> (10000 + 10000 x 40 / 100) x ( 1.5 / 1 ) = 18000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("21000"));
});

it("should return correct value when provided token prices", async () => {
Expand All @@ -59,8 +59,8 @@ describe("Peripherals:Relayer", () => {
logger,
);
// estimatedRelayerFee = (estimatedGelatoFee + estimatedGelatoFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice )
// ==> (10000 + 10000 x 20 / 100) x ( 1500 / 1000 ) = 18000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("18000"));
// ==> (10000 + 10000 x 40 / 100) x ( 1500 / 1000 ) = 18000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("21000"));
});

it("should return correct value when provided gas price", async () => {
Expand All @@ -79,8 +79,8 @@ describe("Peripherals:Relayer", () => {
// fallbackRelayerFee = gasPrice x executeGasAmount
// ==> 50 x 400000 = 20000000
// estimatedRelayerFee = (fallbackRelayerFee + fallbackRelayerFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice )
// ==> (20000000 + 20000000 x 20 / 100) x ( 1.5 / 1 ) = 36000000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("36000000"));
// ==> (20000000 + 20000000 x 40 / 100) x ( 1.5 / 1 ) = 36000000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("42000000"));
});

it("should add l1Gas for optimism network", async () => {
Expand Down Expand Up @@ -133,8 +133,8 @@ describe("Peripherals:Relayer", () => {
logger,
);
// estimatedRelayerFee = (estimatedGelatoFee + estimatedGelatoFee x buffer_percentage / 100) x ( destinationTokenPrice / originTokenPrice )
// ==> (10000 + 10000 x 20 / 100) x ( 1.5 / 1 ) = 108000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("18000"));
// ==> (10000 + 10000 x 40 / 100) x ( 1.5 / 1 ) = 108000
expect(estimatedRelayerFee).to.be.deep.eq(BigNumber.from("21000"));
});
});
});
Loading