Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/batchtrf.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IERC20 {
function transfer(address to, uint256 amount) external returns (bool);
}
contract DualTokenTransfer {
address public owner;
IERC20 public immutable usdc;
IERC20 public immutable myToken;
constructor(address _usdc, address _myToken) {
owner = msg.sender;
usdc = IERC20(_usdc);
myToken = IERC20(_myToken);
}
modifier onlyOwner() {
require(msg.sender == owner, "Not authorized");
_;
}
/**
* @notice Transfers USDC and MyToken to two different addresses.
* @param usdcRecipient Address to receive the USDC.
* @param usdcAmount Amount of USDC to transfer (in smallest unit, e.g., 6 decimals).
* @param myTokenRecipient Address to receive your own token.
* @param myTokenAmount Amount of MyToken to transfer (in smallest unit, e.g., 18 decimals).
*/
function transferBoth(
address usdcRecipient,
uint256 usdcAmount,
address myTokenRecipient,
uint256 myTokenAmount
) external onlyOwner {
require(usdc.transfer(usdcRecipient, usdcAmount), "USDC transfer failed");
require(myToken.transfer(myTokenRecipient, myTokenAmount), "MyToken transfer failed");
}
/// @notice Optional function to withdraw any stuck tokens.
function rescueTokens(address token, address to, uint256 amount) external onlyOwner {
require(IERC20(token).transfer(to, amount), "Rescue failed");
}
}
"
}
},
"settings": {
"optimizer": {
"enabled": false,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": []
}
}}
Submitted on: 2025-10-30 13:04:57
Comments
Log in to comment.
No comments yet.