Compare commits

..

16 Commits

Author SHA1 Message Date
nolash
15552f234d Unskip transfer callback tests 2021-05-19 14:50:48 +02:00
nolash
01333fceb1 Fix outdated module names in cic-eth tests 2021-05-19 14:22:56 +02:00
Louis Holbrook
a5ca898532 Merge branch 'lash/update-contracts-in-migration-2' into 'master'
imports: Fix stale dep in sovereign import users script

See merge request grassrootseconomics/cic-internal-integration!149
2021-05-19 09:57:03 +00:00
Louis Holbrook
6d8508aebf imports: Fix stale dep in sovereign import users script 2021-05-19 09:57:02 +00:00
Louis Holbrook
f8f66984d2 Merge branch 'lash/no-ussd-contamination' into 'master'
Isolate ussd-related data files in imports

See merge request grassrootseconomics/cic-internal-integration!150
2021-05-19 09:55:24 +00:00
Louis Holbrook
0f02dd1b7c Isolate ussd-related data files in imports 2021-05-19 09:55:24 +00:00
63a4a82ab0 Merge branch 'philip/replicate-wills-changes' into 'master'
Replicates changes in broken MR by will.

See merge request grassrootseconomics/cic-internal-integration!158
2021-05-19 08:25:19 +00:00
949c1070a9 Replicates changes in broken MR by will. 2021-05-19 11:19:29 +03:00
5d9fbe9b64 Merge branch 'willruddick-master-patch-28332' into 'master'
shortened and changed service code

See merge request grassrootseconomics/cic-internal-integration!152
2021-05-19 07:47:09 +00:00
873a3f082a shortened and changed service code 2021-05-19 07:47:09 +00:00
7b408cf564 Merge branch 'willruddick-master-patch-28450' into 'master'
small changes, note the 'other' gender

See merge request grassrootseconomics/cic-internal-integration!151
2021-05-19 07:33:37 +00:00
Louis Holbrook
9dfbd7034c Merge branch 'lash/decimals-in-api' into 'master'
cic-eth-tasker: Add decimals and token name to default token api call return struct

Closes cic-eth#123

See merge request grassrootseconomics/cic-internal-integration!148
2021-05-19 06:59:43 +00:00
Louis Holbrook
235f5cede8 cic-eth-tasker: Add decimals and token name to default token api call return struct 2021-05-19 06:59:42 +00:00
Geoff Turk
0a59539f9a Merge branch 'lash/cache-data-api' into 'master'
cic-cache: Add data API

Closes cic-cache#11

See merge request grassrootseconomics/cic-internal-integration!157
2021-05-18 17:13:57 +00:00
Louis Holbrook
60b36945df cic-cache: Add data API 2021-05-18 17:13:57 +00:00
f2c955c60b small changes, note the 'other' gender 2021-05-17 11:06:10 +00:00
18 changed files with 52 additions and 35 deletions

View File

@@ -16,4 +16,6 @@ def default_token(self):
return { return {
'symbol': self.default_token_symbol, 'symbol': self.default_token_symbol,
'address': self.default_token_address, 'address': self.default_token_address,
'name': self.default_token_name,
'decimals': self.default_token_decimals,
} }

View File

@@ -72,7 +72,9 @@ class CallbackFilter(SyncFilter):
#transfer_data['token_address'] = tx.inputs[0] #transfer_data['token_address'] = tx.inputs[0]
faucet_contract = tx.inputs[0] faucet_contract = tx.inputs[0]
o = Faucet.token(faucet_contract, sender_address=self.caller_address) c = Faucet(self.chain_spec)
o = c.token(faucet_contract, sender_address=self.caller_address)
r = conn.do(o) r = conn.do(o)
transfer_data['token_address'] = add_0x(c.parse_token(r)) transfer_data['token_address'] = add_0x(c.parse_token(r))

View File

