From 76f0147602992108e7a70c124a7cb80346bf25e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Tue, 21 Jul 2020 16:51:50 +0200 Subject: [PATCH] Change approve token allowance flag from --approve to --allowance Co-authored-by: Derek Pierre --- nucypher/blockchain/eth/agents.py | 2 +- nucypher/cli/commands/deploy.py | 8 ++++---- tests/acceptance/cli/test_deploy.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nucypher/blockchain/eth/agents.py b/nucypher/blockchain/eth/agents.py index 7b1e07a4a..b14610fda 100644 --- a/nucypher/blockchain/eth/agents.py +++ b/nucypher/blockchain/eth/agents.py @@ -170,7 +170,7 @@ class NucypherTokenAgent(EthereumContractAgent): spender_address: ChecksumAddress, increase: NuNits ) -> TxReceipt: - """Increase the allowance from a sender address to a spender address""" + """Increase the allowance of a spender address funded by a sender address""" contract_function: ContractFunction = self.contract.functions.increaseAllowance(spender_address, increase) receipt: TxReceipt = self.blockchain.send_transaction(contract_function=contract_function, sender_address=sender_address) diff --git a/nucypher/cli/commands/deploy.py b/nucypher/cli/commands/deploy.py index cc0c26fe7..486dadb53 100644 --- a/nucypher/cli/commands/deploy.py +++ b/nucypher/cli/commands/deploy.py @@ -530,8 +530,8 @@ def allocations(general_config, actor_options, allocation_infile, gas): @group_actor_options @option_target_address @click.option('--value', help="Amount of tokens to transfer in the smallest denomination", type=click.INT) -@click.option('--approve', help="Approve token allowance, instead of transfer", is_flag=True, default=False) -def transfer_tokens(general_config, actor_options, target_address, value, approve): +@click.option('--allowance', help="Allow target address to spend tokens on behalf of owner", is_flag=True, default=False) +def transfer_tokens(general_config, actor_options, target_address, value, allowance): """Transfer tokens from contract's owner address to another address""" emitter = general_config.emitter @@ -547,7 +547,7 @@ def transfer_tokens(general_config, actor_options, target_address, value, approv value = NU.from_tokens(click.prompt(PROMPT_TOKEN_VALUE, type=stake_value_range)) value = NuNits(int(value)) - if approve: + if allowance: confirmation = CONFIRM_TOKEN_ALLOWANCE.format(value=value, deployer_address=deployer_address, spender_address=target_address) @@ -557,7 +557,7 @@ def transfer_tokens(general_config, actor_options, target_address, value, approv target_address=target_address) click.confirm(confirmation, abort=True) - if approve: + if allowance: receipt = token_agent.approve_transfer(amount=value, sender_address=deployer_address, spender_address=target_address) diff --git a/tests/acceptance/cli/test_deploy.py b/tests/acceptance/cli/test_deploy.py index 47c0ca98d..a1bf175f3 100644 --- a/tests/acceptance/cli/test_deploy.py +++ b/tests/acceptance/cli/test_deploy.py @@ -158,7 +158,7 @@ def test_transfer_tokens(click_runner, registry_filepath, get_random_checksum_ad command = ['transfer-tokens', '--target-address', spender_address, '--value', 42, - '--approve', + '--allowance', '--registry-infile', registry_filepath, '--provider', TEST_PROVIDER_URI]