Compare commits
16 Commits
lash/cache
...
lash/rehab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15552f234d
|
||
|
|
01333fceb1
|
||
|
|
a5ca898532 | ||
|
|
6d8508aebf | ||
|
|
f8f66984d2 | ||
|
|
0f02dd1b7c | ||
| 63a4a82ab0 | |||
|
949c1070a9
|
|||
| 5d9fbe9b64 | |||
| 873a3f082a | |||
| 7b408cf564 | |||
|
|
9dfbd7034c | ||
|
|
235f5cede8 | ||
|
|
0a59539f9a | ||
|
|
60b36945df | ||
| f2c955c60b |
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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))
|
||||||
|
|
||||||
|
|||||||
@@ -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))
|
||||||
|
|
||||||
|
|||||||
@@ -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__':
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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))
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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: |-
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user