mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
Transfer debt to receiver upon migration
This commit is contained in:
parent
1d2725f36a
commit
dd01e5592f
|
@ -1,12 +1,17 @@
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
pragma experimental ABIEncoderV2;
|
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 { TokenInterface, AccountInterface } from "../../common/interfaces.sol";
|
||||||
import { AaveInterface, ReceiverInterface, AaveData } from "./interfaces.sol";
|
import { AaveInterface, ReceiverInterface, AaveData } from "./interfaces.sol";
|
||||||
import { Helpers } from "./helpers.sol";
|
import { Helpers } from "./helpers.sol";
|
||||||
import { Events } from "./events.sol";
|
import { Events } from "./events.sol";
|
||||||
|
|
||||||
contract AaveMigratorResolver is Helpers, Events {
|
contract AaveMigratorResolver is Helpers, Events {
|
||||||
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
ReceiverInterface public immutable receiver;
|
ReceiverInterface public immutable receiver;
|
||||||
|
|
||||||
constructor(address _receiver) {
|
constructor(address _receiver) {
|
||||||
|
@ -42,6 +47,9 @@ contract AaveMigratorResolver is Helpers, Events {
|
||||||
if (stableAmt > 0) {
|
if (stableAmt > 0) {
|
||||||
aave.borrow(token, stableAmt, 1, referralCode, address(this));
|
aave.borrow(token, stableAmt, 1, referralCode, address(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint totalAmt = add(variableAmt, stableAmt);
|
||||||
|
IERC20(token).safeTransfer(address(receiver), totalAmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user