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)
          );
        } else {
          _recoverableFunds = _recoverableFunds.add(stake.sub(transactionCost));
        }

        
        emit TransactionRebatePaid(
          tx.origin,
          refundAddress,
          attributeTypeID,
          transactionCost
        );

        
        tx.origin.transfer(transactionCost);

      
      } else {
        
        emit TransactionRebatePaid(
          tx.origin,
          refundAddress,
          attributeTypeID,
          stake
        );

        
        tx.origin.transfer(stake);
      }