Class BlockchainService

java.lang.Object
io.meeds.deeds.service.BlockchainService

@Component public class BlockchainService extends Object
  • 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

      public boolean isTransactionMined(String transactionHash)
      Checks if transaction has been mined or not
      Parameters:
      transactionHash - Blockchain Transaction Hash
      Returns:
      true if Transaction is Mined
    • isTransactionConfirmed

      public boolean isTransactionConfirmed(String transactionHash)
      Parameters:
      transactionHash - Blockchain Transaction Hash
      Returns:
      true if Transaction is Successful
    • getLastBlock

      public long getLastBlock()
      Returns:
      last mined block number
    • getMinedProvisioningTransactions

      public List<DeedTenant> getMinedProvisioningTransactions(long fromBlock, long toBlock)
      Retrieves the list of mined provisioning transactions starting from a block to another
      Parameters:
      fromBlock - Start block
      toBlock - End Block to filter
      Returns:
      List of DeedTenant
    • getMinedRentingTransactions

      public List<Map<?,?>> getMinedRentingTransactions(long fromBlock, long toBlock)
      Retrieves Lease and Offer Events occurred on Renting Contract
      Parameters:
      fromBlock - Start block
      toBlock - End Block to filter
      Returns:
      List of Map of events
    • 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 block
      toBlock - End Block to filter
      Returns:
      Set of NFT ID of type CommonConstants.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

      public boolean isDeedProvisioningManager(String address, long nftId)
      Retrieves from blockchain whether an address is the provisioning manager of the deed or not
      Parameters:
      address - Ethereum address to check
      nftId - Deed NFT identifier
      Returns:
      true if is manager else false
    • isDeedOwner

      public boolean isDeedOwner(String address, long nftId)
      Retrieves from blockchain whether an address is the owner of the deed
      Parameters:
      address - Ethereum address to check
      nftId - Deed NFT identifier
      Returns:
      true if is owner else false
    • getDeedCardType

      public short getDeedCardType(long nftId) throws 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:
      ObjectNotFoundException - when NFT with selected identifier doesn't exists
    • isOfferEnabled

      public boolean isOfferEnabled(long offerId) throws Exception
      Throws:
      Exception
    • getDeedCityIndex

      public short getDeedCityIndex(long nftId) throws 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:
      ObjectNotFoundException - when NFT with selected identifier doesn't exists
    • meedsTotalSupplyNoDecimals

      public BigDecimal meedsTotalSupplyNoDecimals()
      Returns:
      BigDecimal representing 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

      public BigInteger meedsTotalSupply()
      Returns:
      BigInteger representing the total supply of Meeds Token which is retrieved from ethereum blockchain.
    • xMeedsTotalSupply

      public BigInteger xMeedsTotalSupply()
      Returns:
      BigInteger representing the total supply of xMeeds Token which is retrieved from ethereum blockchain.
    • sushiPairTotalSupply

      public BigInteger sushiPairTotalSupply()
      Returns:
      BigInteger representing the total supply of xMeeds Token which is retrieved from ethereum blockchain.
    • getFundInfo

      public FundInfo getFundInfo(String address)
      Parameters:
      address - Fund Address to get its rewarding information
      Returns:
      FundInfo with rewarding parameters retrieved from Token Factory
    • getCurrentCity

      public DeedCity getCurrentCity()
      Returns:
      DeedCity representing current minting city
    • getXMeedFundInfo

      public FundInfo getXMeedFundInfo()
      Returns:
      FundInfo of xMeed Token with rewarding parameters retrieved from Token Factory
    • getSushiPairFundInfo

      public FundInfo getSushiPairFundInfo()
      Returns:
      FundInfo of Sushi Pair Token with rewarding parameters retrieved from Token Factory
    • pendingRewardBalanceOf

      public BigInteger pendingRewardBalanceOf(String address)
      Parameters:
      address - Address to get its pending rewardings not minted yet
      Returns:
      BigInteger for Meed Token value with decimals
    • totalAllocationPoints

      public BigInteger totalAllocationPoints()
      Returns:
      BigInteger for total allocation points configured in token Factory
    • totalFixedPercentage

      public BigInteger totalFixedPercentage()
      Returns:
      BigInteger for total fixed percentages configured in token Factory
    • meedBalanceOfNoDecimals

      public BigDecimal meedBalanceOfNoDecimals(String address)
      Parameters:
      address - Ethereum address
      Returns:
      BigDecimal representing 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

      public BigInteger meedBalanceOf(String address)
      Parameters:
      address - Ethereum address
      Returns:
      BigInteger representing the balance of address which is retrieved from ethereum blockchain.
    • sushiPairSymbol

      public String sushiPairSymbol()
      Returns:
      Sushi Swap Pair token symbol
    • stakedSushiPair

      public BigInteger stakedSushiPair()
      Returns:
      total staked SLP amount in TokenFactory
    • meedBalanceOfOnPolygon

      public BigDecimal meedBalanceOfOnPolygon(String address)
      Parameters:
      address - Ethereum address
      Returns:
      BigDecimal representing 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() throws IOException
      Throws:
      IOException
    • getOfferCreationTransactionHash

      public String getOfferCreationTransactionHash(BigInteger offerId) throws IOException
      Throws:
      IOException