Skip to content

Commit 0340663

Browse files
committed
staking contract
1 parent d9fccdf commit 0340663

File tree

2 files changed

+187
-0
lines changed

2 files changed

+187
-0
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+
}
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
package com.arnAAVE.java_sdk.contractModels;
2+
3+
import java.math.BigInteger;
4+
import java.util.Arrays;
5+
import java.util.Collections;
6+
import org.web3j.abi.TypeReference;
7+
import org.web3j.abi.datatypes.Address;
8+
import org.web3j.abi.datatypes.Function;
9+
import org.web3j.abi.datatypes.Type;
10+
import org.web3j.crypto.Credentials;
11+
import org.web3j.protocol.Web3j;
12+
import org.web3j.protocol.core.RemoteCall;
13+
import org.web3j.protocol.core.RemoteFunctionCall;
14+
import org.web3j.protocol.core.methods.response.TransactionReceipt;
15+
import org.web3j.tx.Contract;
16+
import org.web3j.tx.TransactionManager;
17+
import org.web3j.tx.gas.ContractGasProvider;
18+
19+
/**
20+
* <p>Auto generated code.
21+
* <p><strong>Do not modify!</strong>
22+
* <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>,
23+
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the
24+
* <a href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
25+
*
26+
* <p>Generated with web3j version 4.8.7.
27+
*/
28+
@SuppressWarnings("rawtypes")
29+
public class IStakedToken extends Contract {
30+
public static final String BINARY = "";
31+
32+
public static final String FUNC_REWARD_TOKEN = "REWARD_TOKEN";
33+
34+
public static final String FUNC_STAKED_TOKEN = "STAKED_TOKEN";
35+
36+
public static final String FUNC_CLAIMREWARDS = "claimRewards";
37+
38+
public static final String FUNC_COOLDOWN = "cooldown";
39+
40+
public static final String FUNC_REDEEM = "redeem";
41+
42+
public static final String FUNC_STAKE = "stake";
43+
44+
@Deprecated
45+
protected IStakedToken(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
46+
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
47+
}
48+
49+
public IStakedToken(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
50+
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
51+
}
52+
53+
@Deprecated
54+
protected IStakedToken(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
55+
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
56+
}
57+
58+
protected IStakedToken(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
59+
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
60+
}
61+
62+
public RemoteFunctionCall<String> REWARD_TOKEN() {
63+
final Function function = new Function(FUNC_REWARD_TOKEN,
64+
Arrays.<Type>asList(),
65+
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
66+
return executeRemoteCallSingleValueReturn(function, String.class);
67+
}
68+
69+
public RemoteFunctionCall<String> STAKED_TOKEN() {
70+
final Function function = new Function(FUNC_STAKED_TOKEN,
71+
Arrays.<Type>asList(),
72+
Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
73+
return executeRemoteCallSingleValueReturn(function, String.class);
74+
}
75+
76+
public RemoteFunctionCall<TransactionReceipt> claimRewards(String to, BigInteger amount) {
77+
final Function function = new Function(
78+
FUNC_CLAIMREWARDS,
79+
Arrays.<Type>asList(new Address(160, to),
80+
new org.web3j.abi.datatypes.generated.Uint256(amount)),
81+
Collections.<TypeReference<?>>emptyList());
82+
return executeRemoteCallTransaction(function);
83+
}
84+
85+
public RemoteFunctionCall<TransactionReceipt> cooldown() {
86+
final Function function = new Function(
87+
FUNC_COOLDOWN,
88+
Arrays.<Type>asList(),
89+
Collections.<TypeReference<?>>emptyList());
90+
return executeRemoteCallTransaction(function);
91+
}
92+
93+
public RemoteFunctionCall<TransactionReceipt> redeem(String to, BigInteger amount) {
94+
final Function function = new Function(
95+
FUNC_REDEEM,
96+
Arrays.<Type>asList(new Address(160, to),
97+
new org.web3j.abi.datatypes.generated.Uint256(amount)),
98+
Collections.<TypeReference<?>>emptyList());
99+
return executeRemoteCallTransaction(function);
100+
}
101+
102+
public RemoteFunctionCall<TransactionReceipt> stake(String onBehalfOf, BigInteger amount) {
103+
final Function function = new Function(
104+
FUNC_STAKE,
105+
Arrays.<Type>asList(new Address(160, onBehalfOf),
106+
new org.web3j.abi.datatypes.generated.Uint256(amount)),
107+
Collections.<TypeReference<?>>emptyList());
108+
return executeRemoteCallTransaction(function);
109+
}
110+
111+
@Deprecated
112+
public static IStakedToken load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
113+
return new IStakedToken(contractAddress, web3j, credentials, gasPrice, gasLimit);
114+
}
115+
116+
@Deprecated
117+
public static IStakedToken load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
118+
return new IStakedToken(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
119+
}
120+
121+
public static IStakedToken load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
122+
return new IStakedToken(contractAddress, web3j, credentials, contractGasProvider);
123+
}
124+
125+
public static IStakedToken load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
126+
return new IStakedToken(contractAddress, web3j, transactionManager, contractGasProvider);
127+
}
128+
129+
public static RemoteCall<IStakedToken> deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
130+
return deployRemoteCall(IStakedToken.class, web3j, credentials, contractGasProvider, BINARY, "");
131+
}
132+
133+
@Deprecated
134+
public static RemoteCall<IStakedToken> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
135+
return deployRemoteCall(IStakedToken.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
136+
}
137+
138+
public static RemoteCall<IStakedToken> deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
139+
return deployRemoteCall(IStakedToken.class, web3j, transactionManager, contractGasProvider, BINARY, "");
140+
}
141+
142+
@Deprecated
143+
public static RemoteCall<IStakedToken> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
144+
return deployRemoteCall(IStakedToken.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
145+
}
146+
}

0 commit comments

Comments
 (0)