Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Factory
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
istanbul EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);
/**
* @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 Library of helper methods for interacting with ERC20 tokens that do not consistently return true/false
*/
library SafeERC20 {
function safeTransfer(IERC20 _token, address _to, uint256 _value) internal {
(bool success, bytes memory _data) = address(_token).call(abi.encodeWithSelector(_token.transfer.selector, _to, _value));
require(success && (_data.length == 0 || abi.decode(_data, (bool))));
}
}
contract Deposit {
using SafeERC20 for IERC20;
constructor() payable {
Factory factory = Factory(msg.sender);
address _recipient = factory.recipient();
IERC20 _token = IERC20(factory.token());
// Send all tokens from this contract to owner Factory
if (address(_token) != address(0)) {
IERC20(_token).safeTransfer(
_recipient,
IERC20(_token).balanceOf(address(this))
);
}
selfdestruct(payable(_recipient)); // selfdestruct to receive gas refund and reset nonce to 0
}
}
contract Factory {
address private _owner = msg.sender;
address private _pendingOwner;
address private _recipient = _owner;
address public token;
event Withdrawn(address _recipient, address _depositAddress2, uint256 _depositEthBalance);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
modifier onlyOwner() {
require(owner() == msg.sender);
_;
}
modifier onlyPendingOwner() {
if (_pendingOwner == msg.sender)
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function recipient() public view virtual returns (address) {
return _recipient;
}
function getFactoryVersion() external pure returns (bytes5) {
return '0.6.0';
}
function getDeposit(uint256 _salt) public view returns (bytes memory, address) {
bytes memory _bytecode = type(Deposit).creationCode;
bytes32 _hash = keccak256(
abi.encodePacked(
bytes1(0xff),
address(this),
_salt,
keccak256(_bytecode)
)
);
return (_bytecode, address(uint160(uint256(_hash))));
}
function _createDeposit(address _token, uint256 _salt) private {
(bytes memory _bytecode, address _depositAddress2) = getDeposit(_salt);
token = _token;
uint256 _depositEthBalance = _depositAddress2.balance;
address _createAddress2;
assembly {
_createAddress2 := create2(
0, // 0 wei
add(_bytecode, 32), // the bytecode itself starts at the second slot. The first slot contains array length
mload(_bytecode), // size of init_code
_salt // salt from function arguments
)
}
require(_createAddress2 != address(0));
token = address(0);
emit Withdrawn(recipient(), _depositAddress2, _depositEthBalance);
}
function withdraw(address _token, uint256 _salt) external onlyOwner {
_createDeposit(_token, _salt);
}
function withdrawToAnotherAddress(address _anotherAddress, address _token, uint256 _salt) external onlyOwner {
require(_anotherAddress != address(0));
_recipient = _anotherAddress;
_createDeposit(_token, _salt);
_recipient = owner();
}
function transferOwnership(address _newOwner) external onlyOwner {
_pendingOwner = _newOwner;
}
function claimOwnership() external onlyPendingOwner {
emit OwnershipTransferred(owner(), _pendingOwner);
_owner = _pendingOwner;
_pendingOwner = address(0);
_recipient = owner();
}
}{
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "istanbul",
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"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":"_recipient","type":"address"},{"indexed":false,"internalType":"address","name":"_depositAddress2","type":"address"},{"indexed":false,"internalType":"uint256","name":"_depositEthBalance","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"claimOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_salt","type":"uint256"}],"name":"getDeposit","outputs":[{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFactoryVersion","outputs":[{"internalType":"bytes5","name":"","type":"bytes5"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_salt","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_anotherAddress","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_salt","type":"uint256"}],"name":"withdrawToAnotherAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405260008054336001600160a01b0319918216811790925560028054909116909117905534801561003257600080fd5b506108c8806100426000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146100f55780639f9fb96814610106578063f2fde38b14610127578063f3fef3a31461013a578063fc0c546a1461014d57600080fd5b806331d4fd77146100985780634e71e0c8146100ad5780635b51bec0146100b557806366d003ac146100d0575b600080fd5b6100ab6100a63660046104a1565b610160565b005b6100ab6101e5565b604051640302e362e360dc1b81526020015b60405180910390f35b6002546001600160a01b03165b6040516001600160a01b0390911681526020016100c7565b6000546001600160a01b03166100dd565b610119610114366004610505565b610283565b6040516100c792919061051d565b6100ab610135366004610480565b61030f565b6100ab6101483660046104dc565b610357565b6003546100dd906001600160a01b031681565b336101736000546001600160a01b031690565b6001600160a01b03161461018657600080fd5b6001600160a01b03831661019957600080fd5b600280546001600160a01b0319166001600160a01b0385161790556101be828261038b565b5050600054600280546001600160a01b0319166001600160a01b0390921691909117905550565b6001546001600160a01b0316331415610281576001546001600160a01b03166102166000546001600160a01b031690565b6001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360018054600080546001600160a01b0383166001600160a01b031991821681179092559182169092556002805490911690911790555b565b60606000806040518060200161029890610457565b601f1982820381018352601f90910116604081815282516020808501919091206001600160f81b0319828501526bffffffffffffffffffffffff193060601b166021850152603584019890985260558084019890985281518084039098018852607590920190528551950194909420939492505050565b336103226000546001600160a01b031690565b6001600160a01b03161461033557600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b3361036a6000546001600160a01b031690565b6001600160a01b03161461037d57600080fd5b610387828261038b565b5050565b60008061039783610283565b600380546001600160a01b0319166001600160a01b038881169190911790915582519294509092508216319060009085906020860183f590506001600160a01b0381166103e357600080fd5b600380546001600160a01b03191690557fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb6104266002546001600160a01b031690565b604080516001600160a01b0392831681529186166020830152810184905260600160405180910390a1505050505050565b6103118061058283390190565b80356001600160a01b038116811461047b57600080fd5b919050565b600060208284031215610491578081fd5b61049a82610464565b9392505050565b6000806000606084860312156104b5578182fd5b6104be84610464565b92506104cc60208501610464565b9150604084013590509250925092565b600080604083850312156104ee578182fd5b6104f783610464565b946020939093013593505050565b600060208284031215610516578081fd5b5035919050565b6040815260008351806040840152815b8181101561054a576020818701810151606086840101520161052d565b8181111561055b5782606083860101525b506001600160a01b0393909316602083015250601f91909101601f19160160600191905056fe608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fea2646970667358221220820d083773baf3f84f3af74133087e936c58f2a05fdf46b525ba37dba6ae0e2d64736f6c63430008040033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146100f55780639f9fb96814610106578063f2fde38b14610127578063f3fef3a31461013a578063fc0c546a1461014d57600080fd5b806331d4fd77146100985780634e71e0c8146100ad5780635b51bec0146100b557806366d003ac146100d0575b600080fd5b6100ab6100a63660046104a1565b610160565b005b6100ab6101e5565b604051640302e362e360dc1b81526020015b60405180910390f35b6002546001600160a01b03165b6040516001600160a01b0390911681526020016100c7565b6000546001600160a01b03166100dd565b610119610114366004610505565b610283565b6040516100c792919061051d565b6100ab610135366004610480565b61030f565b6100ab6101483660046104dc565b610357565b6003546100dd906001600160a01b031681565b336101736000546001600160a01b031690565b6001600160a01b03161461018657600080fd5b6001600160a01b03831661019957600080fd5b600280546001600160a01b0319166001600160a01b0385161790556101be828261038b565b5050600054600280546001600160a01b0319166001600160a01b0390921691909117905550565b6001546001600160a01b0316331415610281576001546001600160a01b03166102166000546001600160a01b031690565b6001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360018054600080546001600160a01b0383166001600160a01b031991821681179092559182169092556002805490911690911790555b565b60606000806040518060200161029890610457565b601f1982820381018352601f90910116604081815282516020808501919091206001600160f81b0319828501526bffffffffffffffffffffffff193060601b166021850152603584019890985260558084019890985281518084039098018852607590920190528551950194909420939492505050565b336103226000546001600160a01b031690565b6001600160a01b03161461033557600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b3361036a6000546001600160a01b031690565b6001600160a01b03161461037d57600080fd5b610387828261038b565b5050565b60008061039783610283565b600380546001600160a01b0319166001600160a01b038881169190911790915582519294509092508216319060009085906020860183f590506001600160a01b0381166103e357600080fd5b600380546001600160a01b03191690557fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb6104266002546001600160a01b031690565b604080516001600160a01b0392831681529186166020830152810184905260600160405180910390a1505050505050565b6103118061058283390190565b80356001600160a01b038116811461047b57600080fd5b919050565b600060208284031215610491578081fd5b61049a82610464565b9392505050565b6000806000606084860312156104b5578182fd5b6104be84610464565b92506104cc60208501610464565b9150604084013590509250925092565b600080604083850312156104ee578182fd5b6104f783610464565b946020939093013593505050565b600060208284031215610516578081fd5b5035919050565b6040815260008351806040840152815b8181101561054a576020818701810151606086840101520161052d565b8181111561055b5782606083860101525b506001600160a01b0393909316602083015250601f91909101601f19160160600191905056fe608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fea2646970667358221220820d083773baf3f84f3af74133087e936c58f2a05fdf46b525ba37dba6ae0e2d64736f6c63430008040033
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.