def test_create_new_claim(claimType): sifchain_address, sifchain_name = create_new_sifaddr_and_key() keyring_backend = 'test' chain_id = 'localnet' from_address = 'sifnodeadmin' amount = '10000000rowan' send_sample_rowan(from_address, sifchain_address, amount, keyring_backend, chain_id, "") time.sleep(5) txnhash = (create_claim(sifchain_address, claimType, keyring_backend, chain_id)) logging.info(f"txnhash= ${txnhash}") time.sleep(5) response = (query_block_claim(str(txnhash))) logging.info(f"response= ${response}") try: data = (response['logs'][0]['events'][1]['attributes']) expectedOutputTagsList = [] for value in data: expectedOutputTagsList.append(value['key']) expectedOutputTagsList.append(value['value']) assert response['txhash'] == txnhash assert expectedOutputTagsList[0] == 'userClaim_creator' assert expectedOutputTagsList[2] == 'userClaim_type' assert expectedOutputTagsList[4] == 'userClaim_creationTime' assert str(expectedOutputTagsList[1]) == sifchain_address assert str(expectedOutputTagsList[3]) in [ 'DISTRIBUTION_TYPE_VALIDATOR_SUBSIDY', 'DISTRIBUTION_TYPE_LIQUIDITY_MINING' ] except KeyError: with pytest.raises(Exception, match='User trying to create a duplicate claim'): raise Exception
def test_insufficient_funds_dispensation_txn(claimType): distributor_address, distributor_name = create_new_sifaddr_and_key() runner_address, runner_name = create_new_sifaddr_and_key() logging.info(f"distributor_address = {distributor_address}, distributor_name = {distributor_name}") logging.info(f"runner_address = {runner_address}, runner_name = {runner_name}") destaddress1, destname1 = create_new_sifaddr_and_key() destaddress2, destname2 = create_new_sifaddr_and_key() from_address = 'sifnodeadmin' keyring_backend = 'test' chain_id = 'localnet' amount = '70000rowan' sampleamount = '1000rowan' # THESE 4 TXNS ARE TO REGISTER NEW ACCOUNTS ON CHAIN send_sample_rowan(from_address, runner_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, distributor_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress1, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress2, sampleamount, keyring_backend, chain_id, "") time.sleep(5) # CREATING TEST DATA HERE MIMICKING OUTPUT.JSON TO BE SUPPLIED BY NIKO'S API dict1 = {"denom": "rowan", "amount": "5000"} dict2 = {"denom": "rowan", "amount": "19000"} dict3 = {"address": destaddress1, "coins": [dict1]} dict4 = {"address": destaddress2, "coins": [dict2]} dict5 = {"Output": [dict3, dict4]} data = json.dumps(dict5) with open("output.json", "w") as f: f.write(data) # READ OUTPUT.JSON WITH CLAIMING ADDRESSES AND AMOUNT with open("output.json", "r") as f: data = f.read() # ACTUAL DISPENSATION TXN; TXN RAISES AN EXCEPTION ABOUT INSUFFICIENT FUNDS, CAPTURED HERE AND TEST IS MARKED PASS with pytest.raises(Exception) as execinfo: txhash = str((create_online_singlekey_txn_with_runner(claimType, runner_address, distributor_address, chain_id))) assert str(execinfo.value) == f"for address : {distributor_address}: Failed in collecting funds for airdrop: failed to execute message; message index: 0: failed to simulate tx" logging.info(f"Insufficient Funds Message = {txhash}") try: os.remove('signed.json') os.remove('sample.json') os.remove('output.json') except OSError as e: print("Error: %s - %s." % (e.filename, e.strerror))
def test_run_online_singlekey_txn(claimType): distributor_address, distributor_name = create_new_sifaddr_and_key() runner_address, runner_name = create_new_sifaddr_and_key() logging.info(f"distributor_address = {distributor_address}, distributor_name = {distributor_name}") logging.info(f"runner_address = {runner_address}, runner_name = {runner_name}") destaddress1, destname1 = create_new_sifaddr_and_key() destaddress2, destname2 = create_new_sifaddr_and_key() from_address = 'sifnodeadmin' keyring_backend = 'test' chain_id = 'localnet' amount = '10000000rowan' fee = '150000' currency = 'rowan' sampleamount = '1000rowan' # THESE 4 TXNS ARE TO REGISTER NEW ACCOUNTS ON CHAIN send_sample_rowan(from_address, runner_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, distributor_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress1, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress2, sampleamount, keyring_backend, chain_id, "") time.sleep(5) sorted_dest_address_list = sorted([destaddress1,destaddress2]) logging.info(f"sorted_dest_address_list = {sorted_dest_address_list}") # CREATING TEST DATA HERE MIMICKING OUTPUT.JSON TO BE SUPPLIED BY NIKO'S API dict1 = {"denom": "rowan", "amount": "5000"} dict2 = {"denom": "rowan", "amount": "7000"} dict3 = {"address": destaddress1, "coins": [dict1]} dict4 = {"address": destaddress2, "coins": [dict2]} dict5 = {"Output": [dict3, dict4]} data = json.dumps(dict5) with open("output.json", "w") as f: f.write(data) # READ OUTPUT.JSON WITH CLAIMING ADDRESSES AND AMOUNT with open("output.json", "r") as f: data = f.read() d = json.loads(data) one_claiming_address = str(d['Output'][0]['address']) logging.info(f"one claiming address = {one_claiming_address}") # SENDER AND RECIPENT INITIAL BALANCE sender_initial_balance = int(balance_check(distributor_address, currency)) claiming_address_initial_balance = int(balance_check(one_claiming_address, currency)) logging.info(f"sender initial balance = {sender_initial_balance}") logging.info(f"one claiming address initial balance = {claiming_address_initial_balance}") # CREATE DISPENSATION TXN; GET TXN HASH txhash = str((create_online_singlekey_txn_with_runner(claimType, runner_address, distributor_name, chain_id))) logging.info(f"txn hash for creatng a dispensation = {txhash}") time.sleep(5) # QUERY BLOCK USING TXN HASH resp = query_block_claim(txhash) distribution_msg = resp['tx']['body']['messages'][0] msg_type = distribution_msg['@type'] distributor = distribution_msg['distributor'] authorized_runner = distribution_msg['authorized_runner'] distribution_type = distribution_msg['distribution_type'] assert str(msg_type) == '/sifnode.dispensation.v1.MsgCreateDistribution' assert str(distributor) == distributor_address assert str(authorized_runner) == runner_address assert str(distribution_type) in ['DISTRIBUTION_TYPE_VALIDATOR_SUBSIDY', 'DISTRIBUTION_TYPE_LIQUIDITY_MINING'] distribution_msg_keys = list(distribution_msg.keys()) assert distribution_msg_keys[0] == '@type' assert distribution_msg_keys[1] == 'distributor' assert distribution_msg_keys[2] == 'authorized_runner' assert distribution_msg_keys[3] == 'distribution_type' distribution_name = resp['logs'][0]['events'][0]['attributes'][1]['value'] distribution_type = resp['logs'][0]['events'][0]['attributes'][2]['value'] logging.info(f"distribution_name = {distribution_name}, distribution_type = {distribution_type}") # RUN DISPENSATION TXN; GET TXN HASH runtxnhash = run_dispensation(distribution_name, claimType, runner_address, chain_id) logging.info(f"txn hash for running dispensation = {runtxnhash}") time.sleep(5) # QUERY BLOCK USING TXN HASH runresp = query_block_claim(runtxnhash) logging.info(f"response from block for run dispensation = {runresp}") rundistributiontag = runresp['logs'][0]['events'][2]['type'] rundistname = runresp['logs'][0]['events'][2]['attributes'][0]['value'] runrunneraddress = runresp['logs'][0]['events'][2]['attributes'][1]['value'] rundistreceiverlist = [runresp['logs'][0]['events'][4]['attributes'][0]['value'], runresp['logs'][0]['events'][4]['attributes'][3]['value']] sortedrundistreceiverlist = sorted(rundistreceiverlist) logging.info(f"sortedrundistreceiverlist = {sortedrundistreceiverlist}") logging.info(f"sortedrundistreceiverlist first item = {sortedrundistreceiverlist[0]}") logging.info(f"sortedrundistreceiverlist second item = {sortedrundistreceiverlist[1]}") # RUN DISTRIBUTION TXN JSON TAGS ASSERTIONS assert str(rundistributiontag) == 'distribution_run' assert str(rundistname) == distribution_name assert str(runrunneraddress) == runner_address assert sortedrundistreceiverlist[0] == sorted_dest_address_list[0] assert sortedrundistreceiverlist[1] == sorted_dest_address_list[1] run_distr_msg = runresp['tx']['body']['messages'][0] run_msg_type = run_distr_msg['@type'] run_authorized_runner = run_distr_msg['authorized_runner'] run_distribution_type = run_distr_msg['distribution_type'] assert str(run_msg_type) == '/sifnode.dispensation.v1.MsgRunDistribution' assert str(run_authorized_runner) == runner_address assert str(run_distribution_type) in ['DISTRIBUTION_TYPE_VALIDATOR_SUBSIDY', 'DISTRIBUTION_TYPE_LIQUIDITY_MINING'] run_distr_msg_keys = list(run_distr_msg.keys()) assert run_distr_msg_keys[0] == '@type' assert run_distr_msg_keys[1] == 'authorized_runner' assert run_distr_msg_keys[2] == 'distribution_name' assert run_distr_msg_keys[3] == 'distribution_type' # READING TAGS FROM RUN DISPENSATION CMD temprundistamount1 = runresp['logs'][0]['events'][4]['attributes'][2]['value'] logging.info(f"temp amount distributed 1 = {temprundistamount1}") temprundistamount2 = runresp['logs'][0]['events'][4]['attributes'][5]['value'] logging.info(f"temp amount distributed 2 = {temprundistamount2}") my_list = [temprundistamount1, temprundistamount2] logging.info(f"my list = {my_list}") rundistamount = [int(i[:-5]) for i in my_list] logging.info(f"temp amount distributed 2 = {rundistamount}") runrecipientaddress1 = runresp['logs'][0]['events'][4]['attributes'][0]['value'] runrecipientaddress2 = runresp['logs'][0]['events'][4]['attributes'][3]['value'] amount_distributed = [rundistamount[0], rundistamount[1]] recipient_dispensation_addresses = [runrecipientaddress1, runrecipientaddress2] logging.info(f"dispensation txn addresses = {recipient_dispensation_addresses}") logging.info(f"amount distributed = {amount_distributed}") total_amount_distributed = sum(int(i) for i in amount_distributed) recipient_with_respective_distributed_amount = dict(zip(recipient_dispensation_addresses, amount_distributed)) logging.info(f"recipients and their respective distributed amounts = {recipient_with_respective_distributed_amount}") logging.info(f"total amount distributed = {total_amount_distributed}") claimed_amount_single_recipient = int(recipient_with_respective_distributed_amount[one_claiming_address]) sender_final_balance = int(balance_check(distributor_address, currency)) recipient_address_final_balance = int(balance_check(one_claiming_address, currency)) logging.info(f"sender initial balance = {sender_initial_balance}") logging.info(f"sender final balance = {sender_final_balance}") # BALANCES ASSERTIONS assert int(total_amount_distributed) == int((sender_initial_balance - sender_final_balance) - int(fee)) assert int(claimed_amount_single_recipient) == (recipient_address_final_balance - claiming_address_initial_balance) logging.info(f"balance transferred including fee from sender's address = {(sender_initial_balance - sender_final_balance)}") logging.info(f"total amount distributed = {total_amount_distributed}") logging.info(f"amount claimed by one recipient = {claimed_amount_single_recipient}") logging.info(f"balance transferred in one recipient address = {(recipient_address_final_balance - claiming_address_initial_balance)}") try: os.remove('signed.json') os.remove('sample.json') os.remove('output.json') except OSError as e: print("Error: %s - %s." % (e.filename, e.strerror))
def test_create_online_singlekey_txn(claimType): distributor_address, distributor_name = create_new_sifaddr_and_key() runner_address, runner_name = create_new_sifaddr_and_key() logging.info(f"distributor_address = {distributor_address}, distributor_name = {distributor_name}") logging.info(f"runner_address = {runner_address}, runner_name = {runner_name}") destaddress1, destname1 = create_new_sifaddr_and_key() destaddress2, destname2 = create_new_sifaddr_and_key() from_address = 'sifnodeadmin' keyring_backend = 'test' chain_id = 'localnet' amount = '10000000rowan' sampleamount = '1000rowan' # THESE 4 TXNS ARE TO REGISTER NEW ACCOUNTS ON CHAIN send_sample_rowan(from_address, runner_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, distributor_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress1, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress2, sampleamount, keyring_backend, chain_id, "") time.sleep(5) # CREATING TEST DATA HERE MIMICKING OUTPUT.JSON TO BE SUPPLIED BY NIKO'S API dict1 = {"denom": "rowan", "amount": "5000"} dict2 = {"denom": "rowan", "amount": "7000"} dict3 = {"address": destaddress1, "coins": [dict1]} dict4 = {"address": destaddress2, "coins": [dict2]} dict5 = {"Output": [dict3, dict4]} data = json.dumps(dict5) with open("output.json", "w") as f: f.write(data) # READ OUTPUT.JSON WITH CLAIMING ADDRESSES AND AMOUNT with open("output.json", "r") as f: data = f.read() d = json.loads(data) one_claiming_address = str(d['Output'][0]['address']) logging.info(f"one claiming address = {one_claiming_address}") # ACTUAL DISPENSATION TXN; GET TXN HASH txhash = str((create_online_singlekey_txn_with_runner(claimType, runner_address, distributor_name, chain_id))) logging.info(f"txn hash = {txhash}") time.sleep(5) # QUERY BLOCK USING TXN HASH resp = query_block_claim(txhash) logging.info(f"valid hash response = {resp}") distribution_msg = resp['tx']['body']['messages'][0] msg_type = distribution_msg['@type'] distributor = distribution_msg['distributor'] authorized_runner = distribution_msg['authorized_runner'] distribution_type = distribution_msg['distribution_type'] distribution_msg_keys = list(distribution_msg.keys()) assert distribution_msg_keys[0] == '@type' assert distribution_msg_keys[1] == 'distributor' assert distribution_msg_keys[2] == 'authorized_runner' assert distribution_msg_keys[3] == 'distribution_type' assert str(msg_type) == '/sifnode.dispensation.v1.MsgCreateDistribution' assert str(distributor) == distributor_address assert str(authorized_runner) == runner_address assert str(distribution_type) in ['DISTRIBUTION_TYPE_VALIDATOR_SUBSIDY', 'DISTRIBUTION_TYPE_LIQUIDITY_MINING'] try: os.remove('signed.json') os.remove('sample.json') os.remove('output.json') except OSError as e: print("Error: %s - %s." % (e.filename, e.strerror))
def test_run_online_morethan10distribution_txn(claimType): distributor_address, distributor_name = create_new_sifaddr_and_key() runner_address, runner_name = create_new_sifaddr_and_key() logging.info(f"distributor_address = {distributor_address}, distributor_name = {distributor_name}") logging.info(f"runner_address = {runner_address}, runner_name = {runner_name}") destaddress1, destname1 = create_new_sifaddr_and_key() destaddress2, destname2 = create_new_sifaddr_and_key() destaddress3, destname3 = create_new_sifaddr_and_key() destaddress4, destname4 = create_new_sifaddr_and_key() destaddress5, destname5 = create_new_sifaddr_and_key() destaddress6, destname6 = create_new_sifaddr_and_key() destaddress7, destname7 = create_new_sifaddr_and_key() destaddress8, destname8 = create_new_sifaddr_and_key() destaddress9, destname9 = create_new_sifaddr_and_key() from_address = 'sifnodeadmin' keyring_backend = 'test' chain_id = 'localnet' amount = '100000000rowan' fee = '150000' currency = 'rowan' sampleamount = '1000rowan' # THESE 4 TXNS ARE TO REGISTER NEW ACCOUNTS ON CHAIN send_sample_rowan(from_address, runner_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, distributor_address, amount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress1, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress2, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress3, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress4, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress5, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress6, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress7, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress8, sampleamount, keyring_backend, chain_id, "") time.sleep(5) send_sample_rowan(from_address, destaddress9, sampleamount, keyring_backend, chain_id, "") time.sleep(5) sorted_dest_address_list = sorted([destaddress1, destaddress2, destaddress3, destaddress4, destaddress5, destaddress6, destaddress7, destaddress8, destaddress9]) logging.info(f"sorted_dest_address_list = {sorted_dest_address_list}") # CREATING TEST DATA HERE MIMICKING OUTPUT.JSON TO BE SUPPLIED BY NIKO'S API dict1 = {"denom": "rowan", "amount": "5000"} dict2 = {"denom": "rowan", "amount": "7000"} dict3 = {"denom": "rowan", "amount": "8000"} dict4 = {"denom": "rowan", "amount": "9000"} dict5 = {"denom": "rowan", "amount": "10000"} dict6 = {"denom": "rowan", "amount": "11000"} dict7 = {"denom": "rowan", "amount": "12000"} dict8 = {"denom": "rowan", "amount": "13000"} dict9 = {"denom": "rowan", "amount": "14000"} dict13 = {"address": destaddress1, "coins": [dict1]} dict14 = {"address": destaddress2, "coins": [dict2]} dict15 = {"address": destaddress3, "coins": [dict3]} dict16 = {"address": destaddress4, "coins": [dict4]} dict17 = {"address": destaddress5, "coins": [dict5]} dict18 = {"address": destaddress6, "coins": [dict6]} dict19 = {"address": destaddress7, "coins": [dict7]} dict20 = {"address": destaddress8, "coins": [dict8]} dict21 = {"address": destaddress9, "coins": [dict9]} dict25 = {"Output": [dict13, dict14, dict15, dict16, dict17, dict18, dict19, dict20, dict21]} data = json.dumps(dict25) with open("output.json", "w") as f: f.write(data) # READ OUTPUT.JSON WITH CLAIMING ADDRESSES AND AMOUNT with open("output.json", "r") as f: data = f.read() d = json.loads(data) one_claiming_address = str(d['Output'][0]['address']) logging.info(f"one claiming address = {one_claiming_address}") # SENDER AND RECIPENT INITIAL BALANCE sender_initial_balance = int(balance_check(distributor_address, currency)) claiming_address_initial_balance = int(balance_check(one_claiming_address, currency)) logging.info(f"sender initial balance = {sender_initial_balance}") logging.info(f"one claiming address initial balance = {claiming_address_initial_balance}") # CREATE DISPENSATION TXN; GET TXN HASH txhash = str((create_online_singlekey_txn_with_runner(claimType, runner_address, distributor_name, chain_id))) logging.info(f"txn hash for creatng a dispensation = {txhash}") time.sleep(5) # QUERY BLOCK USING TXN HASH resp = query_block_claim(txhash) distribution_name = resp['logs'][0]['events'][0]['attributes'][1]['value'] distribution_type = resp['logs'][0]['events'][0]['attributes'][2]['value'] logging.info(f"distribution_name = {distribution_name}, distribution_type = {distribution_type}") # RUN DISPENSATION TXN; GET TXN HASH runtxnhash = run_dispensation(distribution_name, claimType, runner_address, chain_id) logging.info(f"txn hash for running dispensation = {runtxnhash}") time.sleep(5) # QUERY BLOCK USING TXN HASH runresp = query_block_claim(runtxnhash) logging.info(f"response from block for run dispensation = {runresp}") rundistributiontag = runresp['logs'][0]['events'][9]['type'] rundistname = runresp['logs'][0]['events'][9]['attributes'][0]['value'] runrunneraddress = runresp['logs'][0]['events'][9]['attributes'][1]['value'] # RUN DISTRIBUTION TXN JSON TAGS ASSERTIONS assert str(rundistributiontag) == 'distribution_run' assert str(rundistname) == distribution_name assert str(runrunneraddress) == runner_address # READING TAGS FROM RUN DISPENSATION CMD temprundistamount1 = runresp['logs'][0]['events'][0]['attributes'][2]['value'] logging.info(f"temp amount distributed 1 = {temprundistamount1}") temprundistamount2 = runresp['logs'][0]['events'][1]['attributes'][2]['value'] logging.info(f"temp amount distributed 2 = {temprundistamount2}") temprundistamount3 = runresp['logs'][0]['events'][2]['attributes'][2]['value'] logging.info(f"temp amount distributed 3 = {temprundistamount3}") temprundistamount4 = runresp['logs'][0]['events'][3]['attributes'][2]['value'] logging.info(f"temp amount distributed 4 = {temprundistamount4}") temprundistamount5 = runresp['logs'][0]['events'][4]['attributes'][2]['value'] logging.info(f"temp amount distributed 5 = {temprundistamount5}") temprundistamount6 = runresp['logs'][0]['events'][5]['attributes'][2]['value'] logging.info(f"temp amount distributed 6 = {temprundistamount6}") temprundistamount7 = runresp['logs'][0]['events'][6]['attributes'][2]['value'] logging.info(f"temp amount distributed 7 = {temprundistamount7}") temprundistamount8 = runresp['logs'][0]['events'][7]['attributes'][2]['value'] logging.info(f"temp amount distributed 8 = {temprundistamount8}") temprundistamount9 = runresp['logs'][0]['events'][8]['attributes'][2]['value'] logging.info(f"temp amount distributed 9 = {temprundistamount9}") my_list = [temprundistamount1, temprundistamount2, temprundistamount3, temprundistamount4, temprundistamount5, temprundistamount6, temprundistamount7, temprundistamount8, temprundistamount9] logging.info(f"my list = {my_list}") rundistamount = [int(i[:-5]) for i in my_list] logging.info(f"temp amount distributed 2 = {rundistamount}") amount_distributed = [rundistamount[0], rundistamount[1], rundistamount[2], rundistamount[3], rundistamount[4], rundistamount[5], rundistamount[6], rundistamount[7], rundistamount[8]] logging.info(f"amount distributed = {amount_distributed}") total_amount_distributed = sum(int(i) for i in amount_distributed) runrecipientaddress1 = runresp['logs'][0]['events'][0]['attributes'][0]['value'] runrecipientaddress2 = runresp['logs'][0]['events'][1]['attributes'][0]['value'] runrecipientaddress3 = runresp['logs'][0]['events'][2]['attributes'][0]['value'] runrecipientaddress4 = runresp['logs'][0]['events'][3]['attributes'][0]['value'] runrecipientaddress5 = runresp['logs'][0]['events'][4]['attributes'][0]['value'] runrecipientaddress6 = runresp['logs'][0]['events'][5]['attributes'][0]['value'] runrecipientaddress7 = runresp['logs'][0]['events'][6]['attributes'][0]['value'] runrecipientaddress8 = runresp['logs'][0]['events'][7]['attributes'][0]['value'] runrecipientaddress9 = runresp['logs'][0]['events'][8]['attributes'][0]['value'] recipient_dispensation_addresses = [runrecipientaddress1, runrecipientaddress2, runrecipientaddress3, runrecipientaddress4, runrecipientaddress5, runrecipientaddress6, runrecipientaddress7, runrecipientaddress8, runrecipientaddress9] logging.info(f"dispensation txn addresses = {recipient_dispensation_addresses}") sortedrundistreceiverlist = sorted(recipient_dispensation_addresses) logging.info(f"sortedrundistreceiverlist = {sortedrundistreceiverlist}") assert sortedrundistreceiverlist[0] == sorted_dest_address_list[0] assert sortedrundistreceiverlist[1] == sorted_dest_address_list[1] assert sortedrundistreceiverlist[2] == sorted_dest_address_list[2] assert sortedrundistreceiverlist[3] == sorted_dest_address_list[3] assert sortedrundistreceiverlist[4] == sorted_dest_address_list[4] assert sortedrundistreceiverlist[5] == sorted_dest_address_list[5] assert sortedrundistreceiverlist[6] == sorted_dest_address_list[6] assert sortedrundistreceiverlist[7] == sorted_dest_address_list[7] assert sortedrundistreceiverlist[8] == sorted_dest_address_list[8] recipient_with_respective_distributed_amount = dict(zip(recipient_dispensation_addresses, amount_distributed)) logging.info(f"recipients and their respective distributed amounts = {recipient_with_respective_distributed_amount}") logging.info(f"total amount distributed = {total_amount_distributed}") claimed_amount_single_recipient = int(recipient_with_respective_distributed_amount[one_claiming_address]) sender_final_balance = int(balance_check(distributor_address, currency)) recipient_address_final_balance = int(balance_check(one_claiming_address, currency)) logging.info(f"sender initial balance = {sender_initial_balance}") logging.info(f"sender final balance = {sender_final_balance}") # BALANCES ASSERTIONS assert int(total_amount_distributed) == int((sender_initial_balance - sender_final_balance) - int(fee)) assert int(claimed_amount_single_recipient) == (recipient_address_final_balance - claiming_address_initial_balance) logging.info(f"balance transferred including fee from sender's address = {(sender_initial_balance - sender_final_balance)}") logging.info(f"total amount distributed = {total_amount_distributed}") logging.info(f"amount claimed by one recipient = {claimed_amount_single_recipient}") logging.info(f"balance transferred in one recipient address = {(recipient_address_final_balance - claiming_address_initial_balance)}")