uint256 transactionGas = 37700; 
      uint256 transactionCost = transactionGas.mul(tx.gasprice);

      
      if (stake > transactionCost) {
        
        if (refundAddress.send(stake.sub(transactionCost))) {
          emit StakeRefunded(
            refundAddress,
            attributeTypeID,
            stake.sub(transactionCost)
          );
        }

        
        if (tx.origin.send(transactionCost)) {
          emit TransactionRebatePaid(
            tx.origin,
            refundAddress,
            attributeTypeID,
            transactionCost
          );
        }

      
      } else if (stake > 0 && address(this).balance >= stake) {
        if (tx.origin.send(stake)) {
          emit TransactionRebatePaid(
            tx.origin,
            refundAddress,
            attributeTypeID,
            stake
          );
        }
      }