Skip to content

Commit b5312af

Browse files
authored
feat(flash-loans): add dappId to aave hooks (#645)
1 parent 203dbc6 commit b5312af

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/flash-loans/src/aave/AaveCollateralSwapSdk.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from './types'
2929
import {
3030
AAVE_ADAPTER_FACTORY,
31+
AAVE_DAPP_ID_PER_TYPE,
3132
AAVE_HOOK_ADAPTER_PER_TYPE,
3233
AAVE_POOL_ADDRESS,
3334
AaveFlashLoanType,
@@ -480,20 +481,23 @@ export class AaveCollateralSwapSdk {
480481
expectedInstanceAddress,
481482
)
482483
const postHookCallData = this.getFlashLoanPostHook(flashLoanType, collateralPermit)
484+
const dappId = AAVE_DAPP_ID_PER_TYPE[flashLoanType]
483485

484486
return {
485487
pre: [
486488
{
487489
target: AAVE_ADAPTER_FACTORY[chainId],
488490
callData: preHookCallData,
489491
gasLimit: DEFAULT_HOOK_GAS_LIMIT.pre.toString(),
492+
dappId,
490493
},
491494
],
492495
post: [
493496
{
494497
target: expectedInstanceAddress,
495498
callData: postHookCallData,
496499
gasLimit: DEFAULT_HOOK_GAS_LIMIT.post.toString(),
500+
dappId,
497501
},
498502
],
499503
}

packages/flash-loans/src/aave/const.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ export const EMPTY_PERMIT: CollateralPermitData = {
6262
r: HASH_ZERO,
6363
s: HASH_ZERO,
6464
}
65+
66+
export const AAVE_DAPP_ID_PER_TYPE: Record<AaveFlashLoanType, string> = {
67+
[AaveFlashLoanType.CollateralSwap]: 'cow-sdk://flashloans/aave/v3/collateral-swap',
68+
[AaveFlashLoanType.DebtSwap]: 'cow-sdk://flashloans/aave/v3/debt-swap',
69+
[AaveFlashLoanType.RepayCollateral]: 'cow-sdk://flashloans/aave/v3/repay-with-collateral',
70+
}

0 commit comments

Comments
 (0)