Class EvmBlockchainService
java.lang.Object
io.meeds.evm.gamification.service.EvmBlockchainService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondetectTokenType(String blockchainNetwork, String contractAddress) Get the Token type from the contract addressprotected EvmBlockchainService.EventValuesWithLogextractEventParametersWithLog(org.web3j.abi.datatypes.Event event, org.web3j.protocol.core.methods.response.Log log) protected List<EvmBlockchainService.EventValuesWithLog> extractEventParametersWithLog(org.web3j.abi.datatypes.Event event, org.web3j.protocol.core.methods.response.TransactionReceipt transactionReceipt) getEvmTransactions(long fromBlock, long toBlock, String contractAddress, String blockchainNetwork, org.web3j.abi.datatypes.Event event) get the list of ERC20 Token transfer transactionslonggetLastBlock(String blockchainNetwork) getTokenDetails(String contractAddress, String blockchainNetwork) Retrieves the Token details from its contract addressgetTransactionTransferEvents(org.web3j.protocol.core.methods.response.TransactionReceipt transactionReceipt, String contractAddress, org.web3j.abi.datatypes.Event event) booleanisBalanceEnough(String contractAddress, String blockchainNetwork, String walletAddress, io.meeds.gamification.model.RuleDTO rule, List<EvmTransaction> transactions) booleanCheck if the Token is an ERC-1155 or notbooleanCheck if the Token is an ERC-721 or notvoidsaveTokenTransactions(long fromBlock, long toBlock, String contractAddress, String blockchainNetwork, long networkId) saves the list of ERC20 Token transfer transactions starting from a block to anotherprotected static EvmBlockchainService.EventValuesWithLogstaticExtractEventParametersWithLog(org.web3j.abi.datatypes.Event event, org.web3j.protocol.core.methods.response.Log log)
-
Constructor Details
-
EvmBlockchainService
public EvmBlockchainService()
-
-
Method Details
-
saveTokenTransactions
public void saveTokenTransactions(long fromBlock, long toBlock, String contractAddress, String blockchainNetwork, long networkId) saves the list of ERC20 Token transfer transactions starting from a block to another- Parameters:
fromBlock- Start blocktoBlock- End Block to filtercontractAddress- The ERC20 token contract addressblockchainNetwork- The url of used providernetworkId- Network id
-
getEvmTransactions
public List<EvmTransaction> getEvmTransactions(long fromBlock, long toBlock, String contractAddress, String blockchainNetwork, org.web3j.abi.datatypes.Event event) get the list of ERC20 Token transfer transactions- Parameters:
fromBlock- Start blocktoBlock- End Block to filtercontractAddress- The ERC20 token contract addressblockchainNetwork- The url of used provider
-
getTokenDetails
Retrieves the Token details from its contract address- Parameters:
contractAddress- the token contract address- Returns:
- token details
-
detectTokenType
Get the Token type from the contract address- Parameters:
blockchainNetwork- The url of used providercontractAddress- the token contract address- Returns:
- token type
-
isERC1155
Check if the Token is an ERC-1155 or not- Parameters:
blockchainNetwork- The url of used providercontractAddress- the token contract address- Returns:
- true if an ERC-1155
-
isERC721
Check if the Token is an ERC-721 or not- Parameters:
blockchainNetwork- The url of used providercontractAddress- the token contract address- Returns:
- true if an ERC-721
-
getLastBlock
- Returns:
- last block number
-
balanceOf
public BigInteger balanceOf(String contractAddress, String blockchainNetwork, Map<String, String> functionParams) - Parameters:
contractAddress- Address to get its token balanceblockchainNetwork- Used provider urlfunctionParams- Function parameters- Returns:
BigIntegerrepresenting the balance of address of token which is retrieved from the used blockchain.
-
isBalanceEnough
public boolean isBalanceEnough(String contractAddress, String blockchainNetwork, String walletAddress, io.meeds.gamification.model.RuleDTO rule, List<EvmTransaction> transactions) -
getTransactionTransferEvents
public List<EvmBlockchainService.TransferEventResponse> getTransactionTransferEvents(org.web3j.protocol.core.methods.response.TransactionReceipt transactionReceipt, String contractAddress, org.web3j.abi.datatypes.Event event) -
extractEventParametersWithLog
protected List<EvmBlockchainService.EventValuesWithLog> extractEventParametersWithLog(org.web3j.abi.datatypes.Event event, org.web3j.protocol.core.methods.response.TransactionReceipt transactionReceipt) -
extractEventParametersWithLog
protected EvmBlockchainService.EventValuesWithLog extractEventParametersWithLog(org.web3j.abi.datatypes.Event event, org.web3j.protocol.core.methods.response.Log log) -
staticExtractEventParametersWithLog
protected static EvmBlockchainService.EventValuesWithLog staticExtractEventParametersWithLog(org.web3j.abi.datatypes.Event event, org.web3j.protocol.core.methods.response.Log log)
-