Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions