Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
UniswapWrapper
Compiler Version
v0.4.24+commit.e67f0147
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2019-04-19 */ pragma solidity ^0.4.24; contract ERC20 { function totalSupply() public view returns (uint supply); function balanceOf( address who ) public view returns (uint value); function allowance( address owner, address spender ) public view returns (uint _allowance); function transfer( address to, uint value) public returns (bool ok); function transferFrom( address from, address to, uint value) public returns (bool ok); function approve( address spender, uint value ) public returns (bool ok); } contract WETH { function deposit() public payable; function withdraw(uint wad) public; function approve(address guy, uint wad) public returns (bool); function transfer(address dst, uint wad) public returns (bool); function transferFrom(address src, address dst, uint wad) public returns (bool); } contract UNISWAP { function ethToTokenSwapInput(uint256 min_tokens, uint256 deadline) public payable returns (uint256); function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) public returns(uint256); } contract Ownable { address public owner; constructor () public { owner = msg.sender; } modifier onlyOwner() { require( msg.sender == owner, "ONLY_CONTRACT_OWNER" ); _; } function transferOwnership(address newOwner) public onlyOwner { if (newOwner != address(0)) { owner = newOwner; } } } contract UniswapWrapper is Ownable{ address public wethAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; function() public payable{} function withdrawETH(uint256 amount) public onlyOwner { owner.transfer(amount); } function withdrawToken(address token, uint256 amount) public onlyOwner { require(ERC20(token).transfer(owner, amount), "Withdraw token failed"); } function buyToken(address tokenAddress, address exchangeAddress, uint256 minTokenAmount, uint256 ethPay, uint256 deadline) public onlyOwner { require(WETH(wethAddress).transferFrom(msg.sender, this, ethPay), "Transfer weth failed"); WETH(wethAddress).withdraw(ethPay); uint256 tokenBought = UNISWAP(exchangeAddress).ethToTokenSwapInput.value(ethPay)(minTokenAmount, deadline); ERC20(tokenAddress).transfer(owner, tokenBought); } function sellToken(address tokenAddress, address exchangeAddress,uint256 minEthAmount, uint256 tokenPay, uint256 deadline) public onlyOwner { uint256 tokenApprove = ERC20(tokenAddress).allowance( this, exchangeAddress ); if (tokenApprove<tokenPay) { uint256 MAX_UINT = 2 ** 256 - 1; require(ERC20(tokenAddress).approve(exchangeAddress, MAX_UINT), "Approve failed"); } require(ERC20(tokenAddress).transferFrom(msg.sender, this, tokenPay), "Transfer token failed"); uint256 ethBought = UNISWAP(exchangeAddress).tokenToEthSwapInput(tokenPay, minEthAmount, deadline); WETH(wethAddress).deposit.value(ethBought)(); WETH(wethAddress).transfer(msg.sender, ethBought); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"exchangeAddress","type":"address"},{"name":"minEthAmount","type":"uint256"},{"name":"tokenPay","type":"uint256"},{"name":"deadline","type":"uint256"}],"name":"sellToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"wethAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"token","type":"address"},{"name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdrawETH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"exchangeAddress","type":"address"},{"name":"minTokenAmount","type":"uint256"},{"name":"ethPay","type":"uint256"},{"name":"deadline","type":"uint256"}],"name":"buyToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"}]
Contract Creation Code
608060405260018054600160a060020a031990811673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2179091556000805490911633179055610e90806100476000396000f3006080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663040a6e5781146100845780634f0e0ef3146100c15780638da5cb5b146100ff5780639e281a9814610114578063f14210a614610145578063f2fde38b1461015d578063f80860b31461018b575b005b34801561009057600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356064356084356101c8565b3480156100cd57600080fd5b506100d6610756565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010b57600080fd5b506100d6610772565b34801561012057600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff6004351660243561078e565b34801561015157600080fd5b5061008260043561092e565b34801561016957600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff600435166109fa565b34801561019757600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435606435608435610ae0565b600080548190819073ffffffffffffffffffffffffffffffffffffffff16331461025357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff89811660248301529151918a169163dd62ed3e916044808201926020929091908290030181600087803b1580156102cb57600080fd5b505af11580156102df573d6000803e3d6000fd5b505050506040513d60208110156102f557600080fd5b5051925084831015610460577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff91508773ffffffffffffffffffffffffffffffffffffffff1663095ea7b388846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156103c757600080fd5b505af11580156103db573d6000803e3d6000fd5b505050506040513d60208110156103f157600080fd5b5051151561046057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f417070726f7665206661696c6564000000000000000000000000000000000000604482015290519081900360640190fd5b604080517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052905173ffffffffffffffffffffffffffffffffffffffff8a16916323b872dd9160648083019260209291908290030181600087803b1580156104db57600080fd5b505af11580156104ef573d6000803e3d6000fd5b505050506040513d602081101561050557600080fd5b5051151561057457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5472616e7366657220746f6b656e206661696c65640000000000000000000000604482015290519081900360640190fd5b8673ffffffffffffffffffffffffffffffffffffffff166395e3c50b8688876040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018381526020018281526020019350505050602060405180830381600087803b1580156105f357600080fd5b505af1158015610607573d6000803e3d6000fd5b505050506040513d602081101561061d57600080fd5b5051600154604080517fd0e30db0000000000000000000000000000000000000000000000000000000008152905192935073ffffffffffffffffffffffffffffffffffffffff9091169163d0e30db0918491600480830192600092919082900301818588803b15801561068f57600080fd5b505af11580156106a3573d6000803e3d6000fd5b5050600154604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815233600482015260248101879052905173ffffffffffffffffffffffffffffffffffffffff909216945063a9059cbb935060448082019350602092918290030181600087803b15801561072057600080fd5b505af1158015610734573d6000803e3d6000fd5b505050506040513d602081101561074a57600080fd5b50505050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461081457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b60008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810185905290519185169263a9059cbb926044808401936020939083900390910190829087803b15801561089157600080fd5b505af11580156108a5573d6000803e3d6000fd5b505050506040513d60208110156108bb57600080fd5b5051151561092a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576974686472617720746f6b656e206661696c65640000000000000000000000604482015290519081900360640190fd5b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109b457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff9091169183156108fc02918491818181858888f1935050505015801561092a573d6000803e3d6000fd5b60005473ffffffffffffffffffffffffffffffffffffffff163314610a8057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610add57600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610b6757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b600154604080517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101869052905173ffffffffffffffffffffffffffffffffffffffff909216916323b872dd916064808201926020929091908290030181600087803b158015610be757600080fd5b505af1158015610bfb573d6000803e3d6000fd5b505050506040513d6020811015610c1157600080fd5b50511515610c8057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5472616e736665722077657468206661696c6564000000000000000000000000604482015290519081900360640190fd5b600154604080517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101869052905173ffffffffffffffffffffffffffffffffffffffff90921691632e1a7d4d9160248082019260009290919082900301818387803b158015610cf357600080fd5b505af1158015610d07573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff1663f39b5b9b8486856040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001828152602001925050506020604051808303818588803b158015610d8257600080fd5b505af1158015610d96573d6000803e3d6000fd5b50505050506040513d6020811015610dad57600080fd5b505160008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810185905290519394509089169263a9059cbb92604480840193602093929083900390910190829087803b158015610e3057600080fd5b505af1158015610e44573d6000803e3d6000fd5b505050506040513d6020811015610e5a57600080fd5b50505050505050505600a165627a7a723058209f1b9fa864921057383c0b57222b7ec15b04ad3672b0ab8449f03faef9ce5d600029
Deployed Bytecode
0x6080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663040a6e5781146100845780634f0e0ef3146100c15780638da5cb5b146100ff5780639e281a9814610114578063f14210a614610145578063f2fde38b1461015d578063f80860b31461018b575b005b34801561009057600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356064356084356101c8565b3480156100cd57600080fd5b506100d6610756565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010b57600080fd5b506100d6610772565b34801561012057600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff6004351660243561078e565b34801561015157600080fd5b5061008260043561092e565b34801561016957600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff600435166109fa565b34801561019757600080fd5b5061008273ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435606435608435610ae0565b600080548190819073ffffffffffffffffffffffffffffffffffffffff16331461025357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff89811660248301529151918a169163dd62ed3e916044808201926020929091908290030181600087803b1580156102cb57600080fd5b505af11580156102df573d6000803e3d6000fd5b505050506040513d60208110156102f557600080fd5b5051925084831015610460577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff91508773ffffffffffffffffffffffffffffffffffffffff1663095ea7b388846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156103c757600080fd5b505af11580156103db573d6000803e3d6000fd5b505050506040513d60208110156103f157600080fd5b5051151561046057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f417070726f7665206661696c6564000000000000000000000000000000000000604482015290519081900360640190fd5b604080517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052905173ffffffffffffffffffffffffffffffffffffffff8a16916323b872dd9160648083019260209291908290030181600087803b1580156104db57600080fd5b505af11580156104ef573d6000803e3d6000fd5b505050506040513d602081101561050557600080fd5b5051151561057457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5472616e7366657220746f6b656e206661696c65640000000000000000000000604482015290519081900360640190fd5b8673ffffffffffffffffffffffffffffffffffffffff166395e3c50b8688876040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018381526020018281526020019350505050602060405180830381600087803b1580156105f357600080fd5b505af1158015610607573d6000803e3d6000fd5b505050506040513d602081101561061d57600080fd5b5051600154604080517fd0e30db0000000000000000000000000000000000000000000000000000000008152905192935073ffffffffffffffffffffffffffffffffffffffff9091169163d0e30db0918491600480830192600092919082900301818588803b15801561068f57600080fd5b505af11580156106a3573d6000803e3d6000fd5b5050600154604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815233600482015260248101879052905173ffffffffffffffffffffffffffffffffffffffff909216945063a9059cbb935060448082019350602092918290030181600087803b15801561072057600080fd5b505af1158015610734573d6000803e3d6000fd5b505050506040513d602081101561074a57600080fd5b50505050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461081457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b60008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810185905290519185169263a9059cbb926044808401936020939083900390910190829087803b15801561089157600080fd5b505af11580156108a5573d6000803e3d6000fd5b505050506040513d60208110156108bb57600080fd5b5051151561092a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f576974686472617720746f6b656e206661696c65640000000000000000000000604482015290519081900360640190fd5b5050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109b457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff9091169183156108fc02918491818181858888f1935050505015801561092a573d6000803e3d6000fd5b60005473ffffffffffffffffffffffffffffffffffffffff163314610a8057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610add57600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610b6757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b600154604080517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101869052905173ffffffffffffffffffffffffffffffffffffffff909216916323b872dd916064808201926020929091908290030181600087803b158015610be757600080fd5b505af1158015610bfb573d6000803e3d6000fd5b505050506040513d6020811015610c1157600080fd5b50511515610c8057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5472616e736665722077657468206661696c6564000000000000000000000000604482015290519081900360640190fd5b600154604080517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101869052905173ffffffffffffffffffffffffffffffffffffffff90921691632e1a7d4d9160248082019260009290919082900301818387803b158015610cf357600080fd5b505af1158015610d07573d6000803e3d6000fd5b505050508473ffffffffffffffffffffffffffffffffffffffff1663f39b5b9b8486856040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001828152602001925050506020604051808303818588803b158015610d8257600080fd5b505af1158015610d96573d6000803e3d6000fd5b50505050506040513d6020811015610dad57600080fd5b505160008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810185905290519394509089169263a9059cbb92604480840193602093929083900390910190829087803b158015610e3057600080fd5b505af1158015610e44573d6000803e3d6000fd5b505050506040513d6020811015610e5a57600080fd5b50505050505050505600a165627a7a723058209f1b9fa864921057383c0b57222b7ec15b04ad3672b0ab8449f03faef9ce5d600029
Swarm Source
bzzr://9f1b9fa864921057383c0b57222b7ec15b04ad3672b0ab8449f03faef9ce5d60
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ 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.