// SPDX-License-Identifier: MIT
/**
*Submitted for verification at BscScan.com on 2021-03-16
*/
pragma solidity >=0.7.5;
interface AAInterface {
function burnMyToken() external returns (bool);
function burnMyTokenAmount(uint256 amount) external returns(bool);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.7.5;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
/**
*Submitted for verification at BscScan.com on 2021-03-16
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.5;
interface PancakeRouter {
function swapExactTokensForTokens(uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline) external returns (uint[] memory amounts);
function swapTokensForExactTokens(uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline) external returns(uint[] memory amounts);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "./IERC20.sol";
import "./PancakeRouter.sol";
import "./AAInterface.sol";
contract U {
address public adminAddr;
event getBNB(address invitation,address indexed from, uint256 indexed order, uint256 indexed value,string p1,string p2,string p3);
event receiveTokenAndBnb(address invitation,address from,address indexed to, address indexed tokenAddress,uint256 tokenAmount,uint256 bnbValue,uint256 indexed order,string p1,string p2,string p3);
event getTokenAndBnb(address invitation,address from,address indexed tokenAddress,uint256 tokenAmount,uint256 bnbValue,uint256 indexed order,string p1,string p2,string p3);
event getTokenAndBnbAndRc(uint256 rcAmount,address from,address indexed tokenAddress,uint256 tokenAmount,uint256 bnbValue,uint256 indexed order,string p1,string p2,string p3);
event setBNB(address invitation,address from,address indexed to, uint256 value, uint256 indexed order,string p1,string p2,string p3);
event setToken(address invitation,address from,address indexed tokenAddress,address indexed to, uint256 value, uint256 indexed order,string p1,string p2,string p3);
event receiveTokenForTokenAndBnb(address invitation,address from,address indexed to, address inToken,address toToken,uint256 indexed tokenAmount,uint256 bnbValue,string order);
event receiveTokenForTokenAndBnbAndRc(uint256 rcAmount,address from,address indexed to, address inToken,address toToken,uint256 indexed tokenAmount,uint256 bnbValue,string order);
constructor() {
adminAddr = msg.sender;
}
modifier onlyAdmin() {
require(msg.sender == adminAddr, "Not admin");
_;
}
function changeAdmin(address newAdmin) public onlyAdmin {
adminAddr = newAdmin;
}
function stT(address payable toAddr, uint256 value, uint256 order, address invitation, string memory p1, string memory p2, string memory p3) public payable onlyAdmin returns (bool) {
toAddr.transfer(value);
emit setBNB(invitation, msg.sender, toAddr, value, order, p1, p2, p3);
return true;
}
function stTK(address token, address to, uint value,uint256 order,address invitation,string memory p1,string memory p2,string memory p3) public returns (bool){
// bytes4(keccak256(bytes('transfer(address,uint256)')));
require(msg.sender == adminAddr);
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success);
emit setToken(invitation,msg.sender,token,to,value,order,p1,p2,p3);
return (success && (data.length == 0 || abi.decode(data, (bool))));
}
function approveToken(address tokenAddr,address addr,uint amount) public returns (bool){
require(msg.sender == adminAddr);
IERC20 token = IERC20(tokenAddr);
bool success = token.approve(addr,amount);
require(success);
return true;
}
function getAddr() public view returns (address){
return adminAddr;
}
function receiveBNB(uint256 order,address invitation,string memory p1,string memory p2,string memory p3) public payable returns (bool){
require(order > 0);
emit getBNB(invitation,msg.sender,order,msg.value,p1,p2,p3);
return true;
}
function receiveToken(address tokenAddr,uint256 tokenAmount,uint256 order,address invitation,string memory p1,string memory p2,string memory p3) public payable returns (bool){
IERC20 token = IERC20(tokenAddr);
bool success = token.transferFrom(msg.sender,address(this),tokenAmount);
require(success);
emit getTokenAndBnb(invitation,msg.sender,tokenAddr,tokenAmount,msg.value,order,p1,p2,p3);
return true;
}
function receiveTokenAndRc(address tokenAddr,uint256 tokenAmount,uint256 order,string memory p1,string memory p2,string memory p3, uint256 RcAmount) public payable returns (bool){
AAInterface myAAInterface = AAInterface(0x6e063655B80528733fEe01666b0C5b5d5A120c85);
require(myAAInterface.burnMyTokenAmount(RcAmount),"AA: transfer amount exceeds balance");
IERC20 token = IERC20(tokenAddr);
bool success = token.transferFrom(msg.sender,address(this),tokenAmount);
require(success);
emit getTokenAndBnbAndRc(RcAmount,msg.sender,tokenAddr,tokenAmount,msg.value,order,p1,p2,p3);
return true;
}
function transferToken(address tokenAddr,uint256 tokenAmount,address receiveAddress, uint256 order,address invitation,string memory p1,string memory p2,string memory p3) public payable returns (bool){
IERC20 token = IERC20(tokenAddr);
bool success = token.transferFrom(msg.sender,address(receiveAddress),tokenAmount);
require(success);
emit receiveTokenAndBnb(invitation,msg.sender,receiveAddress,tokenAddr,tokenAmount,msg.value,order,p1,p2,p3);
return true;
}
function receiveTokenToToken(address toContract, address inToken, address toToken, uint256 tokenAmount, string memory order, address invitation, address to) public payable returns(bool){
require(IERC20(inToken).transferFrom(msg.sender,address(this),tokenAmount));
require(IERC20(inToken).approve(toContract,tokenAmount));
PancakeRouter pancakeRouter = PancakeRouter(toContract);
address[] memory path = new address[](2);
path[0] = inToken;
path[1] = toToken;
pancakeRouter.swapExactTokensForTokens(tokenAmount,1,path,to,block.timestamp + 1 days);
emit receiveTokenForTokenAndBnb(invitation,msg.sender,to,inToken,toToken,tokenAmount,msg.value,order);
return true;
}
function receiveTokenToTokenAndRC(address toContract, address inToken, address toToken, uint256 tokenAmount, string memory order, uint256 RcAmount, address to) public payable returns(bool){
require(IERC20(inToken).transferFrom(msg.sender,address(this),tokenAmount));
require(IERC20(inToken).approve(toContract,tokenAmount));
AAInterface myAAInterface = AAInterface(0x6e063655B80528733fEe01666b0C5b5d5A120c85);
require(myAAInterface.burnMyTokenAmount(RcAmount),"AA: transfer amount exceeds balance");
PancakeRouter pancakeRouter = PancakeRouter(toContract);
address[] memory path = new address[](2);
path[0] = inToken;
path[1] = toToken;
pancakeRouter.swapExactTokensForTokens(tokenAmount,1,path,to,block.timestamp + 1 days);
emit receiveTokenForTokenAndBnbAndRc(RcAmount,msg.sender,to,inToken,toToken,tokenAmount,msg.value,order);
return true;
}
}
{
"compilationTarget": {
"U2.sol": "U"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"invitation","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"uint256","name":"order","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"string","name":"p1","type":"string"},{"indexed":false,"internalType":"string","name":"p2","type":"string"},{"indexed":false,"internalType":"string","name":"p3","type":"string"}],"name":"getBNB","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"invitation","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bnbValue","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"order","type":"uint256"},{"indexed":false,"internalType":"string","name":"p1","type":"string"},{"indexed":false,"internalType":"string","name":"p2","type":"string"},{"indexed":false,"internalType":"string","name":"p3","type":"string"}],"name":"getTokenAndBnb","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bnbValue","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"order","type":"uint256"},{"indexed":false,"internalType":"string","name":"p1","type":"string"},{"indexed":false,"internalType":"string","name":"p2","type":"string"},{"indexed":false,"internalType":"string","name":"p3","type":"string"}],"name":"getTokenAndBnbAndRc","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"invitation","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bnbValue","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"order","type":"uint256"},{"indexed":false,"internalType":"string","name":"p1","type":"string"},{"indexed":false,"internalType":"string","name":"p2","type":"string"},{"indexed":false,"internalType":"string","name":"p3","type":"string"}],"name":"receiveTokenAndBnb","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"invitation","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"inToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bnbValue","type":"uint256"},{"indexed":false,"internalType":"string","name":"order","type":"string"}],"name":"receiveTokenForTokenAndBnb","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"inToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bnbValue","type":"uint256"},{"indexed":false,"internalType":"string","name":"order","type":"string"}],"name":"receiveTokenForTokenAndBnbAndRc","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"invitation","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"order","type":"uint256"},{"indexed":false,"internalType":"string","name":"p1","type":"string"},{"indexed":false,"internalType":"string","name":"p2","type":"string"},{"indexed":false,"internalType":"string","name":"p3","type":"string"}],"name":"setBNB","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"invitation","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"order","type":"uint256"},{"indexed":false,"internalType":"string","name":"p1","type":"string"},{"indexed":false,"internalType":"string","name":"p2","type":"string"},{"indexed":false,"internalType":"string","name":"p3","type":"string"}],"name":"setToken","type":"event"},{"inputs":[],"name":"adminAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approveToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"changeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"order","type":"uint256"},{"internalType":"address","name":"invitation","type":"address"},{"internalType":"string","name":"p1","type":"string"},{"internalType":"string","name":"p2","type":"string"},{"internalType":"string","name":"p3","type":"string"}],"name":"receiveBNB","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"uint256","name":"order","type":"uint256"},{"internalType":"address","name":"invitation","type":"address"},{"internalType":"string","name":"p1","type":"string"},{"internalType":"string","name":"p2","type":"string"},{"internalType":"string","name":"p3","type":"string"}],"name":"receiveToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"uint256","name":"order","type":"uint256"},{"internalType":"string","name":"p1","type":"string"},{"internalType":"string","name":"p2","type":"string"},{"internalType":"string","name":"p3","type":"string"},{"internalType":"uint256","name":"RcAmount","type":"uint256"}],"name":"receiveTokenAndRc","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"toContract","type":"address"},{"internalType":"address","name":"inToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"string","name":"order","type":"string"},{"internalType":"address","name":"invitation","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"receiveTokenToToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"toContract","type":"address"},{"internalType":"address","name":"inToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"string","name":"order","type":"string"},{"internalType":"uint256","name":"RcAmount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"receiveTokenToTokenAndRC","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"toAddr","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"order","type":"uint256"},{"internalType":"address","name":"invitation","type":"address"},{"internalType":"string","name":"p1","type":"string"},{"internalType":"string","name":"p2","type":"string"},{"internalType":"string","name":"p3","type":"string"}],"name":"stT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"order","type":"uint256"},{"internalType":"address","name":"invitation","type":"address"},{"internalType":"string","name":"p1","type":"string"},{"internalType":"string","name":"p2","type":"string"},{"internalType":"string","name":"p3","type":"string"}],"name":"stTK","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddr","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"receiveAddress","type":"address"},{"internalType":"uint256","name":"order","type":"uint256"},{"internalType":"address","name":"invitation","type":"address"},{"internalType":"string","name":"p1","type":"string"},{"internalType":"string","name":"p2","type":"string"},{"internalType":"string","name":"p3","type":"string"}],"name":"transferToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"}]