Compare commits

..

No commits in common. "master" and "86946b4c38323547c6fbbafb8b09c62d9fee7bc5" have entirely different histories.

12 changed files with 94 additions and 123 deletions

View File

@ -20,8 +20,7 @@ steps:
path: /var/run/docker.sock
commands:
- echo $PASSWORD | docker login docker.grassecon.net --username ci --password-stdin
- export TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
- docker-compose -f docker-compose.build.yml build --progress plain
- TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) docker-compose -f docker-compose.build.yml build --progress plain
- docker-compose -f docker-compose.build.yml push
volumes:
- name: docker_sock

View File

@ -26,7 +26,6 @@ from chainlib.chain import ChainSpec
from chainqueue.db.models.otx import Otx
from cic_eth_registry.error import UnknownContractError
from cic_eth_registry.erc20 import ERC20Token
from cic_eth.eth.util import MAXIMUM_FEE_UNITS
from hexathon import add_0x
import liveness.linux
@ -233,7 +232,6 @@ def main():
if config.get('ETH_MIN_FEE_PRICE'):
BaseTask.min_fee_price = int(config.get('ETH_MIN_FEE_PRICE'))
CriticalWeb3Task.safe_gas_threshold_amount *= BaseTask.min_fee_price
CriticalWeb3Task.safe_gas_refill_amount = CriticalWeb3Task.safe_gas_refill_amount + MAXIMUM_FEE_UNITS
CriticalWeb3Task.safe_gas_refill_amount *= BaseTask.min_fee_price
CriticalWeb3Task.safe_gas_gifter_balance *= BaseTask.min_fee_price

View File

@ -12,4 +12,4 @@ erc20-faucet~=0.3.2
erc20-transfer-authorization~=0.3.6
sarafu-faucet~=0.0.7
moolb~=0.2.0
okota~=0.2.6
okota~=0.2.5

View File

