diff --git a/.changeset/many-peas-drop.md b/.changeset/many-peas-drop.md new file mode 100644 index 0000000..76f0387 --- /dev/null +++ b/.changeset/many-peas-drop.md @@ -0,0 +1,5 @@ +--- +"@folks-finance/xchain-sdk": patch +--- + +Added increase by 5% in retry and reverse gas limit estimation diff --git a/src/chains/evm/common/constants/contract.ts b/src/chains/evm/common/constants/contract.ts index 6b5c8ac..4870a0b 100644 --- a/src/chains/evm/common/constants/contract.ts +++ b/src/chains/evm/common/constants/contract.ts @@ -9,3 +9,4 @@ export const defaultEventParams: EventParams = { export const GAS_LIMIT_ESTIMATE_INCREASE = 10_000n; export const SEND_TOKEN_ACTION_RETURN_GAS_LIMIT = 500_000n; export const RECEIVER_VALUE_SLIPPAGE = 0.01; +export const RETRY_REVERSE_GAS_LIMIT_SLIPPAGE = 0.05; diff --git a/src/chains/evm/hub/modules/folks-hub-gmp.ts b/src/chains/evm/hub/modules/folks-hub-gmp.ts index 4d97a41..bfa229b 100644 --- a/src/chains/evm/hub/modules/folks-hub-gmp.ts +++ b/src/chains/evm/hub/modules/folks-hub-gmp.ts @@ -1,7 +1,8 @@ import { FINALITY } from "../../../../common/constants/message.js"; import { getRandomGenericAddress } from "../../../../common/utils/address.js"; import { getRandomBytes } from "../../../../common/utils/bytes.js"; -import { GAS_LIMIT_ESTIMATE_INCREASE } from "../../common/constants/contract.js"; +import { increaseByPercent } from "../../../../common/utils/math-lib.js"; +import { RETRY_REVERSE_GAS_LIMIT_SLIPPAGE } from "../../common/constants/contract.js"; import { getEvmSignerAccount } from "../../common/utils/chain.js"; import { buildMessageParams, buildSendTokenExtraArgsWhenRemoving } from "../../common/utils/message.js"; import { getBridgeRouterHubContract } from "../utils/contract.js"; @@ -38,7 +39,7 @@ export const prepare = { }); return { - gasLimit: gasLimit + GAS_LIMIT_ESTIMATE_INCREASE, + gasLimit: increaseByPercent(gasLimit, RETRY_REVERSE_GAS_LIMIT_SLIPPAGE), msgValue: value, isHub: true, message, @@ -68,7 +69,7 @@ export const prepare = { }); return { - gasLimit: gasLimit + GAS_LIMIT_ESTIMATE_INCREASE, + gasLimit: increaseByPercent(gasLimit, RETRY_REVERSE_GAS_LIMIT_SLIPPAGE), msgValue: value, isHub: true, message,