Skip to content

Commit 0abecd3

Browse files
authored
Merge branch 'master' into ehi_v3_try
2 parents d05ac79 + d57ffd5 commit 0abecd3

File tree

5 files changed

+100
-2
lines changed

5 files changed

+100
-2
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.arnAAVE.java_sdk.Staking;
2+
3+
import com.arnAAVE.java_sdk.contractModels.IStakedToken;
4+
import org.web3j.crypto.Credentials;
5+
import org.web3j.protocol.Web3j;
6+
import org.web3j.protocol.core.RemoteFunctionCall;
7+
import org.web3j.protocol.core.methods.response.TransactionReceipt;
8+
import org.web3j.protocol.http.HttpService;
9+
import org.web3j.tx.gas.ContractGasProvider;
10+
import org.web3j.tx.gas.StaticGasProvider;
11+
12+
import java.math.BigInteger;
13+
14+
public class StakingAccess {
15+
16+
private static final Web3j web3j = Web3j.build(new HttpService(
17+
"https://goerli.infura.io/v3/b8c7cedb8701445bb9210f4731e42c0a"));
18+
private static final Credentials credentials = Credentials.create("1238370fb9507a697d2744d9c511061a0c3cc284eba1af1fa7b24854a9084219");
19+
20+
private ContractGasProvider provider = new StaticGasProvider(new BigInteger("2000000"), new BigInteger("2000000"));
21+
22+
private IStakedToken iStakedToken = new IStakedToken("", web3j, credentials, provider);
23+
24+
25+
public RemoteFunctionCall<String> staked_token(){
26+
return iStakedToken.STAKED_TOKEN();
27+
}
28+
29+
public RemoteFunctionCall<TransactionReceipt> claimRewards(String to, BigInteger amount ){
30+
return iStakedToken.claimRewards(to, amount);
31+
}
32+
33+
public RemoteFunctionCall<TransactionReceipt> stake(String onBehafOf, BigInteger amount) {
34+
return iStakedToken.stake(onBehafOf,amount);
35+
}
36+
37+
public RemoteFunctionCall<TransactionReceipt> redeem(String to, BigInteger amount){
38+
return iStakedToken.redeem(to, amount);
39+
}
40+
41+
}

src/main/java/com/arnAAVE/java_sdk/contractModels/IStakedToken.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected IStakedToken(String contractAddress, Web3j web3j, Credentials credenti
4646
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
4747
}
4848

49-
protected IStakedToken(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
49+
public IStakedToken(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
5050
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
5151
}
5252

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,4 @@ TransactionReceipt swapBorrowRate(String assetAddress, String mode) throws Excep
7474
return lendingPool.swapBorrowRateMode(assetAddress,value).send();
7575
}
7676

77-
7877
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.arnAAVE.java_sdk.Staking;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
import org.junit.jupiter.api.BeforeEach;
5+
import org.junit.jupiter.api.Test;
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.boot.test.context.SpringBootTest;
8+
import org.web3j.protocol.core.RemoteFunctionCall;
9+
import org.web3j.protocol.core.methods.response.TransactionReceipt;
10+
11+
import java.math.BigInteger;
12+
13+
import static org.junit.jupiter.api.Assertions.*;
14+
15+
@SpringBootTest
16+
@Slf4j
17+
class StakingAccessTest {
18+
19+
@Autowired
20+
StakingAccess stakingAccess;
21+
22+
@BeforeEach
23+
void setUp() {
24+
}
25+
26+
@Test
27+
void claimRewards() {
28+
RemoteFunctionCall<TransactionReceipt> receipt = stakingAccess.claimRewards("0x16b72adab628d8762a25f707acbfe9c170d9001d", new BigInteger("2000000"));
29+
log.info("receipt: " + receipt);
30+
}
31+
32+
@Test
33+
void stake() {
34+
RemoteFunctionCall<TransactionReceipt> receipt = stakingAccess.stake("0x16b215977114756b17f8c1a7b989d6061a1cae8e", new BigInteger("2000000"));
35+
log.info("receipt: " + receipt);
36+
}
37+
38+
@Test
39+
void redeem() {
40+
RemoteFunctionCall<TransactionReceipt> receipt = stakingAccess.redeem("0x16b215977114756b17f8c1a7b989d6061a1cae8e", new BigInteger("2000000"));
41+
log.info("receipt: " + receipt);
42+
}
43+
}

src/test/java/com/arnAAVE/java_sdk/lendingPool/LendingPoolTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,19 @@ void loadReservedData() {
164164
e.printStackTrace();
165165
}
166166
}
167+
168+
@Test
169+
void setUsageAsCollateral(){
170+
171+
}
172+
173+
@Test
174+
void liquidationCall(){
175+
176+
}
177+
178+
@Test
179+
void flashloans(){
180+
181+
}
167182
}

0 commit comments

Comments
 (0)