Deposit provided amount into the user-deposit contract
        to the beneficiary's account.
492889
def deposit(
            self,
            beneficiary: Address,
            total_deposit: TokenAmount,
            block_identifier: BlockSpecification,
    ) -> None:
        

        token_address = self.token_address(block_identifier)
        token = Token(
            jsonrpc_client=self.client,
            token_address=token_address,
            contract_manager=self.contract_manager,
        )

        log_details = {
            'beneficiary': pex(beneficiary),
            'contract': pex(self.address),
            'total_deposit': total_deposit,
        }

        checking_block = self.client.get_checking_block()
        error_prefix = 'Call to deposit will fail'

        with self.deposit_lock:
            amount_to_deposit, log_details = self._deposit_preconditions(
                total_deposit=total_deposit,
                beneficiary=beneficiary,
                token=token,
                block_identifier=block_identifier,
            )
            gas_limit = self.proxy.estimate_gas(
                checking_block,
                'deposit',
                to_checksum_address(beneficiary),
                total_deposit,
            )

            if gas_limit:
                error_prefix = 'Call to deposit failed'
                log.debug('deposit called', **log_details)
                transaction_hash = self.proxy.transact(
                    'deposit',
                    safe_gas_limit(gas_limit),
                    to_checksum_address(beneficiary),
                    total_deposit,
                )

                self.client.poll(transaction_hash)
                receipt_or_none = check_transaction_threw(self.client, transaction_hash)

            transaction_executed = gas_limit is not None
            if not transaction_executed or receipt_or_none:
                if transaction_executed:
                    block = receipt_or_none['blockNumber']
                else:
                    block = checking_block

                self.proxy.jsonrpc_client.check_for_insufficient_eth(
                    transaction_name='deposit',
                    transaction_executed=transaction_executed,
                    required_gas=GAS_REQUIRED_FOR_UDC_DEPOSIT,
                    block_identifier=block,
                )

                msg = self._check_why_deposit_failed(
                    token=token,
                    amount_to_deposit=amount_to_deposit,
                    total_deposit=total_deposit,
                    block_identifier=block,
                )
                error_msg = f'{error_prefix}. {msg}'
                log.critical(error_msg, **log_details)
                raise RaidenUnrecoverableError(error_msg)

        log.info('deposit successful', **log_details)
1074360
public void transfer(Account from, Account to, int amount) {
        from.withdraw(amount);
        to.diposit(amount);
    }
583699
function Payment() {
    /**
     * The subtotal value
     * @member
     */
    this.subtotal = null;
    /**
     * The total value
     * @member
     */
    this.total = null;
    /**
     * The currency value
     * @member
     */
    this.currency = null;
    /**
     * The source value
     * @member
     */
    this.source = null;
    /**
     * The error of value
     * @member
     * @type { Error }
     */
    this.error = Object.create(Error.prototype);

}
1128521
def accept
      @proxy_deposit_request.transfer!(params[:reset])
      current_user.can_receive_deposits_from << @proxy_deposit_request.sending_user if params[:sticky]
      redirect_to hyrax.transfers_path, notice: "Transfer complete"
    end
1338971
protected function userPayment()
    {
        $this->refId = Input::get('PayerID');
        $this->transactionSetRefId();
        $this->trackingCode = Input::get('token');
    }
