Class ConditionsManager

    • Field Detail

      • log

        private static final org.apache.logging.log4j.Logger log
    • Constructor Detail

      • ConditionsManager

        public ConditionsManager​(io.keyko.common.web3.KeeperService keeperService,
                                 MetadataApiService metadataApiService)
    • Method Detail

      • getInstance

        public static ConditionsManager getInstance​(io.keyko.common.web3.KeeperService keeperService,
                                                    MetadataApiService metadataApiService)
        Given the KeeperService and MetadataApiService, returns a new instance of ConditionsManager using them as attributes
        Parameters:
        keeperService - Keeper Dto
        metadataApiService - Provider Dto
        Returns:
        ConditionsManager
      • lockReward

        public Boolean lockReward​(String agreementId,
                                  BigInteger amount)
                           throws Exception
        Lock reward for a service agreement.
        Parameters:
        agreementId - the agreement id.
        amount - the amount to be locked.
        Returns:
        a flag true if was executed successfully.
        Throws:
        Exception - exception
      • grantAccess

        public Boolean grantAccess​(String agreementId,
                                   DID did,
                                   String granteeAddress)
                            throws Exception
        Grant access to an address to consume a did.
        Parameters:
        agreementId - the agreement id.
        did - the did.
        granteeAddress - an eth address.
        Returns:
        a flag true if was executed successfully.
        Throws:
        Exception - exception
      • grantCompute

        public Boolean grantCompute​(String agreementId,
                                    DID did,
                                    String granteeAddress)
                             throws Exception
        Grant compute to an address.
        Parameters:
        agreementId - the agreement id.
        did - the did.
        granteeAddress - an eth address.
        Returns:
        a flag true if was executed successfully.
        Throws:
        Exception - exception
      • releaseReward

        public Boolean releaseReward​(String agreementId,
                                     BigInteger amount)
                              throws Exception
        Release reward to the address after the access was granted.
        Parameters:
        agreementId - the agreement id.
        amount - the price.
        Returns:
        a flag true if was executed successfully.
        Throws:
        Exception - exception
      • refundReward

        public Boolean refundReward​(String agreementId,
                                    BigInteger amount)
                             throws Exception
        Refund the price in case that some of the step was wrong.
        Parameters:
        agreementId - the agreement id.
        amount - the price.
        Returns:
        a flag true if was executed successfully.
        Throws:
        Exception - exception