check deposit address is valid and balance
556173
function(cb){
				deposit.getDepositAddressBySupernodeAddress(conn, objUnit.authors[0].address, function (err,depositAddress){
					if(err)
						 return cb(err + " can not send pow unit");
					if(payload.deposit != depositAddress)
						return cb("pow unit deposit address is invalid expeected :" + depositAddress +" Actual :" + payload.deposit);
					deposit.getBalanceOfDepositContract(conn, depositAddress,objUnit.round_index,  function (err,balance){
						if(err)
							return cb(err);
						depositBalance = balance;
						cb();
					   }); 
				});
			}
986397
def check(self):
        """"""
        if not self.date:
            raise XnDataError("Missing date")
        if not self.desc:
            raise XnDataError("Missing description")
        if not self.dst:
            raise XnDataError("No destination accounts")
        if not self.src:
            raise XnDataError("No source accounts")
        if not self.amount:
            raise XnDataError("No transaction amount")
943260
def balance(self):
        """"""
        self.check()
        if not sum(map(lambda x: x.amount, self.src)) == -self.amount:
            raise XnBalanceError("Sum of source amounts "
                                 "not equal to transaction amount")
        if not sum(map(lambda x: x.amount, self.dst)) == self.amount:
            raise XnBalanceError("Sum of destination amounts "
                                 "not equal to transaction amount")
        return True
476014
def get_balance(self, address, block="latest"):
        
        response = self.make_request("eth_getBalance", [address, block])
        return int(response['result'], 16)
219712
public static function validateAddress(&$element, FormStateInterface $form_state, &$complete_form) {
    $address = $element['#value'];
    $address_review_text = $element['#address_review_text'];
    $address_failed_text = $element['#address_failed_text'];

    // Make sure these fields have values before trying to validate the address.
    $required_fields = [
      'street',
      'city',
      'region',
      'postcode',
    ];

    $skip = FALSE;

    foreach ($required_fields as $required_field) {
      if (empty($address[$required_field])) {
        $skip = TRUE;
        break;
      }
    }

    // Skip validation if not all fields are filled out yet.
    if ($skip) {
      return $element;
    }

    try {
      $response = \Drupal::service('acm.api')
        ->validateCustomerAddress($address);

      // Address is valid and no suggestion came back.
      if (isset($response['result']['valid']) && empty($response['result']['suggested'])) {
        drupal_set_message($address_review_text, 'status');
      }
      // Address is in review and there's a suggestion that we use to pre-fill
      // the address fields.
      elseif (isset($response['result']['suggested']) && !empty($response['result']['suggested'])) {
        $suggested_address = reset($response['result']['suggested']);
        foreach ($suggested_address as $field => $value) {
          if (!empty($value)) {
            if (isset($element[$field])) {
              $form_state->setValueForElement($element[$field], $value);
            }
            elseif (isset($element['dynamic_parts'][$field])) {
              $form_state->setValueForElement($element['dynamic_parts'][$field], $value);
            }
          }
        }

        drupal_set_message($address_review_text, 'status');
      }
      // Address failed validation.
      else {
        $form_state->setError($element, $address_failed_text);
      }
    }
    catch (RouteException $e) {
      $form_state->setError($element, $address_failed_text);
    }

    return $element;
  }
1223373
private function checkValidity()
    {

        if (!is_writable($this->rssFile)) {
            $this->valid = false;
            return;
        }

        $stmt = $this->db->prepare('SELECT CREATED FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT 1');
        $stmt->execute();
        $res = $stmt->fetchAll();

        if (count($res) == 0) {
            $this->valid = false;
            return;
        }

        $latestInput = strtotime($res[0]->CREATED);

        $rssCreated = filemtime($this->rssFile);

        if ($latestInput > $rssCreated) {
            $this->valid = false;
        } else {
            $this->valid = true;
        }
    }
4198
def get_deposit_address(self, currency):
        
        self._validate_currency(currency)
        self._log('get deposit address for {}'.format(currency))
        coin_name = self.major_currencies[currency]
        return self._rest_client.post(
            endpoint='/{}_deposit_address'.format(coin_name)
        )