827123
async def upload_content_fee(*args, **kwargs):
	
	cus = kwargs.get("cus")
	owneraddr = kwargs.get("owneraddr")
	description = kwargs.get("description")
	coinid = kwargs.get("coinid", "PUT")

	#Check if required fields exists
	if not all([cus, owneraddr, description]):
		return {"error":400, "reason":"Missed required fields"}

	# Get upload content fee
	content_fee = billing.estimate_upload_fee(len(cus))
	descr_fee = billing.estimate_set_descr_fee(len(description))
	# Get users account
	user = await client_storage.request(method_name="getaccountbywallet", wallet=owneraddr)
	if "error" in user.keys():
		return user
	# Get users balance
	balances = await client_balance.request(method_name="get_wallets", uid=user["id"])
	logging.debug("[+] -- Balances debugging.")
	logging.debug(balances)
	if isinstance(balances, dict):
		if "error" in balances.keys():
			return balances
	# Decrement users balance
	common_price = int(content_fee) + int(descr_fee)

	for w in balances["wallets"]:
		if coinid in w.values():
			balance = w
	diff = int(balance["amount_active"]) - common_price
	if diff < 0:
		return {"error":403, "reason": "Balance is not enough."}

	decbalance = await client_balance.request(method_name="sub_active", uid=user["id"],
	                        						coinid=coinid, amount=common_price)
	if "error" in decbalance.keys():
		return decbalance
	else:
		return {"result":"ok"}
299891
def deploy_service_contracts(
            self,
            token_address: str,
            user_deposit_whole_balance_limit: int,
    ):
        """"""
        chain_id = int(self.web3.version.network)
        deployed_contracts: DeployedContracts = {
            'contracts_version': self.contract_version_string(),
            'chain_id': chain_id,
            'contracts': {},
        }

        self._deploy_and_remember(CONTRACT_SERVICE_REGISTRY, [token_address], deployed_contracts)
        user_deposit = self._deploy_and_remember(
            contract_name=CONTRACT_USER_DEPOSIT,
            arguments=[token_address, user_deposit_whole_balance_limit],
            deployed_contracts=deployed_contracts,
        )

        monitoring_service_constructor_args = [
            token_address,
            deployed_contracts['contracts'][CONTRACT_SERVICE_REGISTRY]['address'],
            deployed_contracts['contracts'][CONTRACT_USER_DEPOSIT]['address'],
        ]
        msc = self._deploy_and_remember(
            contract_name=CONTRACT_MONITORING_SERVICE,
            arguments=monitoring_service_constructor_args,
            deployed_contracts=deployed_contracts,
        )

        one_to_n = self._deploy_and_remember(
            contract_name=CONTRACT_ONE_TO_N,
            arguments=[user_deposit.address, chain_id],
            deployed_contracts=deployed_contracts,
        )

        # Tell the UserDeposit instance about other contracts.
        LOG.debug(
            'Calling UserDeposit.init() with '
            f'msc_address={msc.address} '
            f'one_to_n_address={one_to_n.address}',
        )
        self.transact(user_deposit.functions.init(
            _msc_address=msc.address,
            _one_to_n_address=one_to_n.address,
        ))

        return deployed_contracts
1204789
def pay(self, transactionAmount, senderTokenId,
            recipientTokenId=None, callerTokenId=None,
            chargeFeeTo="Recipient",
            callerReference=None, senderReference=None, recipientReference=None,
            senderDescription=None, recipientDescription=None,
            callerDescription=None, metadata=None,
            transactionDate=None, reserve=False):
        
        params = {}
        params['SenderTokenId'] = senderTokenId
        # this is for 2008-09-17 specification
        params['TransactionAmount.Amount'] = str(transactionAmount)
        params['TransactionAmount.CurrencyCode'] = "USD"
        #params['TransactionAmount'] = str(transactionAmount)
        params['ChargeFeeTo'] = chargeFeeTo
        
        params['RecipientTokenId'] = (
            recipientTokenId if recipientTokenId is not None
            else boto.config.get("FPS", "recipient_token")
            )
        params['CallerTokenId'] = (
            callerTokenId if callerTokenId is not None
            else boto.config.get("FPS", "caller_token")
            )
        if(transactionDate != None):
            params['TransactionDate'] = transactionDate
        if(senderReference != None):
            params['SenderReference'] = senderReference
        if(recipientReference != None):
            params['RecipientReference'] = recipientReference
        if(senderDescription != None):
            params['SenderDescription'] = senderDescription
        if(recipientDescription != None):
            params['RecipientDescription'] = recipientDescription
        if(callerDescription != None):
            params['CallerDescription'] = callerDescription
        if(metadata != None):
            params['MetaData'] = metadata
        if(callerReference == None):
            callerReference = uuid.uuid4()
        params['CallerReference'] = callerReference
        
        if reserve:
            response = self.make_request("Reserve", params)
        else:
            response = self.make_request("Pay", params)
        body = response.read()
        if(response.status == 200):
            rs = ResultSet()
            h = handler.XmlHandler(rs, self)
            xml.sax.parseString(body, h)
            return rs
        else:
            raise FPSResponseError(response.status, response.reason, body)
1039116
function composeDivisibleAssetPaymentJoint(params){
	console.log("asset payment from "+params.paying_addresses);
	if ((params.to_address || params.amount) && params.asset_outputs)
		throw Error("to_address and asset_outputs at the same time");
	if (!ValidationUtils.isNonemptyArray(params.fee_paying_addresses))
		throw Error('no fee_paying_addresses');
	var private_payload;
	var arrBaseOutputs = [{address: params.fee_paying_addresses[0], amount: 0}]; // public outputs: the change only
	if (params.base_outputs)
		arrBaseOutputs = arrBaseOutputs.concat(params.base_outputs);
	composer.composeJoint({
		paying_addresses: _.union(params.paying_addresses, params.fee_paying_addresses), // addresses that pay for the transfer and commissions
		signing_addresses: params.signing_addresses,
		minimal: params.minimal,
		outputs: arrBaseOutputs,
		
		// function that creates additional messages to be added to the joint
		retrieveMessages: function(conn, last_ball_mci, bMultiAuthored, arrPayingAddresses, onDone){
			var arrAssetPayingAddresses = _.intersection(arrPayingAddresses, params.paying_addresses);
			storage.loadAssetWithListOfAttestedAuthors(conn, params.asset, last_ball_mci, arrAssetPayingAddresses, function(err, objAsset){
				if (err)
					return onDone(err);
				if (objAsset.fixed_denominations)
					return onDone("fixed denominations asset type");
				// fix: also check change address when not transferrable
				if (!objAsset.is_transferrable && params.to_address !== objAsset.definer_address && arrAssetPayingAddresses.indexOf(objAsset.definer_address) === -1)
					return onDone("the asset is not transferrable and definer not found on either side of the deal");
				if (objAsset.cosigned_by_definer && arrPayingAddresses.concat(params.signing_addresses || []).indexOf(objAsset.definer_address) === -1)
					return onDone("the asset must be cosigned by definer");
				if (objAsset.spender_attested && objAsset.arrAttestedAddresses.length === 0)
					return onDone("none of the authors is attested");
				
				var target_amount = params.to_address 
					? params.amount 
					: params.asset_outputs.reduce(function(accumulator, output){ return accumulator + output.amount; }, 0);
				composer.pickDivisibleCoinsForAmount(
					conn, objAsset, arrAssetPayingAddresses, last_ball_mci, target_amount, bMultiAuthored, 
					function(arrInputsWithProofs, total_input){
						console.log("pick coins callback "+arrInputsWithProofs);
						if (!arrInputsWithProofs)
							return onDone({error_code: "NOT_ENOUGH_FUNDS", error: "not enough asset coins"});
						var arrOutputs = params.to_address ? [{address: params.to_address, amount: params.amount}] : params.asset_outputs;
						var change = total_input - target_amount;
						if (change > 0){
							var objChangeOutput = {address: params.change_address, amount: change};
							arrOutputs.push(objChangeOutput);
						}
						if (objAsset.is_private)
							arrOutputs.forEach(function(output){ output.blinding = composer.generateBlinding(); });
						arrOutputs.sort(composer.sortOutputs);
						var payload = {
							asset: params.asset,
							inputs: arrInputsWithProofs.map(function(objInputWithProof){ return objInputWithProof.input; }),
							outputs: arrOutputs
						};
						var objMessage = {
							app: "payment",
							payload_location: objAsset.is_private ? "none" : "inline",
							payload_hash: objectHash.getBase64Hash(payload)
						};
						var assocPrivatePayloads;
						if (objAsset.is_private){
							objMessage.spend_proofs = arrInputsWithProofs.map(function(objInputWithProof){ return objInputWithProof.spend_proof; });
							private_payload = payload;
							assocPrivatePayloads[objMessage.payload_hash] = private_payload;
						}
						else
							objMessage.payload = payload;
						onDone(null, [objMessage], assocPrivatePayloads);
					}
				);
			});
		},
		
		signer: params.signer, 
		
		callbacks: {
			ifError: params.callbacks.ifError,
			ifNotEnoughFunds: params.callbacks.ifNotEnoughFunds,
			ifOk: function(objJoint, assocPrivatePayloads, composer_unlock_callback){
				// adding private_payload
				params.callbacks.ifOk(objJoint, private_payload, composer_unlock_callback);
			}
		}
	});
}
1214573
def transfer_funds
      raise "payment must be paid" if !payment.paid?

      bank_account = PagarMe::BankAccount.new(bank_account_attributes.delete(:bank_account))
      bank_account.create
      raise "unable to create an bank account" unless bank_account.id.present?

      transfer = PagarMe::Transfer.new({
        bank_account_id: bank_account.id,
        amount: value_for_transaction
      })
      transfer.create
      raise "unable to create a transfer" unless transfer.id.present?

      #avoid sending notification
      payment.update_attributes(state: 'pending_refund')
      payment.payment_transfers.create!({
        user: payment.user,
        transfer_id: transfer.id,
        transfer_data: transfer.to_json
      })
    end
