Skip to content

Commit 85ace0d

Browse files
authored
Merge pull request #6 from alienrobotninja/ise-lendingpool
read me update
2 parents da02a05 + 24d5a46 commit 85ace0d

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ just get a testnet address from infura and you are good to go.
3737
* wrapper classes have been created using the v2 .sol contracts.
3838
* attempting to deposit on lending pool.
3939
* we require an approve method for deposit to go through still finding away around that.
40-
###lending pool contract
40+
###lending pool contract
4141
* deposit(``String reserve``,``BigInteger amount``,``String onBehalfOf``,``BigInteger referralCode``)
4242

4343

src/main/java/com/arnAAVE/java_sdk/lendingPool/LendingPool.java

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,37 @@ TransactionReceipt repay(String amount, String assetAddress, String onBehalfOf)
6767

6868
return lendingPool.repay(assetAddress,value,BigInteger.ONE,onBehalfOf).send();
6969
}
70+
71+
TransactionReceipt swapBorrowRate(String amount, String assetAddress, String onBehalfOf) throws Exception {
72+
String poolAddress = lendingPoolAddress.getLendingPool().send();
73+
BigInteger value = new BigInteger(amount);
74+
75+
ILendingPool lendingPool = ILendingPool.load(poolAddress,connection.getWeb3j(),connection.getCredentials(),provider);
76+
return lendingPool.swapBorrowRateMode(assetAddress,BigInteger.ONE).send();
77+
}
7078

71-
TransactionReceipt swapBorrowRate(String assetAddress, String mode) throws Exception {
72-
BigInteger value = new BigInteger(mode);
79+
public TransactionReceipt setUsageAsCollateral(String asset, Boolean useAsCollateral) throws Exception {
80+
String poolAddress = lendingPoolAddress.getLendingPool().send();
81+
BigInteger value = new BigInteger(asset);
82+
83+
ILendingPool lendingPool = ILendingPool.load(poolAddress,connection.getWeb3j(),connection.getCredentials(),provider);
84+
return lendingPool.setUserUseReserveAsCollateral(asset, useAsCollateral).send();
85+
}
86+
87+
public TransactionReceipt liquidationCall(String collateralAsset, String debtAsset, String user, String debtToCover, Boolean receiveAToken) throws Exception {
88+
String poolAddress = lendingPoolAddress.getLendingPool().send();
89+
BigInteger value = new BigInteger(debtToCover);
90+
91+
ILendingPool lendingPool = ILendingPool.load(poolAddress,connection.getWeb3j(),connection.getCredentials(),provider);
92+
return lendingPool.liquidationCall(collateralAsset,debtAsset,user,value,receiveAToken).send();
93+
}
94+
95+
public RemoteFunctionCall<TransactionReceipt> flashLoans(String receiverAddress, List<String> assets, List<BigInteger> amounts, List<BigInteger> modes, String onBehalfOf, byte[] params, BigInteger referralCode) throws Exception {
96+
String poolAddress = lendingPoolAddress.getLendingPool().send();
97+
BigInteger value = new BigInteger(String.valueOf(amounts));
7398

74-
return lendingPool.swapBorrowRateMode(assetAddress,value).send();
99+
ILendingPool lendingPool = ILendingPool.load(poolAddress, connection.getWeb3j(), connection.getCredentials(), provider);
100+
return lendingPool.flashLoan(receiverAddress, assets,amounts, modes,onBehalfOf,params, referralCode);
75101
}
76102

77103
}

0 commit comments

Comments
 (0)