Skip to content

Commit 8d31dc2

Browse files
authored
Temporary fix to gas estimation (#245)
* temprorary fix for Moonbeam GLMR transfers * fix gas estimation as a temporary solution to estimateGas issues * add changeset
1 parent 4433189 commit 8d31dc2

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.changeset/great-carrots-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@moonbeam-network/xcm-sdk': patch
3+
---
4+
5+
Fix estimated gas value as temporary fix

packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,20 @@ export class Xtokens implements TransferContractInterface {
5656
return contract[this.#config.func].estimateGas(...this.#config.args);
5757
}
5858

59+
// eslint-disable-next-line class-methods-use-this
5960
async getViemContractEstimatedGas(
6061
contract: XtokensContract,
6162
): Promise<bigint> {
6263
if (!contract) {
6364
return 0n;
6465
}
6566

67+
// Temporary fix to Module(ModuleError { index: 51, error: [0, 0, 0, 0], message: None })
68+
// To be reverted next week when Moonbeam is in RT2900
69+
return 100000n;
70+
6671
// eslint-disable-next-line @typescript-eslint/no-explicit-any
67-
return contract.estimateGas[this.#config.func](this.#config.args as any);
72+
// return contract.estimateGas[this.#config.func](this.#config.args as any);
6873
}
6974

7075
async getFee(amount: bigint): Promise<bigint> {

packages/sdk/src/getTransferData/getSourceData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
DestinationFeeConfig,
1010
FeeAssetConfig,
1111
TransferConfig,
12-
movr,
1312
} from '@moonbeam-network/xcm-config';
1413
import { AnyChain, AssetAmount } from '@moonbeam-network/xcm-types';
1514
import {
@@ -133,12 +132,13 @@ export async function getSourceData({
133132

134133
const contract = config.contract?.build({
135134
address: destinationAddress,
136-
amount: asset === movr ? 1n : balance, // Temporary fix for MOVR gas estimation, pending resolution with moonsong labs team
135+
amount: balance,
137136
asset: chain.getAssetId(asset),
138137
destination: destination.chain,
139138
fee: destinationFee.amount,
140139
feeAsset: chain.getAssetId(destinationFee),
141140
});
141+
142142
const destinationFeeBalanceAmount = zeroDestinationFeeAmount.copyWith({
143143
amount: destinationFeeBalance,
144144
});

0 commit comments

Comments
 (0)