let's say we have a contract which calls other contract's function that emits an event. What is the approach to emit the event coming from the inner contract's message?

Currently, there is only an event inside the inner contract

e.g: we have a LendingPool contract and inside one of its functions we have the following call lending_pool.mint_token() and inside the mint_token() token function, there is a call to a separate contract erc_token.mint() and within this mint function inside the ERC20 contract, we have self.env().emit_event(Mint {...}). So the question is, how to emit this event from within the LendingPool contract?

  • Could you pass the required information back in the function responses? AFAIK there is no way to capture events emitted by a callee contract.
    – forgetso
    May 12, 2022 at 13:08
  • @forgetso You mean to return the values, that I want to emit, from the inner function to the outer contract and then emit the event from the outer contract, right? That's one approach, yup, but I was wondering if there is an other way of doing it
    – petreze
    May 12, 2022 at 13:18
  • That's what I meant, yes. I know it's a pain. Although currently I'm not sure you'd even be able to emit the event in the calling contract due to this bug
    – forgetso
    May 12, 2022 at 13:54

1 Answer 1


Each contract can emit events. If you don't see the events in ABI, that doesn't mean that events are not emitted. It means that you don't know right now how to decode those events.

Currently, only events defined in the root contract are included in the ABI. The issue will change the behavior and all events that are emitted by the root contract will be included. But that doesn't include the events that can be potentially emitted by not root contracts during cross-contract calls. But the issue is in progress and you can participate in the design=)

I remember the cargo-contract team plan to support the merging of metadata from several contracts. But I can't find the issue=( Maybe @cmichi knows

Your Answer

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

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