1

in looking at the code for eosio.token (https://github.com/EOSIO/eos/blob/master/contracts/eosio.token/eosio.token.cpp) the issue method calls the transfer method at the bottom, but instead of just calling it (e.g. token::transfer(...)) it uses the SEND_INLINE_ACTION macro (or whatever that is)

why?

p.s. I've looked at the docs for that function (https://developers.eos.io/eosio-cpp/reference#send_inline_action) but the description merely states that the function "Send inline action", as if I couldn't read that from the name of the function. there really isn't any point in having documentation like that. can anyone explain what an "inline" action is? and what is being sent? an action can be called, but sent?

0

You can send an inline action without SEND_INLINE_ACTION macro, but it checks the type of action before sending it. (A little bit safer because SEND_INLINE_ACTION with invalid action type produces an error during compilation)

0

You can call any function of a smart contract from within the smart contract, however only functions labelled as actions can be called from outside of the smart contract.

So if you have a function in contract A that needs to call a function from contract B, you would have to do this by sending an action.

An inline action means that the action has to be performed as part of the current transaction, meaning if the inline action failed, then so would your entire transaction, which is often the desired behaviour.

  • is there a SEND_ACTION then? one that isn't inline and that is not part of the transaction? and if I call a method from within the contract, is that always considered inline? – ekkis Jan 12 at 0:41
  • I don't use the macros personally. To send an action (not inline), use the transaction class and the send function. To do an inline action, use the action class and the send function – Phillip Hamnett - EOS42 Jan 12 at 18:42
  • more to the point, why can I not just call the method, since it's in the same class token::transfer()? – ekkis Jan 14 at 0:24

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.