mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
minor edits + lint
This commit is contained in:
parent
bd03d6e709
commit
ecb57503ee
|
@ -3,11 +3,10 @@ pragma solidity ^0.7.0;
|
|||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract Events {
|
||||
|
||||
event LogEulerImport(
|
||||
address user,
|
||||
uint sourceId,
|
||||
uint targetId,
|
||||
uint256 sourceId,
|
||||
uint256 targetId,
|
||||
address[] supplyTokens,
|
||||
uint256[] supplyAmounts,
|
||||
address[] borrowTokens,
|
||||
|
|
|
@ -6,7 +6,6 @@ import { Basic } from "../../../common/basic.sol";
|
|||
import "./interface.sol";
|
||||
|
||||
contract EulerHelpers is Basic {
|
||||
|
||||
/**
|
||||
* @dev Euler's Market Module
|
||||
*/
|
||||
|
@ -16,7 +15,8 @@ contract EulerHelpers is Basic {
|
|||
/**
|
||||
* @dev Euler's Execution Module
|
||||
*/
|
||||
IEulerExecute internal constant eulerExec = IEulerExecute(0x59828FdF7ee634AaaD3f58B19fDBa3b03E2D9d80);
|
||||
IEulerExecute internal constant eulerExec =
|
||||
IEulerExecute(0x59828FdF7ee634AaaD3f58B19fDBa3b03E2D9d80);
|
||||
|
||||
/**
|
||||
* @dev Compute sub account address.
|
||||
|
@ -63,7 +63,9 @@ contract EulerHelpers is Basic {
|
|||
) internal view returns (ImportData memory) {
|
||||
data.supplyAmts = new uint256[](inputData._supplyTokens.length);
|
||||
data.supplyTokens = new address[](inputData._supplyTokens.length);
|
||||
data.eTokens = new EulerTokenInterface[](inputData._supplyTokens.length);
|
||||
data.eTokens = new EulerTokenInterface[](
|
||||
inputData._supplyTokens.length
|
||||
);
|
||||
uint256 length_ = inputData._supplyTokens.length;
|
||||
for (uint256 i = 0; i < length_; i++) {
|
||||
for (uint256 j = i + 1; j < length_; j++) {
|
||||
|
@ -78,7 +80,9 @@ contract EulerHelpers is Basic {
|
|||
? wethAddr
|
||||
: inputData._supplyTokens[i];
|
||||
data.supplyTokens[i] = _token;
|
||||
data.eTokens[i] = EulerTokenInterface(markets.underlyingToEToken(_token));
|
||||
data.eTokens[i] = EulerTokenInterface(
|
||||
markets.underlyingToEToken(_token)
|
||||
);
|
||||
data.supplyAmts[i] = data.eTokens[i].balanceOf(userAccount); //All 18 dec
|
||||
}
|
||||
|
||||
|
@ -90,7 +94,7 @@ contract EulerHelpers is Basic {
|
|||
ImportInputData memory inputData,
|
||||
ImportData memory data
|
||||
) internal view returns (ImportData memory) {
|
||||
uint _borrowTokensLength = inputData._borrowTokens.length;
|
||||
uint256 _borrowTokensLength = inputData._borrowTokens.length;
|
||||
|
||||
if (_borrowTokensLength > 0) {
|
||||
data.borrowTokens = new address[](_borrowTokensLength);
|
||||
|
@ -112,7 +116,9 @@ contract EulerHelpers is Basic {
|
|||
: inputData._borrowTokens[i];
|
||||
|
||||
data.borrowTokens[i] = _token;
|
||||
data.dTokens[i] = EulerTokenInterface(markets.underlyingToDToken(_token));
|
||||
data.dTokens[i] = EulerTokenInterface(
|
||||
markets.underlyingToDToken(_token)
|
||||
);
|
||||
data.borrowAmts[i] = data.dTokens[i].balanceOf(userAccount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ pragma solidity ^0.7.0;
|
|||
pragma experimental ABIEncoderV2;
|
||||
|
||||
interface EulerTokenInterface {
|
||||
|
||||
function balanceOf(address _user) external view returns (uint256);
|
||||
|
||||
function transferFrom(
|
||||
|
@ -37,7 +36,6 @@ interface IEulerMarkets {
|
|||
}
|
||||
|
||||
interface IEulerExecute {
|
||||
|
||||
struct EulerBatchItem {
|
||||
bool allowError;
|
||||
address proxyAddr;
|
||||
|
@ -49,7 +47,10 @@ interface IEulerExecute {
|
|||
bytes result;
|
||||
}
|
||||
|
||||
function batchDispatch(EulerBatchItem[] calldata items, address[] calldata deferLiquidityChecks) external;
|
||||
function batchDispatch(
|
||||
EulerBatchItem[] calldata items,
|
||||
address[] calldata deferLiquidityChecks
|
||||
) external;
|
||||
|
||||
function deferLiquidityCheck(address account, bytes memory data) external;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@ contract EulerImport is EulerHelpers {
|
|||
payable
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
require(sourceId < 256 && targetId < 256, "Id should be less than 256");
|
||||
|
||||
(_eventName, _eventParam) = _importEuler(
|
||||
userAccount,
|
||||
sourceId,
|
||||
|
@ -45,11 +47,7 @@ contract EulerImport is EulerHelpers {
|
|||
uint256 sourceId,
|
||||
uint256 targetId,
|
||||
ImportInputData memory inputData
|
||||
)
|
||||
internal
|
||||
returns (string memory _eventName, bytes memory _eventParam)
|
||||
{
|
||||
|
||||
) internal returns (string memory _eventName, bytes memory _eventParam) {
|
||||
require(inputData._supplyTokens.length > 0, "0-length-not-allowed");
|
||||
require(
|
||||
AccountInterface(address(this)).isAuth(userAccount),
|
||||
|
@ -78,11 +76,14 @@ contract EulerImport is EulerHelpers {
|
|||
|
||||
for (uint16 i = 0; i < inputData._enterMarket.length; i++) {
|
||||
if (inputData._enterMarket[i]) {
|
||||
++enterMarkets;
|
||||
++enterMarketsLength;
|
||||
}
|
||||
}
|
||||
|
||||
helper.totalExecutions = helper.supplylength + enterMarkets + helper.borrowlength;
|
||||
helper.totalExecutions =
|
||||
helper.supplylength +
|
||||
enterMarketsLength +
|
||||
helper.borrowlength;
|
||||
|
||||
IEulerExecute.EulerBatchItem[]
|
||||
memory items = new IEulerExecute.EulerBatchItem[](
|
||||
|
|
Loading…
Reference in New Issue
Block a user