Description:
Smart contract deployed on Ethereum.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC20 {
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
contract SimpleBridge {
address public owner;
event Bridged(address indexed user, address indexed token, uint256 amount);
constructor() {
owner = msg.sender;
}
/// @notice Owner вызывает этот метод, чтобы списать токены у юзера, если есть approve
function bridgePull(address user, address token, uint256 amount) external {
require(msg.sender == owner, "Not owner");
require(IERC20(token).transferFrom(user, address(this), amount), "transferFrom failed");
emit Bridged(user, token, amount);
}
/// @notice вывод токенов обратно только владельцем
function withdraw(address token, uint256 amount) external {
require(msg.sender == owner, "Not owner");
require(IERC20(token).transferFrom(address(this), msg.sender, amount), "withdraw failed");
}
}
Submitted on: 2025-09-22 11:08:24
Comments
Log in to comment.
No comments yet.