Using on_notify with services
CONTRACT_END((create)(issue)(transfer))}; // this line is important! closes the contract
extern "C" {
void apply(uint64_t receiver, uint64_t code, uint64_t action) {
// some custom logic, say an NFT transfer for on_notify
if (code == NFT_ACCOUNT.value && action == name("transfer").value) {
eosio::execute_action(eosio::name(receiver), eosio::name(code),
&CONTRACT_NAME()::transfer);
}
else {
switch (action) {
// for dapp network service actions
EOSIO_DISPATCH_HELPER(CONTRACT_NAME(), DAPPSERVICE_ACTIONS_COMMANDS())
// update with you contract's actions
EOSIO_DISPATCH_HELPER(CONTRACT_NAME(), (create)(issue)(transfer))
// enabling dapp network signal actions
EOSIO_DISPATCH_HELPER(CONTRACT_NAME(), (xsignal))
}
}
eosio_exit(0);
}
}Last updated
Was this helpful?