@ -66,15 +66,14 @@ def parse_statement_transactions(statement: list):
:rtype:
"""
parsed_transactions = []
statement.sort(key=lambda d: d['timestamp'], reverse=True)
for transaction in statement:
action_tag = transaction.get('action_tag')
decimals = transaction.get('token_decimals')
amount = from_wei(decimals, transaction.get('token_value'))
direction_tag = transaction.get('direction_tag')
token_symbol = transaction.get('token_symbol')
metadata_id = transaction.get('alt_metadata_id')
timestamp = transaction.get('timestamp')
metadata_id = transaction.get('metadata_id')
timestamp = datetime.datetime.now().strftime('%d/%m/%y, %H:%M')
transaction_repr = f'{action_tag} {amount} {token_symbol} {direction_tag} {metadata_id} {timestamp}'
parsed_transactions.append(transaction_repr)
return parsed_transactions

View File

@ -265,9 +265,8 @@ def process_token_data(blockchain_address: str, token_symbol: str):
query_token_metadata(identifier=identifier)
token_info = query_token_info(identifier=identifier)
hashed_token_info = hashed_token_proof(token_proof=token_info)
hashed_token_symbol = hashed_token_proof(token_symbol)
query_token_data(blockchain_address=blockchain_address,
hashed_proofs=[[hashed_token_info, hashed_token_symbol]],
hashed_proofs=[hashed_token_info],
token_symbols=[token_symbol])

View File

@ -2,7 +2,7 @@
import json
import logging
from datetime import datetime, timedelta
from datetime import timedelta
# external imports
import celery
@ -143,11 +143,9 @@ def statement_callback(self, result, param: str, status_code: int):
recipient_transaction, sender_transaction = transaction_actors(transaction)
if recipient_transaction.get('blockchain_address') == param:
recipient_transaction['alt_blockchain_address'] = sender_transaction.get('blockchain_address')
recipient_transaction['timestamp'] = datetime.utcfromtimestamp(transaction.get('timestamp')).strftime('%d/%m/%y, %H:%M')
generate(param, queue, recipient_transaction)
if sender_transaction.get('blockchain_address') == param:
sender_transaction['alt_blockchain_address'] = recipient_transaction.get('blockchain_address')
sender_transaction['timestamp'] = datetime.utcfromtimestamp(transaction.get('timestamp')).strftime('%d/%m/%y, %H:%M')
generate(param, queue, sender_transaction)
@ -233,10 +231,6 @@ def transaction_callback(result: dict, param: str, status_code: int):
if status_code != 0:
raise ValueError(f'Unexpected status code: {status_code}.')
print(f'THE RETURNING TRANSACTION IS: {result}')
print(f'STATUS CODE: {status_code}')
print(f'WITH PARAM: {param}')
chain_str = Chain.spec.__str__()
destination_token_symbol = result.get('destination_token_symbol')
destination_token_value = result.get('destination_token_value')

View File

@ -1,5 +1,4 @@
# standard imports
import datetime
import json
# external imports
@ -120,11 +119,8 @@ def test_statement_callback(activated_account, mocker, transactions_list):
[transactions_list, activated_account.blockchain_address, status_code])
s_statement_callback.apply_async().get()
statement_transactions = filter_statement_transactions(transactions_list)
timestamp = transactions_list[0].get('timestamp')
timestamp = datetime.datetime.utcfromtimestamp(timestamp).strftime('%d/%m/%y, %H:%M')
recipient_transaction, sender_transaction = transaction_actors(statement_transactions[0])
sender_transaction['alt_blockchain_address'] = recipient_transaction.get('blockchain_address')
sender_transaction['timestamp'] = timestamp
mock_statement_generate.assert_called_with(
(activated_account.blockchain_address, sender_transaction), {}, queue='cic-ussd')

View File

@ -1,5 +1,6 @@
# standard import
from datetime import datetime
import random
# external import
import pytest
@ -45,7 +46,6 @@ def statement(activated_account):
'direction_tag': 'To',
'metadata_id': activated_account.standard_metadata_id(),
'phone_number': activated_account.phone_number,
'timestamp': datetime.now().strftime('%d/%m/%y, %H:%M')
}
]

View File

@ -3,7 +3,7 @@
"trigger": "scan_data",
"source": "first_transaction_set",
"dest": "middle_transaction_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected"
"conditions": "cic_ussd.state_machine.logic.menu.menu_one_selected"
},
{
"trigger": "scan_data",
@ -20,13 +20,13 @@
"trigger": "scan_data",
"source": "middle_transaction_set",
"dest": "last_transaction_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected"
"conditions": "cic_ussd.state_machine.logic.menu.menu_one_selected"
},
{
"trigger": "scan_data",
"source": "middle_transaction_set",
"dest": "first_transaction_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
"conditions": "cic_ussd.state_machine.logic.menu.menu_two_selected"
},
{
"trigger": "scan_data",
@ -43,7 +43,7 @@
"trigger": "scan_data",
"source": "last_transaction_set",
"dest": "middle_transaction_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
"conditions": "cic_ussd.state_machine.logic.menu.menu_two_selected"
},
{
"trigger": "scan_data",

View File

@ -6,13 +6,6 @@
"after": "cic_ussd.state_machine.logic.account.process_account_creation",
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_language_selection",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless":"cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_language_selection",
@ -23,20 +16,15 @@
{
"trigger": "scan_data",
"source": "initial_language_selection",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "initial_middle_language_set",
"dest": "account_creation_prompt",
"after": "cic_ussd.state_machine.logic.account.process_account_creation",
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_middle_language_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless":"cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_middle_language_set",
"dest": "initial_language_selection",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
@ -49,25 +37,6 @@
{
"trigger": "scan_data",
"source": "initial_middle_language_set",
"dest": "initial_language_selection",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_middle_language_set",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "initial_last_language_set",
"dest": "account_creation_prompt",
"after": "cic_ussd.state_machine.logic.account.process_account_creation",
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_last_language_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
@ -82,22 +51,39 @@
{
"trigger": "scan_data",
"source": "initial_last_language_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_middle_language_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "initial_language_selection",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "middle_language_set",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "last_language_set",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "select_preferred_language",
"dest": "complete",
"dest": "exit",
"after": "cic_ussd.state_machine.logic.language.change_preferred_language",
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "select_preferred_language",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless":"cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "select_preferred_language",
@ -108,29 +94,10 @@
{
"trigger": "scan_data",
"source": "select_preferred_language",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "middle_language_set",
"dest": "complete",
"after": "cic_ussd.state_machine.logic.language.change_preferred_language",
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "middle_language_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "middle_language_set",
"dest": "last_language_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "middle_language_set",
@ -141,14 +108,23 @@
{
"trigger": "scan_data",
"source": "middle_language_set",
"dest": "exit_invalid_menu_option"
"dest": "last_language_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_eleven_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "middle_language_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "last_language_set",
"dest": "complete",
"after": "cic_ussd.state_machine.logic.language.change_preferred_language",
"conditions": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
"dest": "middle_language_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
@ -159,11 +135,21 @@
},
{
"trigger": "scan_data",
"source": "last_language_set",
"dest": "middle_language_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected",
"source": "middle_language_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected",
"unless": "cic_ussd.state_machine.logic.language.is_valid_language_selection"
},
{
"trigger": "scan_data",
"source": "select_preferred_language",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "middle_language_set",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
"source": "last_language_set",

View File

@ -1,17 +1,4 @@
[
{
"trigger": "scan_data",
"source": "first_account_tokens_set",
"dest": "token_selection_pin_authorization",
"conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection",
"after": "cic_ussd.state_machine.logic.tokens.process_token_selection"
},
{
"trigger": "scan_data",
"source": "first_account_tokens_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
},
{
"trigger": "scan_data",
"source": "first_account_tokens_set",
@ -21,20 +8,20 @@
{
"trigger": "scan_data",
"source": "first_account_tokens_set",
"dest": "exit_invalid_menu_option"
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
},
{
"trigger": "scan_data",
"source": "middle_account_tokens_set",
"source": "first_account_tokens_set",
"dest": "token_selection_pin_authorization",
"conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection",
"after": "cic_ussd.state_machine.logic.tokens.process_token_selection"
},
{
"trigger": "scan_data",
"source": "middle_account_tokens_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
"source": "first_account_tokens_set",
"dest": "exit_invalid_menu_option"
},
{
"trigger": "scan_data",
@ -48,6 +35,19 @@
"dest": "first_account_tokens_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
},
{
"trigger": "scan_data",
"source": "middle_account_tokens_set",
"dest": "exit",
"conditions": "cic_ussd.state_machine.logic.menu.menu_zero_zero_selected"
},
{
"trigger": "scan_data",
"source": "middle_account_tokens_set",
"dest": "token_selection_pin_authorization",
"conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection",
"after": "cic_ussd.state_machine.logic.tokens.process_token_selection"
},
{
"trigger": "scan_data",
"source": "middle_account_tokens_set",
@ -56,9 +56,8 @@
{
"trigger": "scan_data",
"source": "last_account_tokens_set",
"dest": "token_selection_pin_authorization",
"conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection",
"after": "cic_ussd.state_machine.logic.tokens.process_token_selection"
"dest": "middle_account_tokens_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
},
{
"trigger": "scan_data",
@ -69,8 +68,9 @@
{
"trigger": "scan_data",
"source": "last_account_tokens_set",
"dest": "middle_account_tokens_set",
"conditions": "cic_ussd.state_machine.logic.menu.menu_twenty_two_selected"
"dest": "token_selection_pin_authorization",
"conditions": "cic_ussd.state_machine.logic.tokens.is_valid_token_selection",
"after": "cic_ussd.state_machine.logic.tokens.process_token_selection"
},
{
"trigger": "scan_data",

View File

@ -9,4 +9,4 @@ erc20-faucet==0.3.2
sarafu-faucet==0.0.7
confini~=0.5.3
eth-token-index==0.2.4
okota==0.2.6
okota==0.2.5a1