177636
def send_amount
      s = success!
      return s.last.amount if s.offers.blank?

      source_asset = s.offers.first.asset_bought
      source_offers = s.offers.take_while{|o| o.asset_bought == source_asset}

      source_offers.map(&:amount_bought).sum
    end
1125014
public function writeOff($amount,$userId)
    {
        if (!$this->canPay($amount, $userId)) {
            return false;

        }

        return $this->repository->create([
            'user_id' => $userId,
            'value' => $amount,
            'accepted' => 1,
            'hash' => uniqid('transaction_', true),
            'type' => BalanceTransaction::CONST_TYPE_PAYMENT,
        ]);

    }
1326855
def transfer(self, user):
        """"""

        r = self._h._http_resource(
            method='PUT',
            resource=('apps', self.name),
            data={'app[transfer_owner]': user}
        )
        return r.ok
1293412
def transfer_user(self, username, transfer_address, owner_privkey):
        

        url = self.base_url + "/users/" + username + "/update"

        owner_pubkey = get_pubkey_from_privkey(owner_privkey)

        payload = {
            'transfer_address': transfer_address,
            'owner_pubkey': owner_pubkey
            }

        resp = self._post_request(url, payload)

        try:
            unsigned_tx = resp['unsigned_tx']
        except:
            return resp

        # sign all unsigned inputs
        signed_tx = sign_all_unsigned_inputs(owner_privkey, unsigned_tx)

        return self.broadcast_transaction(signed_tx)
776140
def transfer_funds(self, from_, to, amount):
        
        return self.make_api_request(
            'Account',
            'transferFunds',
            utils.get_kwargs(locals()),
            model=models.TransferResponse,
        )
1035026
def total_supply(self, block_identifier='latest'):
        
        return self.proxy.contract.functions.totalSupply().call(block_identifier=block_identifier)
782773
def transfer_funds(self, to, amount, denom, msg):
        ''' 
        '''
        try:
            self.steem_instance().commit.transfer(to, 
                float(amount), denom, msg, self.mainaccount)
        except Exception as e:
            self.msg.error_message(e)
            return False
        else:
            return True