Skip to content

💥How to make the contract trigger an event when successfully transferred to the contract #418

@kaiser-9527

Description

@kaiser-9527

When the TRX is successfully transferred to the contract, how to make the contract trigger an event?

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract ExampleContract {
event TransactionReceived(address indexed sender, uint value);

function clog  () public {
    emit TransactionReceived(msg.sender, 1);
}

receive () external payable {
    emit TransactionReceived(msg.sender, 2);
}

fallback () external payable {
    emit TransactionReceived(msg.sender, 3);
}

}
When the transfer was successful, I didn't receive the TransactionReceived event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions