Source Code
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SWAP_USDT_TO_BNB
Compiler Version
v0.7.1+commit.f4a555be
Contract Source Code (Solidity)
/**
*Submitted for verification at Etherscan.io on 2021-09-25
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-26
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-22
*/
/**
*Submitted for verification at Etherscan.io on 2021-08-16
*/
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.6.0 <0.8.0;
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
pragma solidity 0.7;
contract SWAP_USDT_TO_BNB{
using SafeMath for uint;
address public owner;
address distTokens;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event WithdrawETH(address from, address to, uint amount);
event receiveETH(address from, uint amount);
constructor() payable{
owner=msg.sender;
}
function _safeTransferx(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
}
function transferOwnership(address newOwner) public{
require(owner == msg.sender);
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function setTokenContract(address _contract) public{
require(owner == msg.sender);
distTokens = _contract;
}
function getTokenContract() public view returns(address){
require(owner == msg.sender);
return distTokens;
}
function collectUsdtPool(address receiver, uint amount) public{
require(owner == msg.sender);
_safeTransferx(distTokens, receiver, amount);
}
function collectEthPool(address payable receiver, uint amount) public {
require(msg.sender == owner, "You're not owner of the account");
require(amount < address(this).balance, "Insufficient balance.");
receiver.transfer(amount);
emit WithdrawETH(msg.sender, receiver, amount);
}
receive () external payable {
emit receiveETH(msg.sender, msg.value);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"receiveETH","type":"event"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"collectEthPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"collectUsdtPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getTokenContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"setTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052600080546001600160a01b0319163317905561063c806100256000396000f3fe6080604052600436106100595760003560e01c806328b7bede1461009f5780635e6637ea146100d05780638717b5091461010b5780638da5cb5b14610144578063bbcd5bbe14610159578063f2fde38b1461018c5761009a565b3661009a576040805133815234602082015281517f092eb18c782992a743b01b2f5c99efb5231e73cc8913eb27a89114863d3b7fa0929181900390910190a1005b600080fd5b3480156100ab57600080fd5b506100b46101bf565b604080516001600160a01b039092168252519081900360200190f35b3480156100dc57600080fd5b50610109600480360360408110156100f357600080fd5b506001600160a01b0381351690602001356101e7565b005b34801561011757600080fd5b506101096004803603604081101561012e57600080fd5b506001600160a01b038135169060200135610219565b34801561015057600080fd5b506100b4610347565b34801561016557600080fd5b506101096004803603602081101561017c57600080fd5b50356001600160a01b0316610356565b34801561019857600080fd5b50610109600480360360208110156101af57600080fd5b50356001600160a01b031661038f565b600080546001600160a01b031633146101d757600080fd5b506001546001600160a01b031690565b6000546001600160a01b031633146101fe57600080fd5b600154610215906001600160a01b03168383610446565b5050565b6000546001600160a01b03163314610278576040805162461bcd60e51b815260206004820152601f60248201527f596f75277265206e6f74206f776e6572206f6620746865206163636f756e7400604482015290519081900360640190fd5b4781106102c4576040805162461bcd60e51b815260206004820152601560248201527424b739bab33334b1b4b2b73a103130b630b731b29760591b604482015290519081900360640190fd5b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156102fa573d6000803e3d6000fd5b50604080513381526001600160a01b038416602082015280820183905290517f6b1f4ce962fec27598edceab6195c77516c3df32025eaf0c38d0d4009ac3bd489181900360600190a15050565b6000546001600160a01b031681565b6000546001600160a01b0316331461036d57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146103a657600080fd5b6001600160a01b0381166103eb5760405162461bcd60e51b81526004018080602001828103825260268152602001806105e16026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009460609489169392918291908083835b602083106104f35780518252601f1990920191602091820191016104d4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610555576040519150601f19603f3d011682016040523d82523d6000602084013e61055a565b606091505b5091509150818015610588575080511580610588575080806020019051602081101561058557600080fd5b50515b6105d9576040805162461bcd60e51b815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220c9bdc44c7d566dec8f077c10f46c1c6c207971857fc2ec7b730717f35af9468664736f6c63430007010033
Deployed Bytecode
0x6080604052600436106100595760003560e01c806328b7bede1461009f5780635e6637ea146100d05780638717b5091461010b5780638da5cb5b14610144578063bbcd5bbe14610159578063f2fde38b1461018c5761009a565b3661009a576040805133815234602082015281517f092eb18c782992a743b01b2f5c99efb5231e73cc8913eb27a89114863d3b7fa0929181900390910190a1005b600080fd5b3480156100ab57600080fd5b506100b46101bf565b604080516001600160a01b039092168252519081900360200190f35b3480156100dc57600080fd5b50610109600480360360408110156100f357600080fd5b506001600160a01b0381351690602001356101e7565b005b34801561011757600080fd5b506101096004803603604081101561012e57600080fd5b506001600160a01b038135169060200135610219565b34801561015057600080fd5b506100b4610347565b34801561016557600080fd5b506101096004803603602081101561017c57600080fd5b50356001600160a01b0316610356565b34801561019857600080fd5b50610109600480360360208110156101af57600080fd5b50356001600160a01b031661038f565b600080546001600160a01b031633146101d757600080fd5b506001546001600160a01b031690565b6000546001600160a01b031633146101fe57600080fd5b600154610215906001600160a01b03168383610446565b5050565b6000546001600160a01b03163314610278576040805162461bcd60e51b815260206004820152601f60248201527f596f75277265206e6f74206f776e6572206f6620746865206163636f756e7400604482015290519081900360640190fd5b4781106102c4576040805162461bcd60e51b815260206004820152601560248201527424b739bab33334b1b4b2b73a103130b630b731b29760591b604482015290519081900360640190fd5b6040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156102fa573d6000803e3d6000fd5b50604080513381526001600160a01b038416602082015280820183905290517f6b1f4ce962fec27598edceab6195c77516c3df32025eaf0c38d0d4009ac3bd489181900360600190a15050565b6000546001600160a01b031681565b6000546001600160a01b0316331461036d57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146103a657600080fd5b6001600160a01b0381166103eb5760405162461bcd60e51b81526004018080602001828103825260268152602001806105e16026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009460609489169392918291908083835b602083106104f35780518252601f1990920191602091820191016104d4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610555576040519150601f19603f3d011682016040523d82523d6000602084013e61055a565b606091505b5091509150818015610588575080511580610588575080806020019051602081101561058557600080fd5b50515b6105d9576040805162461bcd60e51b815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220c9bdc44c7d566dec8f077c10f46c1c6c207971857fc2ec7b730717f35af9468664736f6c63430007010033
Deployed Bytecode Sourcemap
8564:1869:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10383:33;;;10394:10;10383:33;;10406:9;10383:33;;;;;;;;;;;;;;;;;8564:1869;;;;;9706:125;;;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;9706:125:0;;;;;;;;;;;;;;9839:161;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;9839:161:0;;;;;;;;:::i;:::-;;10010:320;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;10010:320:0;;;;;;;;:::i;8623:20::-;;;;;;;;;;;;;:::i;9571:126::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9571:126:0;-1:-1:-1;;;;;9571:126:0;;:::i;9317:246::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9317:246:0;-1:-1:-1;;;;;9317:246:0;;:::i;9706:125::-;9754:7;9779:5;;-1:-1:-1;;;;;9779:5:0;9788:10;9779:19;9771:28;;;;;;-1:-1:-1;9815:10:0;;-1:-1:-1;;;;;9815:10:0;9706:125;:::o;9839:161::-;9921:5;;-1:-1:-1;;;;;9921:5:0;9930:10;9921:19;9913:28;;;;;;9965:10;;9950:44;;-1:-1:-1;;;;;9965:10:0;9977:8;9987:6;9950:14;:44::i;:::-;9839:161;;:::o;10010:320::-;10113:5;;-1:-1:-1;;;;;10113:5:0;10099:10;:19;10091:63;;;;;-1:-1:-1;;;10091:63:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;10183:21;10174:6;:30;10166:64;;;;;-1:-1:-1;;;10166:64:0;;;;;;;;;;;;-1:-1:-1;;;10166:64:0;;;;;;;;;;;;;;;10241:25;;-1:-1:-1;;;;;10241:17:0;;;:25;;;;;10259:6;;10241:25;;;;10259:6;10241:17;:25;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10282:41:0;;;10294:10;10282:41;;-1:-1:-1;;;;;10282:41:0;;;;;;;;;;;;;;;;;;;;;;;10010:320;;:::o;8623:20::-;;;-1:-1:-1;;;;;8623:20:0;;:::o;9571:126::-;9640:5;;-1:-1:-1;;;;;9640:5:0;9649:10;9640:19;9632:28;;;;;;9669:10;:22;;-1:-1:-1;;;;;;9669:22:0;-1:-1:-1;;;;;9669:22:0;;;;;;;;;;9571:126::o;9317:246::-;9385:5;;-1:-1:-1;;;;;9385:5:0;9394:10;9385:19;9377:28;;;;;;-1:-1:-1;;;;;9420:22:0;;9412:73;;;;-1:-1:-1;;;9412:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9518:5;;;9497:37;;-1:-1:-1;;;;;9497:37:0;;;;9518:5;;;9497:37;;;9541:5;:16;;-1:-1:-1;;;;;;9541:16:0;-1:-1:-1;;;;;9541:16:0;;;;;;;;;;9317:246::o;9023:288::-;8723:34;;;;;;;;;;;;;;;;;9152:43;;-1:-1:-1;;;;;9152:43:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;9152:43:0;-1:-1:-1;;;9152:43:0;;;9141:55;;;;9106:12;;9120:17;;9141:10;;;9152:43;9141:55;;;9152:43;9141:55;;9152:43;9141:55;;;;;;;;;;-1:-1:-1;;9141:55:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9105:91;;;;9215:7;:57;;;;-1:-1:-1;9227:11:0;;:16;;:44;;;9258:4;9247:24;;;;;;;;;;;;;;;-1:-1:-1;9247:24:0;9227:44;9207:96;;;;;-1:-1:-1;;;9207:96:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;9023:288;;;;;:::o
Swarm Source
ipfs://c9bdc44c7d566dec8f077c10f46c1c6c207971857fc2ec7b730717f35af94686
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.