Skip to content

Commit

Permalink
uniswap multicall: don't unfold batches with value > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jfschwarz committed Sep 30, 2024
1 parent c461715 commit a7fdddf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions extension/src/transactionTranslations/uniswapMulticall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ export default {
recommendedFor: [KnownContracts.ROLES_V1, KnownContracts.ROLES_V2],

translate: async (transaction) => {
if (!transaction.data) {
const { to, data, value } = transaction

if (!data) {
return undefined
}

if (parseInt(value) > 0) {
// We don't support unfolding of transactions with value since it's hard to tell which individual calls are supposed to receive the value
return undefined
}

Expand All @@ -25,7 +32,7 @@ export default {
try {
functionCalls = uniswapMulticallInterface.decodeFunctionData(
fragment as FunctionFragment,
transaction.data
data
).data as string[]
break
} catch (e) {
Expand All @@ -37,6 +44,6 @@ export default {
return undefined
}

return functionCalls.map((data) => ({ ...transaction, data }))
return functionCalls.map((data) => ({ to, data, value: '0' }))
},
} satisfies TransactionTranslation

0 comments on commit a7fdddf

Please sign in to comment.