2

in the newer version of CDT, currency is removed from eoslib. Therefore, for unpack_action_data<currency::transfer>(), what value should substitute currency::transfer?

2

(talking about version 1.3, 1.4, and maybe above)
You don't need to. Chrtistoph explains is well here.

(test is the class name of the contract here)
In you own apply function call

if (code == "eosio.token"_n.value && action == "transfer"_n.value)
{
  eosio::execute_action(eosio::name(receiver), eosio::name(code), &test::transfer);
}

and define your own transfer function to receive the unpacked values

void test::transfer(name from, name to, asset quantity, string memo)
{
  print("Quantity: ", quantity.amount, " with memo ", memo.c_str());
}
| improve this answer | |
0
struct st_transfer {
    name   from;
    name   to;
    asset  quantity;
    string memo;
};

I think the answer by Colin works just fine, but just in case you wanted to see how the other way works.

You would define a struct like above and use the struct to unpack incoming transfer data. This format can be used for other smartcontract actions as well.

so it looks like

unpack_action_data()

| improve this answer | |

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.