Skip to content

Commit

Permalink
fix: Estimate gas for v3 syntax fix (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Feb 21, 2024
1 parent 8733080 commit 8e8cefd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@across-protocol/sdk-v2",
"author": "UMA Team",
"version": "0.22.3",
"version": "0.22.4",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/v/developer-docs/developers/across-sdk",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/relayFeeCalculator/chain-queries/baseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default abstract class QueryBase implements QueryInterface {
* @returns The gas estimate for this function call (multplied with the optional buffer).
*/
async getV3GasCosts(deposit: V3Deposit, relayer: string): Promise<TransactionCostEstimate> {
const tx = await populateV3Relay(this.spokePool, deposit);
const tx = await populateV3Relay(this.spokePool, deposit, relayer);
return estimateTotalGasRequiredByUnsignedTransaction(
tx,
relayer,
Expand Down
24 changes: 20 additions & 4 deletions src/utils/SpokeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,39 @@ import { getNetworkName } from "./NetworkUtils";
export function populateV3Relay(
spokePool: Contract,
deposit: V3Deposit,
relayer: string,
repaymentChainId = deposit.destinationChainId
): Promise<PopulatedTransaction> {
const v3RelayData: V3RelayData = {
depositor: deposit.depositor,
recipient: deposit.recipient,
exclusiveRelayer: deposit.exclusiveRelayer,
inputToken: deposit.inputToken,
outputToken: deposit.outputToken,
inputAmount: deposit.inputAmount,
outputAmount: deposit.outputAmount,
originChainId: deposit.originChainId,
depositId: deposit.depositId,
fillDeadline: deposit.fillDeadline,
exclusivityDeadline: deposit.exclusivityDeadline,
message: deposit.message,
};
if (isDefined(deposit.speedUpSignature)) {
assert(isDefined(deposit.updatedRecipient) && deposit.updatedRecipient !== ZERO_ADDRESS);
assert(isDefined(deposit.updatedOutputAmount));
assert(isDefined(deposit.updatedMessage));
return spokePool.populateTransaction.fillV3RelayWithUpdatedDeposit([
deposit,
return spokePool.populateTransaction.fillV3RelayWithUpdatedDeposit(
v3RelayData,
repaymentChainId,
deposit.updatedOutputAmount,
deposit.updatedRecipient,
deposit.updatedMessage,
deposit.speedUpSignature,
]);
{ from: relayer }
);
}

return spokePool.populateTransaction.fillV3Relay([deposit, repaymentChainId]);
return spokePool.populateTransaction.fillV3Relay(v3RelayData, repaymentChainId, { from: relayer });
}

/**
Expand Down

0 comments on commit 8e8cefd

Please sign in to comment.