0

I had a method:

-- t.hpp --
[[eosio::action]]
void exchange();

-- t.cpp --
void token::exchange()
{
    ...
}
EOSIO_DISPATCH(eosio::token, (exchange))

and then decided that if a parameter were passed, I'd want to do something different, so I added:

-- t.hpp --
[[eosio::action]]
void exchange();
[[eosio::action]]
void exchange(asset auction);

-- t.cpp --
void token::exchange()
{
    ...
}

void token::exchange(asset auction)
{
    ...
}
EOSIO_DISPATCH(eosio::token, (exchange))

but this produces an error:

t.cpp:378:1: error: no matching function for call to 'execute_action' EOSIO_DISPATCH(eosio::token, (exchange))

can I not do this? or if I can, how is it done?

1 Answer 1

3

Non-variant actions aren't overloadable. If you need actions with different behavior, then give them different names.

Variant actions aren't ready for general use. They have (undocumented) methods of declaring them, and client code needs to pack them into transactions in a different way than normal.

2
  • I looked up the reference to variant vs. non-variant actions but find nothing of it. care to elucidate or point me to docs?
    – ekkis
    Feb 6, 2019 at 22:53
  • There are no docs for it yet Feb 7, 2019 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.