mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
Remove unused contracts
This commit is contained in:
parent
6ed39de29d
commit
6131165008
|
@ -1,13 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
contract Events {
|
|
||||||
event LogMigrateAaveV2(
|
|
||||||
address indexed owner,
|
|
||||||
address[] supplyTokens,
|
|
||||||
address[] borrowTokens,
|
|
||||||
uint[] supplyAmts,
|
|
||||||
uint[] variableBorrowAmts,
|
|
||||||
uint[] stableBorrowAmts
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
|
|
||||||
import { DSMath } from "../../common/math.sol";
|
|
||||||
import { Stores } from "../../common/stores-polygon.sol";
|
|
||||||
|
|
||||||
import {
|
|
||||||
AaveLendingPoolProviderInterface,
|
|
||||||
AaveDataProviderInterface,
|
|
||||||
AaveInterface
|
|
||||||
} from "./interfaces.sol";
|
|
||||||
|
|
||||||
abstract contract Helpers is DSMath, Stores {
|
|
||||||
/**
|
|
||||||
* @dev Aave referal code
|
|
||||||
*/
|
|
||||||
uint16 constant internal referralCode = 3228;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Aave Provider (TODO - Replace the address)
|
|
||||||
*/
|
|
||||||
AaveLendingPoolProviderInterface constant internal aaveProvider = AaveLendingPoolProviderInterface(0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Aave Data Provider (TODO - Replace the address)
|
|
||||||
*/
|
|
||||||
AaveDataProviderInterface constant internal aaveData = AaveDataProviderInterface(0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d);
|
|
||||||
|
|
||||||
function getIsColl(address token) internal view returns (bool isCol) {
|
|
||||||
(, , , , , , , , isCol) = aaveData.getUserReserveData(token, address(this));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,86 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
interface AaveInterface {
|
|
||||||
function deposit(address _asset, uint256 _amount, address _onBehalfOf, uint16 _referralCode) external;
|
|
||||||
function withdraw(address _asset, uint256 _amount, address _to) external;
|
|
||||||
function borrow(
|
|
||||||
address _asset,
|
|
||||||
uint256 _amount,
|
|
||||||
uint256 _interestRateMode,
|
|
||||||
uint16 _referralCode,
|
|
||||||
address _onBehalfOf
|
|
||||||
) external;
|
|
||||||
function repay(address _asset, uint256 _amount, uint256 _rateMode, address _onBehalfOf) external;
|
|
||||||
function setUserUseReserveAsCollateral(address _asset, bool _useAsCollateral) external;
|
|
||||||
function getUserAccountData(address user) external view returns (
|
|
||||||
uint256 totalCollateralETH,
|
|
||||||
uint256 totalDebtETH,
|
|
||||||
uint256 availableBorrowsETH,
|
|
||||||
uint256 currentLiquidationThreshold,
|
|
||||||
uint256 ltv,
|
|
||||||
uint256 healthFactor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AaveLendingPoolProviderInterface {
|
|
||||||
function getLendingPool() external view returns (address);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aave Protocol Data Provider
|
|
||||||
interface AaveDataProviderInterface {
|
|
||||||
function getReserveTokensAddresses(address _asset) external view returns (
|
|
||||||
address aTokenAddress,
|
|
||||||
address stableDebtTokenAddress,
|
|
||||||
address variableDebtTokenAddress
|
|
||||||
);
|
|
||||||
function getUserReserveData(address _asset, address _user) external view returns (
|
|
||||||
uint256 currentATokenBalance,
|
|
||||||
uint256 currentStableDebt,
|
|
||||||
uint256 currentVariableDebt,
|
|
||||||
uint256 principalStableDebt,
|
|
||||||
uint256 scaledVariableDebt,
|
|
||||||
uint256 stableBorrowRate,
|
|
||||||
uint256 liquidityRate,
|
|
||||||
uint40 stableRateLastUpdated,
|
|
||||||
bool usageAsCollateralEnabled
|
|
||||||
);
|
|
||||||
function getReserveConfigurationData(address asset) external view returns (
|
|
||||||
uint256 decimals,
|
|
||||||
uint256 ltv,
|
|
||||||
uint256 liquidationThreshold,
|
|
||||||
uint256 liquidationBonus,
|
|
||||||
uint256 reserveFactor,
|
|
||||||
bool usageAsCollateralEnabled,
|
|
||||||
bool borrowingEnabled,
|
|
||||||
bool stableBorrowRateEnabled,
|
|
||||||
bool isActive,
|
|
||||||
bool isFrozen
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AaveAddressProviderRegistryInterface {
|
|
||||||
function getAddressesProvidersList() external view returns (address[] memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ATokenInterface {
|
|
||||||
function scaledBalanceOf(address _user) external view returns (uint256);
|
|
||||||
function isTransferAllowed(address _user, uint256 _amount) external view returns (bool);
|
|
||||||
function balanceOf(address _user) external view returns(uint256);
|
|
||||||
function transferFrom(address, address, uint) external returns (bool);
|
|
||||||
function approve(address, uint256) external;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AaveData {
|
|
||||||
bool isFinal;
|
|
||||||
address targetDsa;
|
|
||||||
uint[] supplyAmts;
|
|
||||||
uint[] variableBorrowAmts;
|
|
||||||
uint[] stableBorrowAmts;
|
|
||||||
address[] supplyTokens;
|
|
||||||
address[] borrowTokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ReceiverInterface {
|
|
||||||
function getPosition(address) external view returns (AaveData memory);
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
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) {
|
|
||||||
receiver = ReceiverInterface(_receiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
function migrateAave(address owner) external payable returns (bytes32) {
|
|
||||||
require(msg.sender == address(receiver) && AccountInterface(address(this)).isAuth(owner), "not-authorized");
|
|
||||||
AaveData memory data = receiver.getPosition(owner);
|
|
||||||
require(!data.isFinal, "already-migrated");
|
|
||||||
|
|
||||||
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.supplyTokens.length; i++) {
|
|
||||||
TokenInterface token = TokenInterface(data.supplyTokens[i]);
|
|
||||||
uint amt = data.supplyAmts[i];
|
|
||||||
token.approve(address(aave), amt);
|
|
||||||
|
|
||||||
aave.deposit(address(token), amt, address(this), referralCode);
|
|
||||||
if (!getIsColl(address(token))) {
|
|
||||||
aave.setUserUseReserveAsCollateral(address(token), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.borrowTokens.length; i++) {
|
|
||||||
address token = data.borrowTokens[i];
|
|
||||||
uint variableAmt = data.variableBorrowAmts[i];
|
|
||||||
uint stableAmt = data.stableBorrowAmts[i];
|
|
||||||
|
|
||||||
if (variableAmt > 0) {
|
|
||||||
aave.borrow(token, variableAmt, 2, referralCode, address(this));
|
|
||||||
}
|
|
||||||
if (stableAmt > 0) {
|
|
||||||
aave.borrow(token, stableAmt, 1, referralCode, address(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
uint totalAmt = add(variableAmt, stableAmt);
|
|
||||||
IERC20(token).safeTransfer(address(receiver), totalAmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
contract Events {
|
|
||||||
event LogDeposit(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint[] amts
|
|
||||||
);
|
|
||||||
|
|
||||||
event LogWithdraw(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint[] amts
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
|
|
||||||
import { DSMath } from "../../common/math.sol";
|
|
||||||
import { TokenMappingInterface, AaveData } from "./interfaces.sol";
|
|
||||||
|
|
||||||
abstract contract Helpers is DSMath {
|
|
||||||
// Replace this
|
|
||||||
TokenMappingInterface tokenMapping = TokenMappingInterface(address(2));
|
|
||||||
|
|
||||||
function remapTokens(AaveData memory data) internal returns (AaveData memory) {
|
|
||||||
for (uint i = 0; i < data.supplyTokens.length; i++) {
|
|
||||||
data.supplyTokens[i] = tokenMapping.getMapping(data.supplyTokens[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.borrowTokens.length; i++) {
|
|
||||||
data.borrowTokens[i] = tokenMapping.getMapping(data.borrowTokens[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
interface AccountInterface {
|
|
||||||
function enable(address) external;
|
|
||||||
function disable(address) external;
|
|
||||||
function isAuth(address) external view returns (bool);
|
|
||||||
function cast(
|
|
||||||
string[] calldata _targets,
|
|
||||||
bytes[] calldata _datas,
|
|
||||||
address _origin
|
|
||||||
) external payable returns (bytes32);
|
|
||||||
function migrateAave(address) external payable returns (bytes32);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TokenMappingInterface {
|
|
||||||
function getMapping(address) external view returns (address);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AaveData {
|
|
||||||
bool isFinal;
|
|
||||||
address targetDsa;
|
|
||||||
uint[] supplyAmts;
|
|
||||||
uint[] variableBorrowAmts;
|
|
||||||
uint[] stableBorrowAmts;
|
|
||||||
address[] supplyTokens;
|
|
||||||
address[] borrowTokens;
|
|
||||||
}
|
|
|
@ -1,115 +0,0 @@
|
||||||
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 { AccountInterface, AaveData } from "./interfaces.sol";
|
|
||||||
import { Events } from "./events.sol";
|
|
||||||
import { Helpers } from "./helpers.sol";
|
|
||||||
|
|
||||||
contract MigrateResolver is Helpers, Events {
|
|
||||||
using SafeERC20 for IERC20;
|
|
||||||
|
|
||||||
mapping (address => AaveData) public positions;
|
|
||||||
mapping(address => mapping(address => uint)) deposits;
|
|
||||||
|
|
||||||
function deposit(address[] calldata tokens, uint[] calldata amts) external {
|
|
||||||
uint _length = tokens.length;
|
|
||||||
require(_length == amts.length, "invalid-length");
|
|
||||||
|
|
||||||
uint[] memory _amts = new uint[](_length);
|
|
||||||
|
|
||||||
for (uint256 i = 0; i < _length; i++) {
|
|
||||||
address _token = tokens[i];
|
|
||||||
|
|
||||||
IERC20 tokenContract = IERC20(_token);
|
|
||||||
uint _amt = amts[i] == uint(-1) ? tokenContract.balanceOf(msg.sender) : amts[i];
|
|
||||||
tokenContract.safeTransferFrom(msg.sender, address(this), _amt);
|
|
||||||
|
|
||||||
deposits[msg.sender][_token] = _amt;
|
|
||||||
_amts[i] = _amt;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit LogDeposit(msg.sender, tokens, _amts);
|
|
||||||
}
|
|
||||||
|
|
||||||
function withdraw(address[] calldata tokens, uint[] calldata amts) external {
|
|
||||||
uint _length = tokens.length;
|
|
||||||
require(_length == amts.length, "invalid-length");
|
|
||||||
|
|
||||||
uint[] memory _amts = new uint[](_length);
|
|
||||||
|
|
||||||
for (uint256 i = 0; i < _length; i++) {
|
|
||||||
uint _amt = amts[i];
|
|
||||||
address _token = tokens[i];
|
|
||||||
uint maxAmt = deposits[msg.sender][_token];
|
|
||||||
|
|
||||||
if (_amt > maxAmt) {
|
|
||||||
_amt = maxAmt;
|
|
||||||
}
|
|
||||||
|
|
||||||
IERC20(_token).safeTransfer(msg.sender, _amt);
|
|
||||||
|
|
||||||
deposits[msg.sender][_token] = sub(maxAmt, _amt);
|
|
||||||
|
|
||||||
_amts[i] = _amt;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit LogWithdraw(msg.sender, tokens, _amts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contract AaveV2Migrator is MigrateResolver {
|
|
||||||
using SafeERC20 for IERC20;
|
|
||||||
|
|
||||||
uint private lastStateId;
|
|
||||||
|
|
||||||
function _migratePosition(address owner) internal {
|
|
||||||
AaveData storage data = positions[owner];
|
|
||||||
|
|
||||||
require(!data.isFinal, "already-migrated");
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.supplyTokens.length; i++) {
|
|
||||||
IERC20(data.supplyTokens[i]).safeTransfer(data.targetDsa, data.supplyAmts[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
AccountInterface(data.targetDsa).migrateAave(owner);
|
|
||||||
data.isFinal = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPosition(address owner) public view returns (AaveData memory data) {
|
|
||||||
data = positions[owner];
|
|
||||||
}
|
|
||||||
|
|
||||||
function canMigrate(address owner) public view returns (bool can) {
|
|
||||||
can = true;
|
|
||||||
|
|
||||||
AaveData memory data = getPosition(owner);
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.supplyTokens.length; i++) {
|
|
||||||
IERC20 token = IERC20(data.supplyTokens[i]);
|
|
||||||
if (token.balanceOf(address(this)) < data.supplyAmts[i]) {
|
|
||||||
can = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onStateReceive(uint256 stateId, bytes calldata receivedData) external {
|
|
||||||
// require(stateId > lastStateId, "wrong-data");
|
|
||||||
lastStateId = stateId;
|
|
||||||
|
|
||||||
(address owner, AaveData memory data) = abi.decode(receivedData, (address, AaveData));
|
|
||||||
positions[owner] = remapTokens(data);
|
|
||||||
|
|
||||||
if (canMigrate(owner)) {
|
|
||||||
_migratePosition(owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function migrate(address owner) external {
|
|
||||||
require(canMigrate(owner), "not-enough-liquidity");
|
|
||||||
|
|
||||||
_migratePosition(owner);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
|
|
||||||
contract Events {
|
|
||||||
event LogAaveV2Migrate(
|
|
||||||
address indexed user,
|
|
||||||
address indexed targetDsa,
|
|
||||||
address[] supplyTokens,
|
|
||||||
address[] borrowTokens
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
|
|
||||||
import { DSMath } from "../../common/math.sol";
|
|
||||||
import { Stores } from "../../common/stores-mainnet.sol";
|
|
||||||
import { AaveLendingPoolProviderInterface, AaveDataProviderInterface, AaveMigratorInterface } from "./interfaces.sol";
|
|
||||||
|
|
||||||
abstract contract Helpers is DSMath, Stores {
|
|
||||||
|
|
||||||
AaveMigratorInterface constant internal migrator = AaveMigratorInterface(address(2)); // Replace this (Migrator contract)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Aave Data Provider
|
|
||||||
*/
|
|
||||||
AaveDataProviderInterface constant internal aaveData = AaveDataProviderInterface(0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d);
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
interface AaveInterface {
|
|
||||||
function deposit(address _asset, uint256 _amount, address _onBehalfOf, uint16 _referralCode) external;
|
|
||||||
function withdraw(address _asset, uint256 _amount, address _to) external;
|
|
||||||
function borrow(
|
|
||||||
address _asset,
|
|
||||||
uint256 _amount,
|
|
||||||
uint256 _interestRateMode,
|
|
||||||
uint16 _referralCode,
|
|
||||||
address _onBehalfOf
|
|
||||||
) external;
|
|
||||||
function repay(address _asset, uint256 _amount, uint256 _rateMode, address _onBehalfOf) external;
|
|
||||||
function setUserUseReserveAsCollateral(address _asset, bool _useAsCollateral) external;
|
|
||||||
function getUserAccountData(address user) external view returns (
|
|
||||||
uint256 totalCollateralETH,
|
|
||||||
uint256 totalDebtETH,
|
|
||||||
uint256 availableBorrowsETH,
|
|
||||||
uint256 currentLiquidationThreshold,
|
|
||||||
uint256 ltv,
|
|
||||||
uint256 healthFactor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AaveLendingPoolProviderInterface {
|
|
||||||
function getLendingPool() external view returns (address);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aave Protocol Data Provider
|
|
||||||
interface AaveDataProviderInterface {
|
|
||||||
function getReserveTokensAddresses(address _asset) external view returns (
|
|
||||||
address aTokenAddress,
|
|
||||||
address stableDebtTokenAddress,
|
|
||||||
address variableDebtTokenAddress
|
|
||||||
);
|
|
||||||
function getUserReserveData(address _asset, address _user) external view returns (
|
|
||||||
uint256 currentATokenBalance,
|
|
||||||
uint256 currentStableDebt,
|
|
||||||
uint256 currentVariableDebt,
|
|
||||||
uint256 principalStableDebt,
|
|
||||||
uint256 scaledVariableDebt,
|
|
||||||
uint256 stableBorrowRate,
|
|
||||||
uint256 liquidityRate,
|
|
||||||
uint40 stableRateLastUpdated,
|
|
||||||
bool usageAsCollateralEnabled
|
|
||||||
);
|
|
||||||
function getReserveConfigurationData(address asset) external view returns (
|
|
||||||
uint256 decimals,
|
|
||||||
uint256 ltv,
|
|
||||||
uint256 liquidationThreshold,
|
|
||||||
uint256 liquidationBonus,
|
|
||||||
uint256 reserveFactor,
|
|
||||||
bool usageAsCollateralEnabled,
|
|
||||||
bool borrowingEnabled,
|
|
||||||
bool stableBorrowRateEnabled,
|
|
||||||
bool isActive,
|
|
||||||
bool isFrozen
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AaveAddressProviderRegistryInterface {
|
|
||||||
function getAddressesProvidersList() external view returns (address[] memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ATokenInterface {
|
|
||||||
function scaledBalanceOf(address _user) external view returns (uint256);
|
|
||||||
function isTransferAllowed(address _user, uint256 _amount) external view returns (bool);
|
|
||||||
function balanceOf(address _user) external view returns(uint256);
|
|
||||||
function transferFrom(address, address, uint) external returns (bool);
|
|
||||||
function approve(address, uint256) external;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AaveMigratorInterface {
|
|
||||||
function migrate(address, address, address[] calldata, address[] calldata) external;
|
|
||||||
function migrate(address, AaveData memory) external;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct AaveData {
|
|
||||||
bool isFinal;
|
|
||||||
address targetDsa;
|
|
||||||
uint[] supplyAmts;
|
|
||||||
uint[] variableBorrowAmts;
|
|
||||||
uint[] stableBorrowAmts;
|
|
||||||
address[] supplyTokens;
|
|
||||||
address[] borrowTokens;
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
import { TokenInterface, AccountInterface } from "../../common/interfaces.sol";
|
|
||||||
import { AaveInterface, ATokenInterface, AaveData } from "./interfaces.sol";
|
|
||||||
import { Helpers } from "./helpers.sol";
|
|
||||||
import { Events } from "./events.sol";
|
|
||||||
|
|
||||||
contract AaveMigrateResolver is Helpers, Events {
|
|
||||||
|
|
||||||
// function migrate(
|
|
||||||
// address targetDsa,
|
|
||||||
// address[] calldata supplyTokens,
|
|
||||||
// address[] calldata borrowTokens
|
|
||||||
// ) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
|
||||||
// require(supplyTokens.length > 0, "0-length-not-allowed");
|
|
||||||
// require(targetDsa != address(0), "invalid-address");
|
|
||||||
|
|
||||||
// for (uint i = 0; i < supplyTokens.length; i++) {
|
|
||||||
// address _token = supplyTokens[i] == ethAddr ? wethAddr : supplyTokens[i];
|
|
||||||
// (address _aToken, ,) = aaveData.getReserveTokensAddresses(_token);
|
|
||||||
// ATokenInterface _aTokenContract = ATokenInterface(_aToken);
|
|
||||||
// _aTokenContract.approve(address(migrator), _aTokenContract.balanceOf(address(this)));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// migrator.migrate(msg.sender, targetDsa, supplyTokens, borrowTokens);
|
|
||||||
|
|
||||||
// _eventName = "LogAaveV2Migrate(address,address,address[],address[])";
|
|
||||||
// _eventParam = abi.encode(msg.sender, targetDsa, supplyTokens, borrowTokens);
|
|
||||||
// }
|
|
||||||
|
|
||||||
function migrate(
|
|
||||||
AaveData calldata _data
|
|
||||||
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
|
||||||
require(_data.supplyTokens.length > 0, "0-length-not-allowed");
|
|
||||||
require(_data.supplyTokens.length == _data.supplyAmts.length, "invalid-length");
|
|
||||||
require(_data.targetDsa != address(0), "invalid-address");
|
|
||||||
require(!_data.isFinal, "wrong-data");
|
|
||||||
|
|
||||||
AaveData memory data;
|
|
||||||
|
|
||||||
data.borrowTokens = _data.borrowTokens;
|
|
||||||
data.isFinal = _data.isFinal;
|
|
||||||
data.stableBorrowAmts = _data.stableBorrowAmts;
|
|
||||||
data.supplyAmts = _data.supplyAmts;
|
|
||||||
data.supplyTokens = _data.supplyTokens;
|
|
||||||
data.targetDsa = _data.targetDsa;
|
|
||||||
data.variableBorrowAmts = _data.variableBorrowAmts;
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.supplyTokens.length; i++) {
|
|
||||||
address _token = data.supplyTokens[i] == ethAddr ? wethAddr : data.supplyTokens[i];
|
|
||||||
data.supplyTokens[i] = _token;
|
|
||||||
(address _aToken, ,) = aaveData.getReserveTokensAddresses(_token);
|
|
||||||
ATokenInterface _aTokenContract = ATokenInterface(_aToken);
|
|
||||||
|
|
||||||
if (data.supplyAmts[i] == uint(-1)) {
|
|
||||||
data.supplyAmts[i] = _aTokenContract.balanceOf(address(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
_aTokenContract.approve(address(migrator), data.supplyAmts[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
migrator.migrate(msg.sender, data);
|
|
||||||
|
|
||||||
_eventName = "LogAaveV2Migrate(address,address,address[],address[])";
|
|
||||||
_eventParam = abi.encode(msg.sender, data.targetDsa, data.supplyTokens, data.borrowTokens);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contract AaveV2Migrator is AaveMigrateResolver {
|
|
||||||
string constant public name = "AaveV2PolygonMigrator-v1";
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
contract Events {
|
|
||||||
event LogDeposit(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint[] amts
|
|
||||||
);
|
|
||||||
|
|
||||||
event LogWithdraw(
|
|
||||||
address owner,
|
|
||||||
address[] tokens,
|
|
||||||
uint[] amts
|
|
||||||
);
|
|
||||||
|
|
||||||
event LogAaveV2Migrate(
|
|
||||||
address indexed user,
|
|
||||||
address indexed targetDsa,
|
|
||||||
address[] supplyTokens,
|
|
||||||
address[] borrowTokens,
|
|
||||||
uint[] supplyAmts,
|
|
||||||
uint[] variableBorrowAmts,
|
|
||||||
uint[] stableBorrowAmts
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
|
|
||||||
import { DSMath } from "../../common/math.sol";
|
|
||||||
import { Stores } from "../../common/stores-mainnet.sol";
|
|
||||||
|
|
||||||
import {
|
|
||||||
AaveLendingPoolProviderInterface,
|
|
||||||
AaveDataProviderInterface,
|
|
||||||
AaveInterface,
|
|
||||||
StateSenderInterface
|
|
||||||
} from "./interfaces.sol";
|
|
||||||
|
|
||||||
abstract contract Helpers is DSMath, Stores {
|
|
||||||
/**
|
|
||||||
* @dev Aave referal code
|
|
||||||
*/
|
|
||||||
uint16 constant internal referralCode = 3228;
|
|
||||||
|
|
||||||
address constant internal polygonReceiver = address(2); // Replace this
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Aave Provider
|
|
||||||
*/
|
|
||||||
AaveLendingPoolProviderInterface constant internal aaveProvider = AaveLendingPoolProviderInterface(0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Aave Data Provider
|
|
||||||
*/
|
|
||||||
AaveDataProviderInterface constant internal aaveData = AaveDataProviderInterface(0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Polygon State Sync Contract
|
|
||||||
*/
|
|
||||||
StateSenderInterface constant internal stateSender = StateSenderInterface(0x28e4F3a7f651294B9564800b2D01f35189A5bFbE);
|
|
||||||
|
|
||||||
function _paybackBehalfOne(AaveInterface aave, address token, uint amt, uint rateMode, address user) private {
|
|
||||||
aave.repay(token, amt, rateMode, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
function _PaybackStable(
|
|
||||||
uint _length,
|
|
||||||
AaveInterface aave,
|
|
||||||
address[] memory tokens,
|
|
||||||
uint256[] memory amts,
|
|
||||||
address user
|
|
||||||
) internal {
|
|
||||||
for (uint i = 0; i < _length; i++) {
|
|
||||||
if (amts[i] > 0) {
|
|
||||||
_paybackBehalfOne(aave, tokens[i], amts[i], 1, user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _PaybackVariable(
|
|
||||||
uint _length,
|
|
||||||
AaveInterface aave,
|
|
||||||
address[] memory tokens,
|
|
||||||
uint256[] memory amts,
|
|
||||||
address user
|
|
||||||
) internal {
|
|
||||||
for (uint i = 0; i < _length; i++) {
|
|
||||||
if (amts[i] > 0) {
|
|
||||||
_paybackBehalfOne(aave, tokens[i], amts[i], 2, user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _Withdraw(
|
|
||||||
uint _length,
|
|
||||||
AaveInterface aave,
|
|
||||||
address[] memory tokens,
|
|
||||||
uint256[] memory amts
|
|
||||||
) internal {
|
|
||||||
for (uint i = 0; i < _length; i++) {
|
|
||||||
if (amts[i] > 0) {
|
|
||||||
aave.withdraw(tokens[i], amts[i], address(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
pragma solidity ^0.7.0;
|
|
||||||
pragma experimental ABIEncoderV2;
|
|
||||||
|
|
||||||
interface AaveInterface {
|
|
||||||
function deposit(address _asset, uint256 _amount, address _onBehalfOf, uint16 _referralCode) external;
|
|
||||||
function withdraw(address _asset, uint256 _amount, address _to) external;
|
|
||||||
function borrow(
|
|
||||||
address _asset,
|
|
||||||
uint256 _amount,
|
|
||||||
uint256 _interestRateMode,
|
|
||||||
uint16 _referralCode,
|
|
||||||
address _onBehalfOf
|
|
||||||
) external;
|
|
||||||
function repay(address _asset, uint256 _amount, uint256 _rateMode, address _onBehalfOf) external;
|
|
||||||
function setUserUseReserveAsCollateral(address _asset, bool _useAsCollateral) external;
|
|
||||||
function getUserAccountData(address user) external view returns (
|
|
||||||
uint256 totalCollateralETH,
|
|
||||||
uint256 totalDebtETH,
|
|
||||||
uint256 availableBorrowsETH,
|
|
||||||
uint256 currentLiquidationThreshold,
|
|
||||||
uint256 ltv,
|
|
||||||
uint256 healthFactor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AaveLendingPoolProviderInterface {
|
|
||||||
function getLendingPool() external view returns (address);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aave Protocol Data Provider
|
|
||||||
interface AaveDataProviderInterface {
|
|
||||||
function getReserveTokensAddresses(address _asset) external view returns (
|
|
||||||
address aTokenAddress,
|
|
||||||
address stableDebtTokenAddress,
|
|
||||||
address variableDebtTokenAddress
|
|
||||||
);
|
|
||||||
function getUserReserveData(address _asset, address _user) external view returns (
|
|
||||||
uint256 currentATokenBalance,
|
|
||||||
uint256 currentStableDebt,
|
|
||||||
uint256 currentVariableDebt,
|
|
||||||
uint256 principalStableDebt,
|
|
||||||
uint256 scaledVariableDebt,
|
|
||||||
uint256 stableBorrowRate,
|
|
||||||
uint256 liquidityRate,
|
|
||||||
uint40 stableRateLastUpdated,
|
|
||||||
bool usageAsCollateralEnabled
|
|
||||||
);
|
|
||||||
function getReserveConfigurationData(address asset) external view returns (
|
|
||||||
uint256 decimals,
|
|
||||||
uint256 ltv,
|
|
||||||
uint256 liquidationThreshold,
|
|
||||||
uint256 liquidationBonus,
|
|
||||||
uint256 reserveFactor,
|
|
||||||
bool usageAsCollateralEnabled,
|
|
||||||
bool borrowingEnabled,
|
|
||||||
bool stableBorrowRateEnabled,
|
|
||||||
bool isActive,
|
|
||||||
bool isFrozen
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AaveAddressProviderRegistryInterface {
|
|
||||||
function getAddressesProvidersList() external view returns (address[] memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ATokenInterface {
|
|
||||||
function scaledBalanceOf(address _user) external view returns (uint256);
|
|
||||||
function isTransferAllowed(address _user, uint256 _amount) external view returns (bool);
|
|
||||||
function balanceOf(address _user) external view returns(uint256);
|
|
||||||
function transferFrom(address, address, uint) external returns (bool);
|
|
||||||
function approve(address, uint256) external;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface StateSenderInterface {
|
|
||||||
function syncState(address receiver, bytes calldata data) external;
|
|
||||||
function register(address sender, address receiver) external;
|
|
||||||
}
|
|
|
@ -1,241 +0,0 @@
|
||||||
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 } from "../../common/interfaces.sol";
|
|
||||||
import { Helpers } from "./helpers.sol";
|
|
||||||
import { AaveInterface, ATokenInterface } from "./interfaces.sol";
|
|
||||||
import { Events } from "./events.sol";
|
|
||||||
|
|
||||||
contract LiquidityResolver is Helpers, Events {
|
|
||||||
using SafeERC20 for IERC20;
|
|
||||||
|
|
||||||
mapping(address => mapping(address => uint)) deposits;
|
|
||||||
|
|
||||||
function deposit(address[] calldata tokens, uint[] calldata amts) external payable {
|
|
||||||
uint _length = tokens.length;
|
|
||||||
require(_length == amts.length, "invalid-length");
|
|
||||||
|
|
||||||
uint[] memory _amts = new uint[](_length);
|
|
||||||
|
|
||||||
for (uint256 i = 0; i < _length; i++) {
|
|
||||||
uint _amt;
|
|
||||||
address _token = tokens[i];
|
|
||||||
if (_token == ethAddr) {
|
|
||||||
require(msg.value == amts[i]);
|
|
||||||
_amt = msg.value;
|
|
||||||
|
|
||||||
TokenInterface(wethAddr).deposit{value: msg.value}();
|
|
||||||
} else {
|
|
||||||
IERC20 tokenContract = IERC20(_token);
|
|
||||||
_amt = amts[i] == uint(-1) ? tokenContract.balanceOf(msg.sender) : amts[i];
|
|
||||||
tokenContract.safeTransferFrom(msg.sender, address(this), _amt);
|
|
||||||
}
|
|
||||||
|
|
||||||
_amts[i] = _amt;
|
|
||||||
|
|
||||||
deposits[msg.sender][_token] = _amt;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit LogDeposit(msg.sender, tokens, _amts);
|
|
||||||
}
|
|
||||||
|
|
||||||
function withdraw(address[] calldata tokens, uint[] calldata amts) external {
|
|
||||||
uint _length = tokens.length;
|
|
||||||
require(_length == amts.length, "invalid-length");
|
|
||||||
|
|
||||||
uint[] memory _amts = new uint[](_length);
|
|
||||||
|
|
||||||
for (uint256 i = 0; i < _length; i++) {
|
|
||||||
uint _amt = amts[i];
|
|
||||||
address _token = tokens[i];
|
|
||||||
uint maxAmt = deposits[msg.sender][_token];
|
|
||||||
|
|
||||||
if (_amt > maxAmt) {
|
|
||||||
_amt = maxAmt;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_token == ethAddr) {
|
|
||||||
TokenInterface(wethAddr).withdraw(_amt);
|
|
||||||
msg.sender.call{value: _amt}("");
|
|
||||||
} else {
|
|
||||||
IERC20(_token).safeTransfer(msg.sender, _amt);
|
|
||||||
}
|
|
||||||
|
|
||||||
_amts[i] = _amt;
|
|
||||||
|
|
||||||
deposits[msg.sender][_token] = sub(maxAmt, _amt);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit LogWithdraw(msg.sender, tokens, _amts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contract MigrateResolver is LiquidityResolver {
|
|
||||||
using SafeERC20 for IERC20;
|
|
||||||
|
|
||||||
struct AaveData {
|
|
||||||
bool isFinal;
|
|
||||||
address targetDsa;
|
|
||||||
uint[] supplyAmts;
|
|
||||||
uint[] variableBorrowAmts;
|
|
||||||
uint[] stableBorrowAmts;
|
|
||||||
address[] supplyTokens;
|
|
||||||
address[] borrowTokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
mapping (address => AaveData) public positions;
|
|
||||||
|
|
||||||
function migrate(address owner, AaveData calldata _data) external {
|
|
||||||
require(_data.supplyTokens.length > 0, "0-length-not-allowed");
|
|
||||||
require(_data.targetDsa != address(0), "invalid-address");
|
|
||||||
require(_data.supplyTokens.length == _data.supplyAmts.length, "invalid-length");
|
|
||||||
require(
|
|
||||||
_data.borrowTokens.length == _data.variableBorrowAmts.length &&
|
|
||||||
_data.borrowTokens.length == _data.stableBorrowAmts.length,
|
|
||||||
"invalid-length"
|
|
||||||
);
|
|
||||||
|
|
||||||
AaveData memory data;
|
|
||||||
|
|
||||||
data.borrowTokens = _data.borrowTokens;
|
|
||||||
data.isFinal = _data.isFinal;
|
|
||||||
data.stableBorrowAmts = _data.stableBorrowAmts;
|
|
||||||
data.supplyAmts = _data.supplyAmts;
|
|
||||||
data.supplyTokens = _data.supplyTokens;
|
|
||||||
data.targetDsa = _data.targetDsa;
|
|
||||||
data.variableBorrowAmts = _data.variableBorrowAmts;
|
|
||||||
|
|
||||||
address sourceDsa = msg.sender;
|
|
||||||
|
|
||||||
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
|
|
||||||
|
|
||||||
(,,,,,uint healthFactor) = aave.getUserAccountData(sourceDsa);
|
|
||||||
require(healthFactor > 1e18, "position-not-safe");
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.supplyTokens.length; i++) {
|
|
||||||
(address _aToken, ,) = aaveData.getReserveTokensAddresses(data.supplyTokens[i]);
|
|
||||||
ATokenInterface aTokenContract = ATokenInterface(_aToken);
|
|
||||||
|
|
||||||
aTokenContract.transferFrom(msg.sender, address(this), data.supplyAmts[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint i = 0; i < data.borrowTokens.length; i++) {
|
|
||||||
address _token = data.borrowTokens[i] == ethAddr ? wethAddr : data.borrowTokens[i];
|
|
||||||
data.borrowTokens[i] = _token;
|
|
||||||
|
|
||||||
(
|
|
||||||
,
|
|
||||||
uint stableDebt,
|
|
||||||
uint variableDebt,
|
|
||||||
,,,,,
|
|
||||||
) = aaveData.getUserReserveData(_token, sourceDsa);
|
|
||||||
|
|
||||||
data.stableBorrowAmts[i] = data.stableBorrowAmts[i] == uint(-1) ? stableDebt : data.stableBorrowAmts[i];
|
|
||||||
data.variableBorrowAmts[i] = data.variableBorrowAmts[i] == uint(-1) ? variableDebt : data.variableBorrowAmts[i];
|
|
||||||
|
|
||||||
|
|
||||||
uint totalBorrowAmt = add(data.stableBorrowAmts[i], data.variableBorrowAmts[i]);
|
|
||||||
if (totalBorrowAmt > 0) {
|
|
||||||
IERC20(_token).safeApprove(address(aave), totalBorrowAmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_PaybackStable(data.borrowTokens.length, aave, data.borrowTokens, data.stableBorrowAmts, sourceDsa);
|
|
||||||
_PaybackVariable(data.borrowTokens.length, aave, data.borrowTokens, data.variableBorrowAmts, sourceDsa);
|
|
||||||
_Withdraw(data.supplyTokens.length, aave, data.supplyTokens, data.supplyAmts);
|
|
||||||
|
|
||||||
positions[owner] = data;
|
|
||||||
bytes memory positionData = abi.encode(owner, data);
|
|
||||||
stateSender.syncState(polygonReceiver, positionData);
|
|
||||||
|
|
||||||
emit LogAaveV2Migrate(
|
|
||||||
msg.sender,
|
|
||||||
data.targetDsa,
|
|
||||||
data.supplyTokens,
|
|
||||||
data.borrowTokens,
|
|
||||||
data.supplyAmts,
|
|
||||||
data.variableBorrowAmts,
|
|
||||||
data.stableBorrowAmts
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// function migrate(
|
|
||||||
// address owner,
|
|
||||||
// address targetDsa,
|
|
||||||
// address[] calldata supplyTokens,
|
|
||||||
// address[] calldata borrowTokens
|
|
||||||
// ) external {
|
|
||||||
// require(supplyTokens.length > 0, "0-length-not-allowed");
|
|
||||||
// require(targetDsa != address(0), "invalid-address");
|
|
||||||
|
|
||||||
// address sourceDsa = msg.sender;
|
|
||||||
|
|
||||||
// AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
|
|
||||||
|
|
||||||
// AaveData memory data;
|
|
||||||
|
|
||||||
// (,,,,,uint healthFactor) = aave.getUserAccountData(sourceDsa);
|
|
||||||
// require(healthFactor > 1e18, "position-not-safe");
|
|
||||||
|
|
||||||
// data.supplyAmts = new uint[](supplyTokens.length);
|
|
||||||
// data.supplyTokens = new address[](supplyTokens.length);
|
|
||||||
// data.targetDsa = targetDsa;
|
|
||||||
|
|
||||||
// for (uint i = 0; i < supplyTokens.length; i++) {
|
|
||||||
// address _token = supplyTokens[i] == ethAddr ? wethAddr : supplyTokens[i];
|
|
||||||
// (address _aToken, ,) = aaveData.getReserveTokensAddresses(_token);
|
|
||||||
|
|
||||||
// ATokenInterface aTokenContract = ATokenInterface(_aToken);
|
|
||||||
|
|
||||||
// data.supplyTokens[i] = _token;
|
|
||||||
// data.supplyAmts[i] = aTokenContract.balanceOf(sourceDsa);
|
|
||||||
|
|
||||||
// aTokenContract.transferFrom(msg.sender, address(this), data.supplyAmts[i]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (borrowTokens.length > 0) {
|
|
||||||
// data.variableBorrowAmts = new uint[](borrowTokens.length);
|
|
||||||
// data.stableBorrowAmts = new uint[](borrowTokens.length);
|
|
||||||
|
|
||||||
// for (uint i = 0; i < borrowTokens.length; i++) {
|
|
||||||
// address _token = borrowTokens[i] == ethAddr ? wethAddr : borrowTokens[i];
|
|
||||||
// data.borrowTokens[i] = _token;
|
|
||||||
|
|
||||||
// (
|
|
||||||
// ,
|
|
||||||
// data.stableBorrowAmts[i],
|
|
||||||
// data.variableBorrowAmts[i],
|
|
||||||
// ,,,,,
|
|
||||||
// ) = aaveData.getUserReserveData(_token, sourceDsa);
|
|
||||||
|
|
||||||
// uint totalBorrowAmt = add(data.stableBorrowAmts[i], data.variableBorrowAmts[i]);
|
|
||||||
|
|
||||||
// if (totalBorrowAmt > 0) {
|
|
||||||
// IERC20(_token).safeApprove(address(aave), totalBorrowAmt);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// _PaybackStable(borrowTokens.length, aave, data.borrowTokens, data.stableBorrowAmts, sourceDsa);
|
|
||||||
// _PaybackVariable(borrowTokens.length, aave, data.borrowTokens, data.variableBorrowAmts, sourceDsa);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// _Withdraw(supplyTokens.length, aave, data.supplyTokens, data.supplyAmts);
|
|
||||||
|
|
||||||
// positions[owner] = data;
|
|
||||||
// bytes memory positionData = abi.encode(owner, data);
|
|
||||||
// stateSender.syncState(polygonReceiver, positionData);
|
|
||||||
|
|
||||||
// emit LogAaveV2Migrate(
|
|
||||||
// msg.sender,
|
|
||||||
// targetDsa,
|
|
||||||
// supplyTokens,
|
|
||||||
// borrowTokens,
|
|
||||||
// data.supplyAmts,
|
|
||||||
// data.variableBorrowAmts,
|
|
||||||
// data.stableBorrowAmts
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user