From 38c5b984a6a3d19176e173f6ae613723097c4750 Mon Sep 17 00:00:00 2001 From: Mubaris NK Date: Fri, 16 Apr 2021 21:34:35 +0530 Subject: [PATCH] Add DSA v2 check --- contracts/receivers/aave-v2-receiver/interfaces.sol | 1 + contracts/receivers/aave-v2-receiver/main.sol | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/receivers/aave-v2-receiver/interfaces.sol b/contracts/receivers/aave-v2-receiver/interfaces.sol index f481668..5ff7f9a 100644 --- a/contracts/receivers/aave-v2-receiver/interfaces.sol +++ b/contracts/receivers/aave-v2-receiver/interfaces.sol @@ -10,6 +10,7 @@ interface AccountInterface { bytes[] calldata _datas, address _origin ) external payable returns (bytes32); + function version() external view returns (uint); } interface TokenMappingInterface { diff --git a/contracts/receivers/aave-v2-receiver/main.sol b/contracts/receivers/aave-v2-receiver/main.sol index 1a20c19..b858853 100644 --- a/contracts/receivers/aave-v2-receiver/main.sol +++ b/contracts/receivers/aave-v2-receiver/main.sol @@ -99,8 +99,8 @@ contract AaveV2Migrator is MigrateResolver { address[] memory supplyTokens = data.supplyTokens; address[] memory borrowTokens = data.borrowTokens; - // TODO: IMPORTANT!! before migrating make sure the new DSA is v2 DSA on L1. require(instaList.accountID(dsa) != 0, "not-a-dsa"); + require(AccountInterface(dsa).version() == 2, "not-v2-dsa"); AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());