Skip to content

Commit 823b6ad

Browse files
committed
Drop --value option from build erc20-call
None of the ERC-20 functions are payable, so this option makes no sense in this context.
1 parent c8ab382 commit 823b6ad

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/simple_safe/params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class OptionInfo:
5252
args: Iterable[str]
5353
help: str
5454
# defaults should match click.Option
55+
default: Optional[Any] = None
5556
metavar: Optional[str] = None
5657
type: Optional[Union[click.types.ParamType, Any]] = None
5758

@@ -78,6 +79,13 @@ def make_option(
7879
)
7980

8081

82+
value_option_info = OptionInfo(
83+
args=["--value"],
84+
default="0.0",
85+
help="tx value in decimals",
86+
)
87+
88+
8189
# ┌─────────┐
8290
# │ Options │
8391
# └─────────┘
@@ -110,7 +118,6 @@ def authentication(f: FC) -> FC:
110118
def build_safetx(f: FC) -> FC:
111119
for option in reversed(
112120
[
113-
click.option("--value", default="0.0", help="tx value in decimals"),
114121
optgroup.group("Build online"),
115122
rpc(optgroup.option),
116123
optgroup.group("Build offline"),

src/simple_safe/safe.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ def build():
189189
required=True,
190190
help="contract call address",
191191
)
192+
@params.make_option(
193+
params.value_option_info,
194+
)
192195
@params.build_safetx
193196
@params.safe_operation
194197
@params.safe_address
@@ -247,6 +250,9 @@ def build_abi_call(
247250
@click.option(
248251
"--to", "to_str", metavar="ADDRESS", required=True, help="destination address"
249252
)
253+
@params.make_option(
254+
params.value_option_info,
255+
)
250256
@click.option("--data", default="0x", help="call data payload")
251257
@params.build_safetx
252258
@params.safe_operation
@@ -324,7 +330,6 @@ def build_erc20_call(
324330
safe_version: Optional[str],
325331
str_args: list[str],
326332
token_str: str,
327-
value: str,
328333
) -> None:
329334
"""Build an ERC-20 token Safe transaction.
330335
@@ -345,21 +350,23 @@ def build_erc20_call(
345350
)
346351
token_address = to_checksum_address(token_str)
347352
ERC20 = get_erc20_contract(w3, address=token_address)
348-
validate_safetx_value(value)
349353
build_contract_call_safetx(
350354
w3=w3,
351355
contract=ERC20,
352356
fn_identifier=function,
353357
str_args=str_args,
354358
safe=safe,
355-
value=value,
359+
value="0",
356360
operation=SafeOperation.CALL.value,
357361
output=output,
358362
pretty=pretty,
359363
)
360364

361365

362366
@build.command(name="safe-call")
367+
@params.make_option(
368+
params.value_option_info,
369+
)
363370
@params.safe_address
364371
@params.build_safetx
365372
@params.output_file

0 commit comments

Comments
 (0)