def sendcoin_to_poster_xmr_comment(sender_id, amount, commentid, recieverid): """ # From user wallet to user wallet # happens during a tip to comment user_id0 transfers to user_id1 :param sender_id: :param amount: :param commentid: :param recieverid: :return: """ try: type_transaction_recieve_comment = 5 recieverwallet = MoneroWallet.query.filter_by( user_id=recieverid).first() # add amount to commenter curbal_reciever = Decimal(recieverwallet.currentbalance) amounttomod = Decimal(amount) newbalance_reciever = curbal_reciever + amounttomod recieverwallet.currentbalance = newbalance_reciever db.session.add(recieverwallet) # add transaction for senders wallet monero_addtransaction(category=type_transaction_recieve_comment, amount=amount, user_id=recieverid, senderid=sender_id, comment='', orderid=commentid, balance=newbalance_reciever) # add transaction for comments wallet except Exception as e: db.session.rollback()
def sendcoin_subowner_xmr_comment(sender_id, amount, commentid, recieverid): try: type_transaction_recieve_post = 10 recieverwallet = MoneroWallet.query.filter_by(user_id=recieverid).first() # add amount to commenter curbal_reciever = Decimal(recieverwallet.currentbalance) amounttomod = Decimal(amount) newbalance_reciever = curbal_reciever + amounttomod recieverwallet.currentbalance = newbalance_reciever db.session.add(recieverwallet) # add transaction for recievers wallet monero_addtransaction(category=type_transaction_recieve_post, amount=amount, user_id=recieverid, senderid=sender_id, comment=commentid, orderid='', balance=newbalance_reciever ) # add transaction for comments wallet except Exception as e: db.session.rollback()
def take_coin_from_tipper_xmr_post(sender_id, amount, postid, recieverid): """ # From user wallet to user wallet # happens during a tip to post user_id0 transfers to user_id1 :param sender_id: :param amount: :param postid: :param recieverid: :return: """ try: type_transaction_tip_post = 6 senderwallet = MoneroWallet.query.filter_by(user_id=sender_id).first() # remove amount from sender curbal_sender = Decimal(senderwallet.currentbalance) amounttomod = Decimal(amount) newbalance_sender = curbal_sender - amounttomod senderwallet.currentbalance = newbalance_sender db.session.add(senderwallet) # add transaction for senders wallet monero_addtransaction(category=type_transaction_tip_post, amount=amount, user_id=sender_id, senderid=recieverid, comment='', orderid=postid, balance=newbalance_sender) # add transaction for comments wallet except Exception as e: db.session.rollback()
def sendcointosite_post_promotion_xmr(sender_id, amount, postid, room): """ # From user wallet to user wallet # happens during a tip to post user_id0 transfers to user_id1 :param sender_id: :param amount: :param postid: :return: """ type_transaction_tip_post = 8 type_transaction_recieve_post = 9 senderwallet = MoneroWallet.query.filter_by(user_id=sender_id).first() recieverwallet = MoneroWallet.query.filter_by(user_id=1).first() # remove amount from sender curbal_sender = Decimal(senderwallet.currentbalance) amounttomod = Decimal(amount) newbalance_sender = curbal_sender - amounttomod senderwallet.currentbalance = newbalance_sender db.session.add(senderwallet) # add amount to commenter curbal_reciever = Decimal(recieverwallet.currentbalance) amounttomod = Decimal(amount) newbalance_reciever = curbal_reciever + amounttomod recieverwallet.currentbalance = newbalance_reciever db.session.add(recieverwallet) # add transaction for senders wallet monero_addtransaction(category=type_transaction_tip_post, amount=amount, comment=room, user_id=sender_id, senderid=1, orderid=postid, balance=newbalance_sender ) # add transaction for sites wallet monero_addtransaction(category=type_transaction_recieve_post, amount=amount, user_id=1, comment=room, senderid=sender_id, orderid=postid, balance=newbalance_reciever )
def sendcoin_user_daily_xmr(user_id, amount): """ :param user_id: :param amount: :return: """ type_transaction_send_daily = 13 type_transaction_recieve_daily = 14 sender_wallet = MoneroWallet.query.filter_by(user_id=1).first() recieve_wallet = MoneroWallet.query.filter( MoneroWallet.user_id == user_id).first() # remove amount from tipvote wallet curbal_sender = Decimal(sender_wallet.currentbalance) amount_sent_modified_decimal = Decimal(amount) newbalance_sender = curbal_sender - amount_sent_modified_decimal sender_wallet.currentbalance = newbalance_sender # add amount to user current_balance_reciever = Decimal(recieve_wallet.currentbalance) amount_recieve_modified_decimal = Decimal(amount) newbalance_reciever = current_balance_reciever + amount_recieve_modified_decimal recieve_wallet.currentbalance = newbalance_reciever # add transaction for tipvote wallet monero_addtransaction(category=type_transaction_send_daily, amount=amount, user_id=1, senderid=user_id, comment='daily reward', orderid=0, balance=newbalance_sender) # add transaction to reciver wallet monero_addtransaction(category=type_transaction_recieve_daily, amount=amount, user_id=user_id, senderid=1, comment='daily reward', orderid=0, balance=newbalance_reciever) db.session.add(sender_wallet) db.session.add(recieve_wallet) db.session.commit()