#Approve function from token contract example returns INVALID ACCTION

1 messages · Page 1 of 1 (latest)

eager comet
#

This is is the diagnostic:

stellar contract invoke --source alice --network testnet --id CAGD3K7Q3PHL632X4QEXZSQMXALUI7JWUPFCWKG5RHJZ7HDTL5N6AMOI -- approve --spender GAHS53PD4WOGOSOAIQVWZIKVEXLD5S74AYUGJFYV2J4FQW7CWVYIRWHL --from alice --expiration_ledger 100 --amount 20244

#

2024-09-17T10:30:49.468670Z ERROR stellar_rpc_client::log::diagnostic_events: 0: "AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgDD2r8NvOv29X5Al8ygy4F0R9NqPKKyjdidOfnHNfW+AAAAAPAAAAB2FwcHJvdmUAAAAAEAAAAAEAAAAEAAAAEgAAAAAAAAAANiAfycjXx5gZ1O8RXFa6E3ZScrCUVqrJM4z/sYBAhRcAAAASAAAAAAAAAAAPLu3j5ZxnScBEK2yhVSXWPsv8BihklxXSeFhb4rVwiAAAAAoAAAAAAAAAAAAAAAAAAE8UAAAAAwAAAGQ="
2024-09-17T10:30:49.468755Z ERROR stellar_rpc_client::log::diagnostic_events: 1: "AAAAAAAAAAAAAAABDD2r8NvOv29X5Al8ygy4F0R9NqPKKyjdidOfnHNfW+AAAAACAAAAAAAAAAIAAAAPAAAABWVycm9yAAAAAAAAAgAAAAEAAAAGAAAAEAAAAAEAAAACAAAADgAAACdWTSBjYWxsIHRyYXBwZWQ6IFVucmVhY2hhYmxlQ29kZVJlYWNoZWQAAAAADwAAAAdhcHByb3ZlAA=="
❌ error: transaction simulation failed: HostError: Error(WasmVm, InvalidAction)

Event log (newest first):
0: [Diagnostic Event] contract:CAGD3K7Q3PHL632X4QEXZSQMXALUI7JWUPFCWKG5RHJZ7HDTL5N6AMOI, topics:[error, Error(WasmVm, InvalidAction)], data:["VM call trapped: UnreachableCodeReached", approve]
1: [Diagnostic Event] topics:[fn_call, Bytes(0c3dabf0dbcebf6f57e4097cca0cb817447d36a3ca2b28dd89d39f9c735f5be0), approve], data:[GA3CAH6JZDL4PGAZ2TXRCXCWXIJXMUTSWCKFNKWJGOGP7MMAICCRP22S, GAHS53PD4WOGOSOAIQVWZIKVEXLD5S74AYUGJFYV2J4FQW7CWVYIRWHL, 20244, 100]

#

Backtrace (newest first):
0: soroban_env_host::vm::Vm::invoke_function_raw
1: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::with_frame
2: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::call_n_internal
3: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::invoke_function_and_return_val::{{closure}}
4: soroban_env_host::host::frame::<impl soroban_env_host::host::Host>::invoke_function
5: soroban_env_host::e2e_invoke::invoke_host_function_in_recording_mode
6: soroban_simulation::simulation::simulate_invoke_host_function_op
7: preflight::preflight_invoke_hf_op::{{closure}}
8: core::ops::function::FnOnce::call_once{{vtable.shim}}
9: preflight::catch_preflight_panic
10: _cgo_0dc58184ddbd_Cfunc_preflight_invoke_hf_op
at tmp/go-build/cgo-gcc-prolog:105:11
11: runtime.asmcgocall
at ./runtime/asm_amd64.s:918

plain vale
#

your contract had a runtime error (like panic!). it's hard to tell what's exactly wrong without knowing the contract implementation,

forest dune
plain vale
#

yeah, that's definitely an issue. but IDK what else the contract does, it might be failing even before this check

forest dune
plain vale
#

it must be in wasm, so chances are it's the bad expiration ledger

eager comet
#

Thanks!