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?

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.

  • 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 at 22:53
  • There are no docs for it yet – Todd Fleming Feb 7 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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