async def start(msg: types.Message): if not User.user_exists(msg.from_user.id): User.create_user(msg) await msg.answer(texts['start']['new_user'], reply_markup=kb.main_kb_start) elif User.user_is_approved(msg.from_user.id): await msg.answer('Welcome back', reply_markup=kb.main_kb_approve) else: await msg.answer(texts['start']['new_user'], reply_markup=kb.main_kb_start) if not User.eth_address_exist(user_id=msg.from_user.id): await msg.answer(texts['eth_address']['request']) await EthereumAddress.get_address.set()
async def change_address(msg: types.Message, state: FSMContext): if validate_ethereum_address(msg.text): if User.eth_address_unical(msg.text): if User.eth_address_exist(msg.from_user.id): User.set_eth_address(msg.from_user.id, msg.text) await msg.answer(texts['eth_address']['address_change_success']) if not User.user_is_approved(msg.from_user.id): await msg.answer(texts['eth_address']['approve_address'].format( config.ENTRY_COST, config.TARGET_EPH_ADDRESS ), reply_markup=kb.check_transaction_kb) await state.finish() else: await msg.answer(texts['eth_address']['address_decline']) else: await msg.answer(texts['eth_address']['address_decline']) else: await msg.answer(texts['eth_address']['address_decline'])