mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
new liquidity changes
This commit is contained in:
parent
a782d0d9c9
commit
f7432174a0
|
@ -28,8 +28,8 @@ interface ComptrollerInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PoolInterface {
|
interface PoolInterface {
|
||||||
function accessToken(uint useLiqFrom, address[] calldata ctknAddr, uint[] calldata tknAmt) external;
|
function accessToken(address[] calldata ctknAddr, uint[] calldata tknAmt, bool isCompound) external;
|
||||||
function paybackToken(uint useLiqFrom, address[] calldata ctknAddr) external payable;
|
function paybackToken(address[] calldata ctknAddr, bool isCompound) external payable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,9 +113,9 @@ contract Helpers is DSMath {
|
||||||
|
|
||||||
|
|
||||||
contract ImportResolver is Helpers {
|
contract ImportResolver is Helpers {
|
||||||
event LogCompoundImport(address owner, uint percentage, uint usedAssetsFrom, address[] markets, address[] borrowAddr, uint[] borrowAmt);
|
event LogCompoundImport(address owner, uint percentage, bool isCompound, address[] markets, address[] borrowAddr, uint[] borrowAmt);
|
||||||
|
|
||||||
function importAssets(uint toConvert, uint getLiqFrom) external {
|
function importAssets(uint toConvert, bool isCompound) external {
|
||||||
uint initialBal = sub(liquidityAddr.balance, 10000000000);
|
uint initialBal = sub(liquidityAddr.balance, 10000000000);
|
||||||
address[] memory markets = enteredMarkets();
|
address[] memory markets = enteredMarkets();
|
||||||
address[] memory borrowAddr;
|
address[] memory borrowAddr;
|
||||||
|
@ -133,7 +133,7 @@ contract ImportResolver is Helpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get liquidity assets to payback user wallet borrowed assets
|
// Get liquidity assets to payback user wallet borrowed assets
|
||||||
PoolInterface(liquidityAddr).accessToken(getLiqFrom, borrowAddr, borrowAmt);
|
PoolInterface(liquidityAddr).accessToken(borrowAddr, borrowAmt, isCompound);
|
||||||
|
|
||||||
// payback user wallet borrowed assets
|
// payback user wallet borrowed assets
|
||||||
for (uint i = 0; i < borrowAddr.length; i++) {
|
for (uint i = 0; i < borrowAddr.length; i++) {
|
||||||
|
@ -176,13 +176,13 @@ contract ImportResolver is Helpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
//payback InstaDApp liquidity
|
//payback InstaDApp liquidity
|
||||||
PoolInterface(liquidityAddr).paybackToken(getLiqFrom, borrowAddr);
|
PoolInterface(liquidityAddr).paybackToken(borrowAddr, isCompound);
|
||||||
assert(liquidityAddr.balance >= initialBal);
|
assert(liquidityAddr.balance >= initialBal);
|
||||||
|
|
||||||
emit LogCompoundImport(
|
emit LogCompoundImport(
|
||||||
msg.sender,
|
msg.sender,
|
||||||
toConvert,
|
toConvert,
|
||||||
getLiqFrom,
|
isCompound,
|
||||||
markets,
|
markets,
|
||||||
borrowAddr,
|
borrowAddr,
|
||||||
borrowAmt
|
borrowAmt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user