mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
added onDeferredLiquidityCheck
This commit is contained in:
parent
21cc81553c
commit
5682362f34
|
@ -83,13 +83,14 @@ contract EulerHelpers is Basic {
|
||||||
ImportInputData memory inputData,
|
ImportInputData memory inputData,
|
||||||
ImportData memory data
|
ImportData memory data
|
||||||
) internal view returns (ImportData memory) {
|
) internal view returns (ImportData memory) {
|
||||||
if (inputData.borrowTokens.length > 0) {
|
uint _borrowTokensLength = inputData.borrowTokens.length;
|
||||||
data._borrowTokens = new address[](inputData.borrowTokens.length);
|
|
||||||
data.borrowAmts = new uint256[](
|
if (_borrowTokensLength > 0) {
|
||||||
inputData.borrowTokens.length
|
data._borrowTokens = new address[](_borrowTokensLength);
|
||||||
);
|
data.dTokens = new EulerTokenInterface[](_borrowTokensLength);
|
||||||
for (uint256 i = 0; i < inputData.borrowTokens.length; i++) {
|
data.borrowAmts = new uint256[](_borrowTokensLength);
|
||||||
for (uint256 j = i; j < inputData.borrowTokens.length; j++) {
|
for (uint256 i = 0; i < _borrowTokensLength; i++) {
|
||||||
|
for (uint256 j = i; j < _borrowTokensLength; j++) {
|
||||||
if (j != i) {
|
if (j != i) {
|
||||||
require(
|
require(
|
||||||
inputData.borrowTokens[i] !=
|
inputData.borrowTokens[i] !=
|
||||||
|
@ -99,7 +100,8 @@ contract EulerHelpers is Basic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint256 i = 0; i < inputData.borrowTokens.length; i++) {
|
|
||||||
|
for (uint256 i = 0; i < _borrowTokensLength; i++) {
|
||||||
address _token = inputData.borrowTokens[i] == ethAddr
|
address _token = inputData.borrowTokens[i] == ethAddr
|
||||||
? wethAddr
|
? wethAddr
|
||||||
: inputData.borrowTokens[i];
|
: inputData.borrowTokens[i];
|
||||||
|
@ -166,7 +168,4 @@ contract EulerHelpers is Basic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -53,7 +53,29 @@ contract EulerImport is EulerHelpers {
|
||||||
data = getBorrowAmounts(_sourceAccount, inputData, data);
|
data = getBorrowAmounts(_sourceAccount, inputData, data);
|
||||||
data = getSupplyAmounts(_targetAccount, inputData, data);
|
data = getSupplyAmounts(_targetAccount, inputData, data);
|
||||||
|
|
||||||
IEulerExecute(eulerExec).deferLiquidityCheck(_sourceAccount, "0x0");
|
eulerExec.deferLiquidityCheck(_sourceAccount, abi.encode(data, enterMarket, _sourceAccount, _targetAccount, targetId));
|
||||||
|
|
||||||
|
_eventName = "LogEulerImport(address,uint256,uint256,address[],address[],uint256[],uint256[],bool[])";
|
||||||
|
_eventParam = abi.encode(
|
||||||
|
userAccount,
|
||||||
|
sourceId,
|
||||||
|
targetId,
|
||||||
|
inputData.supplyTokens,
|
||||||
|
inputData.borrowTokens,
|
||||||
|
data.supplyAmts,
|
||||||
|
data.borrowAmts,
|
||||||
|
enterMarket
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDeferredLiquidityCheck(bytes memory encodedData) external {
|
||||||
|
(
|
||||||
|
ImportData memory data,
|
||||||
|
bool[] memory enterMarket,
|
||||||
|
address _sourceAccount,
|
||||||
|
address _targetAccount,
|
||||||
|
uint targetId
|
||||||
|
) = abi.decode(encodedData, (ImportData, bool[], address, address, uint));
|
||||||
|
|
||||||
_TransferEtokens(
|
_TransferEtokens(
|
||||||
data._supplyTokens.length,
|
data._supplyTokens.length,
|
||||||
|
@ -74,18 +96,6 @@ contract EulerImport is EulerHelpers {
|
||||||
_sourceAccount,
|
_sourceAccount,
|
||||||
_targetAccount
|
_targetAccount
|
||||||
);
|
);
|
||||||
|
|
||||||
_eventName = "LogEulerImport(address,uint256,uint256,address[],address[],uint256[],uint256[],bool[])";
|
|
||||||
_eventParam = abi.encode(
|
|
||||||
userAccount,
|
|
||||||
sourceId,
|
|
||||||
targetId,
|
|
||||||
inputData.supplyTokens,
|
|
||||||
inputData.borrowTokens,
|
|
||||||
data.supplyAmts,
|
|
||||||
data.borrowAmts,
|
|
||||||
enterMarket
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user