Package io.meeds.deeds.common.service
Class BlockchainService
java.lang.Object
io.meeds.deeds.common.service.BlockchainService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidautoConnectToWom(long deedId, short city, short cardType, short mintingPower, long maxUsers, String ownerAddress, String managerAddress, String hubAddress, short ownerMintingPercentage) shortgetDeedCardType(long nftId) Retrieves from Blockchain DEED card type: - 0 : Common - 1 : Uncommon - 2 : Rare - 3 : LegendaryshortgetDeedCityIndex(long nftId) Retrieves from Blockchain DEED city index: - 0 : Tanit - 1 : Reshef - 2 : Ashtarte - 3 : Melqart - 4 : Eshmun - 5 : Kushor - 6 : HammongetDeedManager(long deedId) getDeedOwner(long deedId) getDeedsOwnedBy(String managerAddress) getFundInfo(String address) getHubByDeedId(long nftId) getHubOwner(String address) longgetLeaseById(BigInteger leaseId, BigInteger blockNumber, String transactionHash) getLeaseTransactionEvents(String transactionHash) getMinedHubConnectionTransactions(long fromBlock, long toBlock) getMinedProvisioningTransactions(long fromBlock, long toBlock) Retrieves the list of mined provisioning transactions starting from a block to anothergetMinedRentingTransactions(long fromBlock, long toBlock) Retrieves Lease and Offer Events occurred on Renting ContractgetMinedTransferOwnershipDeedTransactions(long fromBlock, long toBlock) Retrieves the list of mined ownership transfer of a Deed transactions starting from a block to anotherList<? extends org.web3j.protocol.core.methods.response.BaseEventResponse>getMinedUemLogs(long fromBlock, long toBlock) longgetOfferById(BigInteger offerId, BigInteger blockNumber, String transactionHash) getOfferTransactionEvents(String transactionHash) doublegetPendingRewards(String address) longlongdoublegetWomDeed(long nftId) booleanisDeedOwner(String address, long nftId) Retrieves from blockchain whether an address is the owner of the deedbooleanisDeedProvisioningManager(String address, long nftId) Retrieves from blockchain whether an address is the provisioning manager of the deed or notbooleanisDeedStarted(long nftId) Return DEED Tenant Status from Blockchain ContractbooleanisHubConnected(String address) booleanisOfferEnabled(long offerId) booleanisPolygonTransactionConfirmed(String transactionHash) booleanisPolygonTransactionMined(String transactionHash) booleanisReportFraud(long reportId) booleanisTransactionConfirmed(String transactionHash) booleanisTransactionMined(String transactionHash) Checks if transaction has been mined or notmeedBalanceOf(String address) meedBalanceOfNoDecimals(String address) meedBalanceOfOnPolygon(String address) pendingRewardBalanceOf(String address) io.meeds.wom.api.model.HubReportretrieveReportProperties(long reportId) voidretrieveReportProperties(io.meeds.wom.api.model.HubReport report) voidretrieveRewardProperties(io.meeds.wom.api.model.UemReward reward) voidupdateWomDeed(long deedId, short city, short cardType, short mintingPower, long maxUsers, String ownerAddress, String managerAddress, short ownerMintingPercentage)
-
Constructor Details
-
BlockchainService
public BlockchainService()
-
-
Method Details
-
isDeedStarted
public boolean isDeedStarted(long nftId) Return DEED Tenant Status from Blockchain Contract- Parameters:
nftId- Deed NFT identifier- Returns:
- if marked as started else false
-
isTransactionMined
Checks if transaction has been mined or not- Parameters:
transactionHash- Blockchain Transaction Hash- Returns:
- true if Transaction is Mined
-
isTransactionConfirmed
- Parameters:
transactionHash- Blockchain Transaction Hash- Returns:
- true if Transaction is Successful
-
isPolygonTransactionMined
-
isPolygonTransactionConfirmed
- Parameters:
transactionHash- Blockchain Transaction Hash- Returns:
- true if Transaction is Successful
-
getLastBlock
public long getLastBlock()- Returns:
- last mined block number
-
getPolygonLastBlock
public long getPolygonLastBlock()- Returns:
- last mined block number on Polygon Blockchain
-
getDeedManager
-
getMinedProvisioningTransactions
Retrieves the list of mined provisioning transactions starting from a block to another- Parameters:
fromBlock- Start blocktoBlock- End Block to filter- Returns:
ListofDeedTenant
-
getMinedUemLogs
public List<? extends org.web3j.protocol.core.methods.response.BaseEventResponse> getMinedUemLogs(long fromBlock, long toBlock) -
getMinedHubConnectionTransactions
-
getMinedRentingTransactions
Retrieves Lease and Offer Events occurred on Renting Contract -
getDeedOwner
-
getMinedTransferOwnershipDeedTransactions
public Set<CommonConstants.DeedOwnershipTransferEvent> getMinedTransferOwnershipDeedTransactions(long fromBlock, long toBlock) Retrieves the list of mined ownership transfer of a Deed transactions starting from a block to another- Parameters:
fromBlock- Start blocktoBlock- End Block to filter- Returns:
Setof NFT ID of typeCommonConstants.DeedOwnershipTransferEvent
-
getOfferTransactionEvents
public Map<BlockchainOfferStatus,DeedOfferBlockchainState> getOfferTransactionEvents(String transactionHash) -
getLeaseTransactionEvents
public Map<BlockchainLeaseStatus,DeedLeaseBlockchainState> getLeaseTransactionEvents(String transactionHash) -
getOfferById
public DeedOfferBlockchainState getOfferById(BigInteger offerId, BigInteger blockNumber, String transactionHash) throws Exception - Throws:
Exception
-
getLeaseById
public DeedLeaseBlockchainState getLeaseById(BigInteger leaseId, BigInteger blockNumber, String transactionHash) throws Exception - Throws:
Exception
-
isDeedProvisioningManager
Retrieves from blockchain whether an address is the provisioning manager of the deed or not- Parameters:
address- Ethereum address to checknftId- Deed NFT identifier- Returns:
- true if is manager else false
-
getPendingRewards
-
isDeedOwner
Retrieves from blockchain whether an address is the owner of the deed- Parameters:
address- Ethereum address to checknftId- Deed NFT identifier- Returns:
- true if is owner else false
-
getDeedCardType
public short getDeedCardType(long nftId) throws io.meeds.wom.api.constant.ObjectNotFoundException Retrieves from Blockchain DEED card type: - 0 : Common - 1 : Uncommon - 2 : Rare - 3 : Legendary- Parameters:
nftId- Deed NFT identifier- Returns:
- card type index
- Throws:
io.meeds.wom.api.constant.ObjectNotFoundException- when NFT with selected identifier doesn't exists
-
getDeedsOwnedBy
-
isOfferEnabled
- Throws:
Exception
-
getDeedCityIndex
public short getDeedCityIndex(long nftId) throws io.meeds.wom.api.constant.ObjectNotFoundException Retrieves from Blockchain DEED city index: - 0 : Tanit - 1 : Reshef - 2 : Ashtarte - 3 : Melqart - 4 : Eshmun - 5 : Kushor - 6 : Hammon- Parameters:
nftId- Deed NFT identifier- Returns:
- card city index
- Throws:
io.meeds.wom.api.constant.ObjectNotFoundException- when NFT with selected identifier doesn't exists
-
meedsTotalSupplyNoDecimals
- Returns:
BigDecimalrepresenting the total supply of Meeds Token which is retrieved from ethereum blockchain. The retrieved value is divided by number of decimals of the token (10^18)
-
meedsTotalSupply
- Returns:
BigIntegerrepresenting the total supply of Meeds Token which is retrieved from ethereum blockchain.
-
xMeedsTotalSupply
- Returns:
BigIntegerrepresenting the total supply of xMeeds Token which is retrieved from ethereum blockchain.
-
sushiPairTotalSupply
- Returns:
BigIntegerrepresenting the total supply of xMeeds Token which is retrieved from ethereum blockchain.
-
getFundInfo
- Parameters:
address- Fund Address to get its rewarding information- Returns:
FundInfowith rewarding parameters retrieved from Token Factory
-
getCurrentCity
- Returns:
DeedCityrepresenting current minting city
-
getXMeedFundInfo
- Returns:
FundInfoof xMeed Token with rewarding parameters retrieved from Token Factory
-
getSushiPairFundInfo
- Returns:
FundInfoof Sushi Pair Token with rewarding parameters retrieved from Token Factory
-
getHubOwner
-
getHubByDeedId
-
getWomDeed
-
autoConnectToWom
public void autoConnectToWom(long deedId, short city, short cardType, short mintingPower, long maxUsers, String ownerAddress, String managerAddress, String hubAddress, short ownerMintingPercentage) throws io.meeds.wom.api.constant.WomException - Throws:
io.meeds.wom.api.constant.WomException
-
updateWomDeed
public void updateWomDeed(long deedId, short city, short cardType, short mintingPower, long maxUsers, String ownerAddress, String managerAddress, short ownerMintingPercentage) throws io.meeds.wom.api.constant.WomException - Throws:
io.meeds.wom.api.constant.WomException
-
getHub
-
getUemPeriodicRewardAmount
public double getUemPeriodicRewardAmount() -
retrieveRewardProperties
public void retrieveRewardProperties(io.meeds.wom.api.model.UemReward reward) -
retrieveReportProperties
public io.meeds.wom.api.model.HubReport retrieveReportProperties(long reportId) -
retrieveReportProperties
public void retrieveReportProperties(io.meeds.wom.api.model.HubReport report) -
isReportFraud
public boolean isReportFraud(long reportId) -
isHubConnected
-
getEthereumMeedTokenAddress
-
getPolygonMeedTokenAddress
-
getUemAddress
-
getWomAddress
-
pendingRewardBalanceOf
- Parameters:
address- Address to get its pending rewardings not minted yet- Returns:
BigIntegerfor Meed Token value with decimals
-
totalAllocationPoints
- Returns:
BigIntegerfor total allocation points configured in token Factory
-
totalFixedPercentage
- Returns:
BigIntegerfor total fixed percentages configured in token Factory
-
meedBalanceOfNoDecimals
- Parameters:
address- Ethereum address- Returns:
BigDecimalrepresenting the balance of address which is retrieved from ethereum blockchain. The retrieved value is divided by number of decimals of the token (10^18)
-
meedBalanceOf
- Parameters:
address- Ethereum address- Returns:
BigIntegerrepresenting the balance of address which is retrieved from ethereum blockchain.
-
sushiPairSymbol
- Returns:
- Sushi Swap Pair token symbol
-
stakedSushiPair
- Returns:
- total staked SLP amount in TokenFactory
-
meedBalanceOfOnPolygon
- Parameters:
address- Ethereum address- Returns:
BigDecimalrepresenting the balance of address which is retrieved from polygon blockchain. The retrieved value is divided by number of decimals of the token (10^18)
-
getNetworkId
public long getNetworkId() -
getPolygonNetworkId
public long getPolygonNetworkId() -
getOfferCreationTransactionHash
- Throws:
IOException
-