|
@@ -49,6 +49,7 @@ export class StargateClient {
|
|
|
const lzGasCost = await this.getL0GasCost(toChainId)
|
|
|
const { gasCost, gasPrice, gasLimit } = await this.calculateGasCost(toChainId, routerEth, lzGasCost)
|
|
|
let cost = gasCost
|
|
|
+ let limit = gasLimit
|
|
|
return await polly()
|
|
|
.retry(5)
|
|
|
.executeForPromise(async info => {
|
|
@@ -61,6 +62,7 @@ export class StargateClient {
|
|
|
}
|
|
|
// add 30% gas cost for each retry
|
|
|
cost = (cost * 120n) / 100n
|
|
|
+ limit = (limit * 120n) / 100n
|
|
|
const sendAmount = balance - lzGasCost - cost
|
|
|
// const sendAmount = ethers.parseEther('0.01')
|
|
|
const minReceiveAmount = (sendAmount * 995n) / 1000n
|
|
@@ -70,7 +72,7 @@ export class StargateClient {
|
|
|
this.wallet.address,
|
|
|
sendAmount,
|
|
|
minReceiveAmount,
|
|
|
- { value: sendAmount + lzGasCost, gasLimit, gasPrice },
|
|
|
+ { value: sendAmount + lzGasCost, gasLimit: limit, gasPrice },
|
|
|
)
|
|
|
const receipt = await res.wait()
|
|
|
if (!receipt.status) {
|