Skip to content

Commit

Permalink
Fix transaction fee token
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Dec 18, 2023
1 parent 54b4165 commit 870d95b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bridges/xtoken-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export class XTokenV3Bridge extends BaseBridge {
abi: (await import("@/abi/xtoken-backing")).default,
functionName: "lockAndRemoteIssuing",
args: [BigInt(this.targetChain.id), this.sourceToken.address, recipient, amount, feeAndParams.extParams],
value: feeAndParams.fee,
gas: this.getTxGasLimit(),
account,
} as const;

Expand All @@ -62,6 +64,8 @@ export class XTokenV3Bridge extends BaseBridge {
abi: (await import("@/abi/xtoken-issuing")).default,
functionName: "burnAndRemoteUnlock",
args: [this.sourceToken.address, recipient, amount, feeAndParams.extParams],
value: feeAndParams.fee,
gas: this.getTxGasLimit(),
account,
} as const;

Expand Down Expand Up @@ -122,12 +126,12 @@ export class XTokenV3Bridge extends BaseBridge {
}

async getFee(args?: GetFeeArgs | undefined): Promise<{ value: bigint; token: Token } | undefined> {
if (this.sourceToken) {
if (this.sourceNativeToken) {
const sender = args?.sender ?? "0x0000000000000000000000000000000000000000";
const recipient = args?.recipient ?? "0x0000000000000000000000000000000000000000";
const feeAndParams = await this._getMsgportFeeAndParams(sender, recipient, args?.transferAmount ?? 0n);
if (feeAndParams) {
return { value: feeAndParams.fee, token: this.sourceToken };
return { value: feeAndParams.fee, token: this.sourceNativeToken };
}
}
}
Expand Down

0 comments on commit 870d95b

Please sign in to comment.