Exemple #1
0
def sync_nervos_payout(fulfillment):
    if fulfillment.payout_tx_id and fulfillment.payout_tx_id != "0x0":
        txn_status = get_nervos_txn_status(fulfillment.payout_tx_id)
        if txn_status:
            fulfillment.payout_status = 'done'
            fulfillment.accepted_on = timezone.now()
            fulfillment.accepted = True
            record_payout_activity(fulfillment)
        fulfillment.save()
Exemple #2
0
def sync_casper_payout(fulfillment):
    if fulfillment.payout_tx_id:
        txn_status = get_casper_txn_status(fulfillment)

        if txn_status == 'success':
            fulfillment.payout_status = 'done'
            fulfillment.accepted_on = timezone.now()
            fulfillment.accepted = True
            record_payout_activity(fulfillment)
        elif txn_status == 'expired':
            fulfillment.payout_status = 'expired'

        fulfillment.save()
Exemple #3
0
def sync_eth_payout(fulfillment):
    if fulfillment.payout_tx_id:
        txn_status = get_eth_txn_status(fulfillment)
        if txn_status:
            if txn_status.get('status') == 'done':
                fulfillment.payout_status = 'done'
                fulfillment.accepted_on = timezone.now()
                fulfillment.accepted = True
                record_payout_activity(fulfillment)
            elif txn_status.get('status') == 'expired':
                fulfillment.payout_status = 'expired'

        fulfillment.save()
Exemple #4
0
def sync_btc_payout(fulfillment):
    if not fulfillment.payout_tx_id or fulfillment.payout_tx_id == "0x0":
        txn = find_txn_on_btc_explorer(fulfillment)
        fulfillment.payout_tx_id = txn

    if fulfillment.payout_tx_id and fulfillment.payout_tx_id != "0x0":
        txn_status = get_btc_txn_status(fulfillment.payout_tx_id)
        if txn_status:
            fulfillment.payout_status = 'done'
            fulfillment.accepted_on = timezone.now()
            fulfillment.accepted = True
            record_payout_activity(fulfillment)
        fulfillment.save()
Exemple #5
0
def sync_etc_payout(fulfillment):
    if not fulfillment.payout_tx_id or fulfillment.payout_tx_id == "0x0":
        txn = find_txn_on_etc_explorer(fulfillment)
        if txn:
            fulfillment.payout_tx_id = txn['hash']
    if fulfillment.payout_tx_id and fulfillment.payout_tx_id != "0x0":
        txn_status = get_etc_txn_status(fulfillment.payout_tx_id)
        if txn_status and txn_status.get('has_mined'):
            fulfillment.payout_status = 'done'
            fulfillment.accepted_on = timezone.now()
            fulfillment.accepted = True
            record_payout_activity(fulfillment)
        fulfillment.save()
Exemple #6
0
def sync_polkadot_payout(fulfillment):
    if fulfillment.payout_tx_id:
        txn_status = get_polkadot_txn_status(fulfillment.payout_tx_id, fulfillment.token_name)
        if txn_status:
            status_description = txn_status.get('status')
            if status_description == 'done':
                fulfillment.payout_status = 'done'
                fulfillment.accepted_on = timezone.now()
                fulfillment.accepted = True
                fulfillment.save()
                record_payout_activity(fulfillment)
            elif status_description == 'expired':
                fulfillment.payout_status = 'expired'
                fulfillment.save()
Exemple #7
0
def sync_zil_payout(fulfillment):
    time.sleep(0.5)  # to avoid rate limit
    if not fulfillment.payout_tx_id or fulfillment.payout_tx_id == "0x0":
        txn = find_txn_on_zil_explorer(fulfillment)
        if txn:
            fulfillment.payout_tx_id = txn['hash']
            fulfillment.save()

    if fulfillment.payout_tx_id and fulfillment.payout_tx_id != "0x0":
        txn_status = get_zil_txn_status(fulfillment.payout_tx_id)
        if txn_status and txn_status.get('has_mined'):
            fulfillment.payout_status = 'done'
            fulfillment.accepted_on = timezone.now()
            fulfillment.accepted = True
            fulfillment.save()
            record_payout_activity(fulfillment)
Exemple #8
0
def sync_eth_payout(fulfillment):
    if fulfillment.payout_tx_id:
        from economy.tx import getReplacedTX
        replacement_payout_tx_id = fulfillment.payout_tx_id
        if replacement_payout_tx_id:
            fulfillment.payout_tx_id = replacement_payout_tx_id
        txn_status = get_eth_txn_status(fulfillment)
        if txn_status:
            if txn_status.get('status') == 'done':
                fulfillment.payout_status = 'done'
                fulfillment.accepted_on = timezone.now()
                fulfillment.accepted = True
                record_payout_activity(fulfillment)
            elif txn_status.get('status') == 'expired':
                fulfillment.payout_status = 'expired'

        fulfillment.save()
Exemple #9
0
def sync_tezos_payout(fulfillment):
    if not fulfillment.payout_tx_id or fulfillment.payout_tx_id == "0x0":
        txn = find_txn_on_tezos_explorer(fulfillment)
        if txn:
            fulfillment.payout_tx_id = txn['hash']
            fulfillment.save()

    if fulfillment.payout_tx_id and fulfillment.payout_tx_id != "0x0":
        txn_status = get_tezos_txn_status(fulfillment)

        if txn_status == 'success':
            fulfillment.payout_status = 'done'
            fulfillment.accepted_on = timezone.now()
            fulfillment.accepted = True
            record_payout_activity(fulfillment)
        elif txn_status == 'expired':
            fulfillment.payout_status = 'expired'

        fulfillment.save()