125868
def deposit!(amount, source_account_id, dedupe_id = SecureRandom.uuid)
      data = {
        amount: amount,
        source_account_id: source_account_id,
        dedupe_id: dedupe_id,
      }

      response = Monzo.client.put("/pots/#{@id}/deposit", data)
      parsed_response = parse_response(response)
      update_self(parsed_response)
    end
118897
def set_checksums
      @sum_bank_account_numbers, @sum_bank_numbers, @sum_values  = 0,0,0
      bookings.each do |b|
        @sum_bank_account_numbers  += b.account.bank_account_number
        @sum_bank_numbers += b.account.bank_number
        @sum_values += b.value
      end
    end
409296
def valid?
      return false if @id.nil?
      return false if @date.nil?
      return false if @amount.nil?
      return false if @memo.nil?
      return false if @cleared.nil?
      cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
      return false unless cleared_validator.valid?(@cleared)
      return false if @approved.nil?
      return false if @flag_color.nil?
      flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
      return false unless flag_color_validator.valid?(@flag_color)
      return false if @account_id.nil?
      return false if @payee_id.nil?
      return false if @category_id.nil?
      return false if @transfer_account_id.nil?
      return false if @transfer_transaction_id.nil?
      return false if @matched_transaction_id.nil?
      return false if @import_id.nil?
      return false if @deleted.nil?
      true
    end
665777
public function isValid()
    {
        //validate directPayment values
        $checkEmpty = array($this->ipAddress, $this->acct, $this->firstName, $this->lastName);

        if(!$this->checkEmpty($checkEmpty) || is_null($this->_address)) {
            return false;
        }

        //address fields
        $address = $this->_address;

        $test = array(
            $address->getStreet(),
            $address->getCity(),
            $address->getState(),
            $address->getCountryCode(),
            $address->getZip()
        );

        if(!$this->checkEmpty($test) || is_null($this->_paymentDetails)) {
            return false;
        }

        $amt = $this->_paymentDetails->getAmt();
        if(empty($amt)) {
            return false;
        }

        //payment details payment action cannot be order
        if($this->_paymentDetails->getPaymentAction() == "Order") {
            return false;
        }

        return true;
    }
827051
function checkIfCreated(ID, money) {
                    db.get(`SELECT * FROM economy WHERE userID = '${ID}'`, (err, row) => {
                        if (!row) {
                            insertFirstMoney(ID);
                        } else {
                            db.run(`UPDATE economy SET money = '${money}' WHERE userID = '${ID}'`);
                            db.get(`SELECT * FROM economy WHERE userID = '${ID}'`, (err, row) => {
                                resolveDB(row);
                            });
                        }
                    });
                }
197163
def effective_balance(self, address: Address, block_identifier: BlockSpecification) -> Balance:
        
        fn = getattr(self.proxy.contract.functions, 'effectiveBalance')
        balance = fn(address).call(block_identifier=block_identifier)

        if balance == b'':
            raise RuntimeError(f"Call to 'effectiveBalance' returned nothing")

        return balance
979919
def isValidPublicAddress(address: str) -> bool:
    """"""
    valid = False

    if len(address) == 34 and address[0] == 'A':
        try:
            base58.b58decode_check(address.encode())
            valid = True
        except ValueError:
            # checksum mismatch
            valid = False

    return valid
41341
def get_balance(self, address, api_token):
        
        broadcast_url = self.base_url + '?module=account&action=balance'
        broadcast_url += '&address=%s' % address
        broadcast_url += '&tag=latest'
        if api_token:
            '&apikey=%s' % api_token
        response = requests.get(broadcast_url)
        if int(response.status_code) == 200:
            balance = int(response.json().get('result', None))
            logging.info('Balance check succeeded: %s', response.json())
            return balance
        raise BroadcastError(response.text)
49254
def commit_deposit(self, account_id, deposit_id, **params):
        """"""
        response = self._post(
            'v2', 'accounts', account_id, 'deposits', deposit_id, 'commit',
            data=params)
        return self._make_api_object(response, Deposit)
153187
def valid?
      return false if @account_id.nil?
      return false if @date.nil?
      return false if @amount.nil?
      cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
      return false unless cleared_validator.valid?(@cleared)
      flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
      return false unless flag_color_validator.valid?(@flag_color)
      true
    end