Change approve token allowance flag from --approve to --allowance

Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
pull/2149/head
David Núñez 2020-07-21 16:51:50 +02:00
parent bd8692d6a4
commit 76f0147602
3 changed files with 6 additions and 6 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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]