mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
updated ieth call
This commit is contained in:
parent
72f989c9da
commit
2ee63f3058
|
@ -2,15 +2,12 @@
|
||||||
pragma solidity ^0.7.0;
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
interface IInstaLite {
|
interface IInstaLite {
|
||||||
function token() external view returns (address);
|
|
||||||
|
|
||||||
function importPosition(
|
function importPosition(
|
||||||
address flashTkn_,
|
address flashTkn_,
|
||||||
uint256 flashAmt_,
|
uint256 flashAmt_,
|
||||||
uint256 route_,
|
uint256 route_,
|
||||||
|
address to_,
|
||||||
uint256 stEthAmt_,
|
uint256 stEthAmt_,
|
||||||
uint256 wethAmt_,
|
uint256 wethAmt_
|
||||||
uint256 getId,
|
|
||||||
uint256 setId
|
|
||||||
) external;
|
) external;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,14 @@ import { TokenInterface } from "../../common/interfaces.sol";
|
||||||
import { Basic } from "../../common/basic.sol";
|
import { Basic } from "../../common/basic.sol";
|
||||||
import { Events } from "./events.sol";
|
import { Events } from "./events.sol";
|
||||||
import { IInstaLite } from "./interface.sol";
|
import { IInstaLite } from "./interface.sol";
|
||||||
import "@openzeppelin/contracts/utils/Address.sol";
|
|
||||||
|
|
||||||
abstract contract InstaLiteConnector is Events, Basic {
|
abstract contract InstaLiteConnector is Events, Basic {
|
||||||
TokenInterface internal constant astethToken =
|
TokenInterface internal constant astethToken =
|
||||||
TokenInterface(0x1982b2F5814301d4e9a8b0201555376e62F82428);
|
TokenInterface(0x1982b2F5814301d4e9a8b0201555376e62F82428);
|
||||||
TokenInterface internal constant stethToken =
|
TokenInterface internal constant stethToken =
|
||||||
TokenInterface(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
|
TokenInterface(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84);
|
||||||
address internal constant ethVaultAddr =
|
IInstaLite internal constant iEth =
|
||||||
0xc383a3833A87009fD9597F8184979AF5eDFad019;
|
IInstaLite(0xc383a3833A87009fD9597F8184979AF5eDFad019);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Supply ETH/ERC20
|
* @dev Supply ETH/ERC20
|
||||||
|
@ -27,7 +26,7 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
* @param flashAmt_ Flash loan amount.
|
* @param flashAmt_ Flash loan amount.
|
||||||
* @param route_ Flash loan route.
|
* @param route_ Flash loan route.
|
||||||
* @param stEthAmt_ Amount of astEthToken to be imported.
|
* @param stEthAmt_ Amount of astEthToken to be imported.
|
||||||
* @param wethAmt_ Amount of weth borrows to be imported.
|
* @param wethAmt_ Amount of weth borrows to be imported.
|
||||||
* @param getIds IDs to retrieve amt.
|
* @param getIds IDs to retrieve amt.
|
||||||
* @param setIds array of IDs to store the amount of tokens deposited.
|
* @param setIds array of IDs to store the amount of tokens deposited.
|
||||||
*/
|
*/
|
||||||
|
@ -46,10 +45,9 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
? astethToken.balanceOf(msg.sender)
|
? astethToken.balanceOf(msg.sender)
|
||||||
: stEthAmt_;
|
: stEthAmt_;
|
||||||
|
|
||||||
astethToken.approve(ethVaultAddr, stEthAmt_);
|
astethToken.approve(address(iEth), stEthAmt_);
|
||||||
|
|
||||||
bytes memory callData_ = abi.encodeWithSignature(
|
iEth.importPosition(
|
||||||
"importPosition(address,uint256,uint256,address,uint256,uint256)",
|
|
||||||
flashTkn_,
|
flashTkn_,
|
||||||
flashAmt_,
|
flashAmt_,
|
||||||
route_,
|
route_,
|
||||||
|
@ -58,17 +56,19 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
wethAmt_
|
wethAmt_
|
||||||
);
|
);
|
||||||
|
|
||||||
Address.functionDelegateCall(
|
|
||||||
address(ethVaultAddr),
|
|
||||||
callData_,
|
|
||||||
"import-failed"
|
|
||||||
);
|
|
||||||
|
|
||||||
setUint(setIds[0], stEthAmt_);
|
setUint(setIds[0], stEthAmt_);
|
||||||
setUint(setIds[1], wethAmt_);
|
setUint(setIds[1], wethAmt_);
|
||||||
|
|
||||||
eventName_ = "LogImport(address,uint256,uint256,uint256,uint256,uint256[],uint256[])";
|
eventName_ = "LogImport(address,uint256,uint256,uint256,uint256,uint256[],uint256[])";
|
||||||
eventParam_ = abi.encode(flashTkn_,flashAmt_,route_,stEthAmt_,wethAmt_,getIds,setIds);
|
eventParam_ = abi.encode(
|
||||||
|
flashTkn_,
|
||||||
|
flashAmt_,
|
||||||
|
route_,
|
||||||
|
stEthAmt_,
|
||||||
|
wethAmt_,
|
||||||
|
getIds,
|
||||||
|
setIds
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user