Skip to content

Commit

Permalink
feat: finish indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
kopy-kat committed Oct 24, 2024
1 parent 2c5e011 commit 38fbfaa
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions src/module/auto-savings/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,36 +97,32 @@ export const getDeleteAutoSavingConfigAction = async ({
}
}

export const getAutoSaveAction = async ({
export const getAutoSaveAction = ({
token,
amountReceived,
}: {
token: Address
amountReceived: number
}): Promise<Execution> => {
}): Execution => {
const swapDetails = getSwapDetails()
try {
const data = encodeFunctionData({
functionName: 'autoSave',
abi,
args: [
token,
BigInt(amountReceived),
swapDetails.sqrtPriceLimitX96,
swapDetails.amountOutMin,
swapDetails.fee,
],
})
const data = encodeFunctionData({
functionName: 'autoSave',
abi,
args: [
token,
BigInt(amountReceived),
swapDetails.sqrtPriceLimitX96,
swapDetails.amountOutMin,
swapDetails.fee,
],
})

return {
to: AUTO_SAVINGS_ADDRESS,
target: AUTO_SAVINGS_ADDRESS,
value: BigInt(0),
callData: data,
data,
}
} catch {
throw new Error(`Failed to create autosave action for token ${token}`)
return {
to: AUTO_SAVINGS_ADDRESS,
target: AUTO_SAVINGS_ADDRESS,
value: BigInt(0),
callData: data,
data,
}
}

Expand Down

0 comments on commit 38fbfaa

Please sign in to comment.