@@ -22,6 +22,7 @@ from chainlib.eth.connection import (
from chainlib.chain import ChainSpec from chainlib.chain import ChainSpec
from chainqueue.db.models.otx import Otx from chainqueue.db.models.otx import Otx
from cic_eth_registry.error import UnknownContractError from cic_eth_registry.error import UnknownContractError
from cic_eth_registry.erc20 import ERC20Token
import liveness.linux import liveness.linux
@@ -207,6 +208,11 @@ def main():
BaseTask.default_token_symbol = config.get('CIC_DEFAULT_TOKEN_SYMBOL') BaseTask.default_token_symbol = config.get('CIC_DEFAULT_TOKEN_SYMBOL')
BaseTask.default_token_address = registry.by_name(BaseTask.default_token_symbol) BaseTask.default_token_address = registry.by_name(BaseTask.default_token_symbol)
default_token = ERC20Token(chain_spec, rpc, BaseTask.default_token_address)
default_token.load(rpc)
BaseTask.default_token_decimals = default_token.decimals
BaseTask.default_token_name = default_token.name
BaseTask.run_dir = config.get('CIC_RUN_DIR') BaseTask.run_dir = config.get('CIC_RUN_DIR')
logg.info('default token set to {} {}'.format(BaseTask.default_token_symbol, BaseTask.default_token_address)) logg.info('default token set to {} {}'.format(BaseTask.default_token_symbol, BaseTask.default_token_address))

View File

@@ -67,6 +67,8 @@ def main():
token_info = t.get() token_info = t.get()
print('Default token symbol: {}'.format(token_info['symbol'])) print('Default token symbol: {}'.format(token_info['symbol']))
print('Default token address: {}'.format(token_info['address'])) print('Default token address: {}'.format(token_info['address']))
logg.debug('Default token name: {}'.format(token_info['name']))
logg.debug('Default token decimals: {}'.format(token_info['decimals']))
if __name__ == '__main__': if __name__ == '__main__':

View File

@@ -33,6 +33,8 @@ class BaseTask(celery.Task):
create_gas_oracle = RPCGasOracle create_gas_oracle = RPCGasOracle
default_token_address = None default_token_address = None
default_token_symbol = None default_token_symbol = None
default_token_name = None
default_token_decimals = None
run_dir = '/run' run_dir = '/run'
def create_session(self): def create_session(self):

View File

@@ -4,7 +4,7 @@ import sys
import logging import logging
# external imports # external imports
from chainlib.eth.erc20 import ERC20 from eth_erc20 import ERC20
# local imports # local imports
from cic_eth.api import Api from cic_eth.api import Api

View File

@@ -14,9 +14,9 @@ from chainlib.eth.tx import (
Tx, Tx,
) )
from chainlib.eth.block import Block from chainlib.eth.block import Block
from chainlib.eth.erc20 import ERC20 from eth_erc20 import ERC20
from sarafu_faucet import MinterFaucet from sarafu_faucet import MinterFaucet
from eth_accounts_index import AccountRegistry from eth_accounts_index.registry import AccountRegistry
from potaahto.symbols import snake_and_camel from potaahto.symbols import snake_and_camel
from hexathon import add_0x from hexathon import add_0x
@@ -26,7 +26,6 @@ from cic_eth.runnable.daemons.filters.callback import CallbackFilter
logg = logging.getLogger() logg = logging.getLogger()
@pytest.mark.skip()
def test_transfer_tx( def test_transfer_tx(
default_chain_spec, default_chain_spec,
init_database, init_database,
@@ -66,7 +65,6 @@ def test_transfer_tx(
assert transfer_type == 'transfer' assert transfer_type == 'transfer'
@pytest.mark.skip()
def test_transfer_from_tx( def test_transfer_from_tx(
default_chain_spec, default_chain_spec,
init_database, init_database,

View File

@@ -4,7 +4,7 @@ import logging
# external imports # external imports
import pytest import pytest
from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.nonce import RPCNonceOracle
from chainlib.eth.erc20 import ERC20 from eth_erc20 import ERC20
from chainlib.eth.tx import receipt from chainlib.eth.tx import receipt
# local imports # local imports

View File

@@ -9,7 +9,7 @@ import celery
from chainlib.connection import RPCConnection from chainlib.connection import RPCConnection
from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.nonce import RPCNonceOracle
from chainlib.eth.tx import receipt from chainlib.eth.tx import receipt
from eth_accounts_index import AccountRegistry from eth_accounts_index.registry import AccountRegistry
from hexathon import strip_0x from hexathon import strip_0x
from chainqueue.db.enum import StatusEnum from chainqueue.db.enum import StatusEnum
from chainqueue.db.models.otx import Otx from chainqueue.db.models.otx import Otx

View File

@@ -4,7 +4,7 @@ import logging
# external imports # external imports
import pytest import pytest
import celery import celery
from chainlib.eth.erc20 import ERC20 from eth_erc20 import ERC20
from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.nonce import RPCNonceOracle
from chainlib.eth.tx import ( from chainlib.eth.tx import (
receipt, receipt,

View File

@@ -3,7 +3,7 @@ from chainlib.eth.nonce import RPCNonceOracle
from chainlib.eth.tx import ( from chainlib.eth.tx import (
receipt, receipt,
) )
from eth_address_declarator import AddressDeclarator from eth_address_declarator import Declarator
from hexathon import add_0x from hexathon import add_0x
# local imports # local imports
@@ -23,7 +23,7 @@ def test_translate(
nonce_oracle = RPCNonceOracle(contract_roles['CONTRACT_DEPLOYER'], eth_rpc) nonce_oracle = RPCNonceOracle(contract_roles['CONTRACT_DEPLOYER'], eth_rpc)
c = AddressDeclarator(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle) c = Declarator(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle)
description = 'alice'.encode('utf-8').ljust(32, b'\x00').hex() description = 'alice'.encode('utf-8').ljust(32, b'\x00').hex()
(tx_hash_hex, o) = c.add_declaration(address_declarator, contract_roles['CONTRACT_DEPLOYER'], agent_roles['ALICE'], add_0x(description)) (tx_hash_hex, o) = c.add_declaration(address_declarator, contract_roles['CONTRACT_DEPLOYER'], agent_roles['ALICE'], add_0x(description))

View File

@@ -8,7 +8,7 @@ from chainlib.eth.tx import (
count, count,
receipt, receipt,
) )
from chainlib.eth.erc20 import ERC20 from eth_erc20 import ERC20
from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.nonce import RPCNonceOracle
# local imports # local imports

View File

@@ -1,7 +1,7 @@
en: en:
account_successfully_created: |- account_successfully_created: |-
Hello, you have been registered on Sarafu Network! Your balance is %{balance} %{token_symbol}. To use dial *483*46#. For help 0757628885. You have been registered on Sarafu Network! To use dial *384*96# on Safaricom and *483*96# on other networks. For help %{support_phone}.
received_tokens: |- received_tokens: |-
Successfully received %{amount} %{token_symbol} from %{tx_sender_information} %{timestamp}. New balance is %{balance} %{token_symbol}. Successfully received %{amount} %{token_symbol} from %{tx_sender_information} %{timestamp}. New balance is %{balance} %{token_symbol}.
terms: |- terms: |-
By using the service, you agree to the terms and conditions at https://www.grassrootseconomics.org/terms-and-conditions. By using the service, you agree to the terms and conditions at http://grassecon.org/tos

View File

@@ -1,7 +1,7 @@
sw: sw:
account_successfully_created: |- account_successfully_created: |-
Habari, umesajiliwa kwa huduma ya sarafu! Salio lako ni %{token_symbol} %{balance}. Kutumia bonyeza *483*46#. Kwa Usaidizi 0757628885. Umesajiliwa kwa huduma ya Sarafu! Kutumia bonyeza *384*96# Safaricom ama *483*46# kwa utandao tofauti. Kwa Usaidizi %{support_phone}.
received_tokens: |- received_tokens: |-
Umepokea %{amount} %{token_symbol} kutoka kwa %{tx_sender_information} %{timestamp}. Salio la %{token_symbol} ni %{balance}. Umepokea %{amount} %{token_symbol} kutoka kwa %{tx_sender_information} %{timestamp}. Salio la %{token_symbol} ni %{balance}.
terms: |- terms: |-
Kwa kutumia hii huduma, umekubali sheria na masharti yafuatayo https://www.grassrootseconomics.org/terms-and-conditions. Kwa kutumia hii huduma, umekubali sheria na masharti yafuatayo http://grassecon.org/tos

View File

@@ -1,29 +1,30 @@
en: en:
kenya: kenya:
initial_language_selection: |- initial_language_selection: |-
CON Welcome to Sarafu CON Welcome to Sarafu Network
1. English 1. English
2. Kiswahili 2. Kiswahili
3. Help 3. Help
initial_pin_entry: |- initial_pin_entry: |-
CON Please enter a PIN to manage your account. CON Please enter a new four number PIN for your account.
0. Back 0. Back
initial_pin_confirmation: |- initial_pin_confirmation: |-
CON Enter your PIN again CON Enter your four number PIN again
0. Back 0. Back
enter_given_name: |- enter_given_name: |-
CON Enter first name CON Enter first name
0. Back 0. Back
enter_family_name: |- enter_family_name: |-
CON Enter last name CON Enter family name
0. Back 0. Back
enter_gender: |- enter_gender: |-
CON Enter gender CON Enter gender
1. Male 1. Male
2. Female 2. Female
3. Other
0. Back 0. Back
enter_location: |- enter_location: |-
CON Enter location CON Enter your location
0. Back 0. Back
enter_products: |- enter_products: |-
CON Please enter a product or service you offer CON Please enter a product or service you offer
@@ -83,34 +84,34 @@ en:
Please enter your PIN to confirm. Please enter your PIN to confirm.
0. Back 0. Back
retry: |- retry: |-
CON Please enter your PIN. You have %{remaining_attempts} attempts remaining. CON Please enter your PIN. You have %{remaining_attempts} attempts remaining
0. Back 0. Back
display_metadata_pin_authorization: display_metadata_pin_authorization:
first: |- first: |-
CON Please enter your PIN. CON Please enter your PIN
0. Back 0. Back
retry: |- retry: |-
CON Please enter your PIN. You have %{remaining_attempts} attempts remaining. CON Please enter your PIN. You have %{remaining_attempts} attempts remaining
0. Back 0. Back
account_balances_pin_authorization: account_balances_pin_authorization:
first: |- first: |-
CON Please enter your PIN to view balances. CON Please enter your PIN to view balances
0. Back 0. Back
retry: |- retry: |-
CON Please enter your PIN. You have %{remaining_attempts} attempts remaining. CON Please enter your PIN. You have %{remaining_attempts} attempts remaining
0. Back 0. Back
account_statement_pin_authorization: account_statement_pin_authorization:
first: |- first: |-
CON Please enter your PIN to view statement. CON Please enter your PIN to view statement
0. Back 0. Back
retry: |- retry: |-
CON Please enter your PIN. You have %{remaining_attempts} attempts remaining. CON Please enter your PIN. You have %{remaining_attempts} attempts remaining
0. Back 0. Back
account_balances: |- account_balances: |-
CON Your balances are as follows: CON Your balances are as follows:
balance: %{operational_balance} %{token_symbol} balance: %{operational_balance} %{token_symbol}
taxes: %{tax} %{token_symbol} fees: %{tax} %{token_symbol}
bonsuses: %{bonus} %{token_symbol} rewards: %{bonus} %{token_symbol}
0. Back 0. Back
first_transaction_set: |- first_transaction_set: |-
CON %{first_transaction_set} CON %{first_transaction_set}
@@ -140,9 +141,9 @@ en:
exit_pin_blocked: |- exit_pin_blocked: |-
END Your PIN has been blocked. For help, please call %{support_phone}. END Your PIN has been blocked. For help, please call %{support_phone}.
exit_invalid_pin: |- exit_invalid_pin: |-
END The PIN you have entered is Invalid. PIN must consist of 4 digits. For help, call %{support_phone}. END The PIN you have entered is invalid. PIN must consist of 4 digits. For help, call %{support_phone}.
exit_invalid_new_pin: |- exit_invalid_new_pin: |-
END The PIN you have entered is Invalid. PIN must be different from your current PIN. For help, call %{support_phone}. END The PIN you have entered is invalid. PIN must be different from your current PIN. For help, call %{support_phone}.
exit_pin_mismatch: |- exit_pin_mismatch: |-
END The new PIN does not match the one you entered. Please try again. For help, call %{support_phone}. END The new PIN does not match the one you entered. Please try again. For help, call %{support_phone}.
exit_invalid_recipient: |- exit_invalid_recipient: |-

View File

@@ -171,6 +171,7 @@ if __name__ == '__main__':
logg.error('load error for {}: {}'.format(y, e)) logg.error('load error for {}: {}'.format(y, e))
continue continue
f.close() f.close()
logg.debug('deserializing {} {}'.format(filepath, o))
u = Person.deserialize(o) u = Person.deserialize(o)
new_address = register_eth(i, u) new_address = register_eth(i, u)

View File

@@ -105,7 +105,7 @@ def genId(addr, typ):
def genDate(): def genDate():
ts = random.randint(ts_then, ts_now) ts = random.randint(ts_then, ts_now)
return datetime.datetime.fromtimestamp(ts).timestamp() return int(datetime.datetime.fromtimestamp(ts).timestamp())
def genPhone(): def genPhone():
@@ -193,6 +193,7 @@ def prepareLocalFilePath(datadir, address):
if __name__ == '__main__': if __name__ == '__main__':
base_dir = os.path.join(user_dir, 'old') base_dir = os.path.join(user_dir, 'old')
ussd_dir = os.path.join(user_dir, 'ussd')
os.makedirs(base_dir, exist_ok=True) os.makedirs(base_dir, exist_ok=True)
fa = open(os.path.join(user_dir, 'balances.csv'), 'w') fa = open(os.path.join(user_dir, 'balances.csv'), 'w')
@@ -223,6 +224,8 @@ if __name__ == '__main__':
f = open('{}/{}'.format(d, uid + '.json'), 'w') f = open('{}/{}'.format(d, uid + '.json'), 'w')
json.dump(o.serialize(), f) json.dump(o.serialize(), f)
f.close() f.close()
d = prepareLocalFilePath(ussd_dir, uid)
x = open('{}/{}'.format(d, uid + '_ussd_data.json'), 'w') x = open('{}/{}'.format(d, uid + '_ussd_data.json'), 'w')
json.dump(ussd_data, x) json.dump(ussd_data, x)
x.close() x.close()

View File

@@ -23,7 +23,7 @@ from chainlib.eth.connection import EthHTTPConnection
from chainlib.eth.gas import RPCGasOracle from chainlib.eth.gas import RPCGasOracle
from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.nonce import RPCNonceOracle
from cic_types.processor import generate_metadata_pointer from cic_types.processor import generate_metadata_pointer
from eth_accounts_index import AccountRegistry from eth_accounts_index.registry import AccountRegistry
from eth_contract_registry import Registry from eth_contract_registry import Registry
from crypto_dev_signer.keystore.dict import DictKeystore from crypto_dev_signer.keystore.dict import DictKeystore
from crypto_dev_signer.eth.signer.defaultsigner import ReferenceSigner as EIP155Signer from crypto_dev_signer.eth.signer.defaultsigner import ReferenceSigner as EIP155Signer