Transfer debt to receiver upon migration

This commit is contained in:
Mubaris NK 2021-04-04 11:06:01 +05:30
parent 1d2725f36a
commit dd01e5592f
No known key found for this signature in database
GPG Key ID: 9AC09AD0F8D68561

View File

@ -1,12 +1,17 @@
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { TokenInterface, AccountInterface } from "../../common/interfaces.sol";
import { AaveInterface, ReceiverInterface, AaveData } from "./interfaces.sol";
import { Helpers } from "./helpers.sol";
import { Events } from "./events.sol";
contract AaveMigratorResolver is Helpers, Events {
using SafeERC20 for IERC20;
ReceiverInterface public immutable receiver;
constructor(address _receiver) {
@ -42,6 +47,9 @@ contract AaveMigratorResolver is Helpers, Events {
if (stableAmt > 0) {
aave.borrow(token, stableAmt, 1, referralCode, address(this));
}
uint totalAmt = add(variableAmt, stableAmt);
IERC20(token).safeTransfer(address(receiver), totalAmt);
}
}
}