mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
fixed compilation errors
This commit is contained in:
parent
7a61470919
commit
27d3d9e47a
|
@ -147,18 +147,18 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Deleverage and Withdraw vault. Pays back weth debt and get stETH/WETH collateral.
|
* @dev Deleverage and Withdraw vault. Pays back weth debt and gets steth collateral (aSteth).
|
||||||
* @notice Deleverage Instalite vault.
|
* @notice Deleverage Instalite vault.
|
||||||
* @param vaultAddr Address of vaultAddress Contract.
|
* @param vaultAddr Address of vaultAddress Contract.
|
||||||
* @param deleverageAmount The amount of the token to deleverage.
|
* @param deleverageAmt The amount of the weth to deleverage.
|
||||||
* @param withdrawAmount The amount of the token to withdraw.
|
* @param withdrawAmt The amount of the token to withdraw.
|
||||||
* @param getIds ID to retrieve amt.
|
* @param getIds IDs to retrieve amts.
|
||||||
* @param setIds ID to set amt.
|
* @param setIds IDs to set amts.
|
||||||
*/
|
*/
|
||||||
function deleverageAndWithdraw(
|
function deleverageAndWithdraw(
|
||||||
address vaultAddr,
|
address vaultAddr,
|
||||||
uint256 deleverageAmount,
|
uint256 deleverageAmt,
|
||||||
uint256 withdrawAmount,
|
uint256 withdrawAmt,
|
||||||
uint256[] memory getIds,
|
uint256[] memory getIds,
|
||||||
uint256[] memory setIds
|
uint256[] memory setIds
|
||||||
)
|
)
|
||||||
|
@ -166,24 +166,25 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
payable
|
payable
|
||||||
returns (string memory _eventName, bytes memory _eventParam)
|
returns (string memory _eventName, bytes memory _eventParam)
|
||||||
{
|
{
|
||||||
require(getIds.length >= 2, "invalid get-ids length");
|
if (getIds.length >= 2) {
|
||||||
uint256 _deleverageAmt = getUint(getIds[0], deleverageAmount);
|
deleverageAmt = getUint(getIds[0], deleverageAmt);
|
||||||
uint256 _withdrawAmount = getUint(getIds[1], withdrawAmount);
|
withdrawAmt = getUint(getIds[1], withdrawAmt);
|
||||||
|
}
|
||||||
|
|
||||||
uint256 _astethAmt;
|
uint256 _astethAmt;
|
||||||
uint256 _ethAmt;
|
uint256 _ethAmt;
|
||||||
uint256 _stethAmt;
|
uint256 _stethAmt;
|
||||||
uint256 _tokenAmt;
|
uint256 _tokenAmt;
|
||||||
|
|
||||||
approve(TokenInterface(wethAddr), vaultAddr, _deleverageAmt);
|
approve(TokenInterface(wethAddr), vaultAddr, deleverageAmt);
|
||||||
if (vaultAddr == ethVaultAddr) {
|
if (vaultAddr == ethVaultAddr) {
|
||||||
uint256 initialBalAsteth = astethToken.balanceOf(address(this));
|
uint256 initialBalAsteth = astethToken.balanceOf(address(this));
|
||||||
uint256 initialBalEth = address(this).balance;
|
uint256 initialBalEth = address(this).balance;
|
||||||
uint256 initialBalSteth = stethToken.balanceOf(address(this));
|
uint256 initialBalSteth = stethToken.balanceOf(address(this));
|
||||||
|
|
||||||
IInstaLite(vaultAddr).deleverageAndWithdraw(
|
IInstaLite(vaultAddr).deleverageAndWithdraw(
|
||||||
_deleverageAmt,
|
deleverageAmt,
|
||||||
_withdrawAmount,
|
withdrawAmt,
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -192,7 +193,7 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
initialBalAsteth;
|
initialBalAsteth;
|
||||||
_ethAmt = address(this).balance - initialBalEth;
|
_ethAmt = address(this).balance - initialBalEth;
|
||||||
_stethAmt = stethToken.balanceOf(address(this)) - initialBalSteth;
|
_stethAmt = stethToken.balanceOf(address(this)) - initialBalSteth;
|
||||||
require(_deleverageAmt <= (1e9 + _astethAmt), "lack-of-steth");
|
require(deleverageAmt <= (1e9 + _astethAmt), "lack-of-steth");
|
||||||
|
|
||||||
if (setIds.length >= 3) {
|
if (setIds.length >= 3) {
|
||||||
setUint(setIds[0], _astethAmt);
|
setUint(setIds[0], _astethAmt);
|
||||||
|
@ -208,8 +209,8 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
uint256 initialBalToken = tokenContract.balanceOf(address(this));
|
uint256 initialBalToken = tokenContract.balanceOf(address(this));
|
||||||
|
|
||||||
IInstaLite(vaultAddr).deleverageAndWithdraw(
|
IInstaLite(vaultAddr).deleverageAndWithdraw(
|
||||||
_deleverageAmt,
|
deleverageAmt,
|
||||||
_withdrawAmount,
|
withdrawAmt,
|
||||||
address(this)
|
address(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
_tokenAmt =
|
_tokenAmt =
|
||||||
tokenContract.balanceOf(address(this)) -
|
tokenContract.balanceOf(address(this)) -
|
||||||
initialBalToken;
|
initialBalToken;
|
||||||
require(_deleverageAmt <= (1e9 + _astethAmt), "lack-of-steth");
|
require(deleverageAmt <= (1e9 + _astethAmt), "lack-of-steth");
|
||||||
|
|
||||||
if (setIds.length >= 2) {
|
if (setIds.length >= 2) {
|
||||||
setUint(setIds[0], _astethAmt);
|
setUint(setIds[0], _astethAmt);
|
||||||
|
@ -230,8 +231,8 @@ abstract contract InstaLiteConnector is Events, Basic {
|
||||||
_eventName = "LogDeleverageAndWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[])";
|
_eventName = "LogDeleverageAndWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256[],uint256[])";
|
||||||
_eventParam = abi.encode(
|
_eventParam = abi.encode(
|
||||||
vaultAddr,
|
vaultAddr,
|
||||||
_deleverageAmt,
|
deleverageAmt,
|
||||||
_withdrawAmount,
|
withdrawAmt,
|
||||||
_astethAmt,
|
_astethAmt,
|
||||||
_ethAmt,
|
_ethAmt,
|
||||||
_stethAmt,
|
_stethAmt,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user