Skip to content

TRX Not Forwarding in receive() and fallback() on Tron Despite Successful Transaction #6166

Open
@abdullahAttiq

Description

i am trying a thing where recieve funds will instantaniously transfered to a predefined wallet.
after the transfer the transaction passes but the funds get stuck in the contract.
note: this code works alright in EVM chains

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

contract TRXForwarder {
address payable public immutable destination;

event TRXForwarded(uint256 amount);

constructor(address payable _destination) {
   // require(_destination != address(0), "Invalid address");
    destination = _destination;
}

receive() external payable {
    require(msg.value > 0, "No TRX sent");
    payable(destination).call{value: msg.value}("");
}

fallback() external payable {
    require(msg.value > 0, "No TRX sent");
    payable(destination).call{value: msg.value}("");
}

Activity

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions