More Info
Private Name Tags
ContractCreator
Funded By
N/A
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
13284077 | 1228 days ago | 0 ETH |
Loading...
Loading
Contract Self Destruct called at Txn Hash 0x1b35cde1da33635115a16f1e40b29b6d53405e872a5241719c1f920a578ecf94
Contract Source Code Verified (Exact Match)
Contract Name:
TokenPool
Compiler Version
v0.4.21+commit.dfe3193c
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2018-06-30 */ pragma solidity ^0.4.21; /** * Changes by https://www.docademic.com/ */ /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * Changes by https://www.docademic.com/ */ /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } contract Destroyable is Ownable { /** * @notice Allows to destroy the contract and return the tokens to the owner. */ function destroy() public onlyOwner { selfdestruct(owner); } } interface Token { function balanceOf(address who) view external returns (uint256); function allowance(address _owner, address _spender) view external returns (uint256); function transfer(address _to, uint256 _value) external returns (bool); function approve(address _spender, uint256 _value) external returns (bool); function increaseApproval(address _spender, uint256 _addedValue) external returns (bool); function decreaseApproval(address _spender, uint256 _subtractedValue) external returns (bool); } contract TokenPool is Ownable, Destroyable { using SafeMath for uint256; Token public token; address public spender; event AllowanceChanged(uint256 _previousAllowance, uint256 _allowed); event SpenderChanged(address _previousSpender, address _spender); /** * @dev Constructor. * @param _token The token address * @param _spender The spender address */ function TokenPool(address _token, address _spender) public{ require(_token != address(0) && _spender != address(0)); token = Token(_token); spender = _spender; } /** * @dev Get the token balance of the contract. * @return _balance The token balance of this contract in wei */ function Balance() view public returns (uint256 _balance) { return token.balanceOf(address(this)); } /** * @dev Get the token allowance of the contract to the spender. * @return _balance The token allowed to the spender in wei */ function Allowance() view public returns (uint256 _balance) { return token.allowance(address(this), spender); } /** * @dev Allows the owner to set up the allowance to the spender. */ function setUpAllowance() public onlyOwner { emit AllowanceChanged(token.allowance(address(this), spender), token.balanceOf(address(this))); token.approve(spender, token.balanceOf(address(this))); } /** * @dev Allows the owner to update the allowance of the spender. */ function updateAllowance() public onlyOwner { uint256 balance = token.balanceOf(address(this)); uint256 allowance = token.allowance(address(this), spender); uint256 difference = balance.sub(allowance); token.increaseApproval(spender, difference); emit AllowanceChanged(allowance, allowance.add(difference)); } /** * @dev Allows the owner to destroy the contract and return the tokens to the owner. */ function destroy() public onlyOwner { token.transfer(owner, token.balanceOf(address(this))); selfdestruct(owner); } /** * @dev Allows the owner to change the spender. * @param _spender The new spender address */ function changeSpender(address _spender) public onlyOwner { require(_spender != address(0)); emit SpenderChanged(spender, _spender); token.approve(spender, 0); spender = _spender; setUpAllowance(); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"Balance","outputs":[{"name":"_balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"setUpAllowance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"}],"name":"changeSpender","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"Allowance","outputs":[{"name":"_balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"spender","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"updateAllowance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_spender","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_previousAllowance","type":"uint256"},{"indexed":false,"name":"_allowed","type":"uint256"}],"name":"AllowanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_previousSpender","type":"address"},{"indexed":false,"name":"_spender","type":"address"}],"name":"SpenderChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
Contract Creation Code
6060604052341561000f57600080fd5b604051604080610a2c833981016040528080519190602001805160008054600160a060020a03191633600160a060020a0390811691909117909155909250831615801591506100665750600160a060020a03811615155b151561007157600080fd5b60018054600160a060020a03938416600160a060020a03199182161790915560028054929093169116179055610980806100ac6000396000f30060606040526004361061008a5763ffffffff60e060020a6000350416630ef67887811461008f578063397986a1146100b45780636c5541b5146100c95780637040f3e5146100e857806383197ef0146100fb5780638da5cb5b1461010e578063e8edc8161461013d578063f2fde38b14610150578063f40d8d8f1461016f578063fc0c546a14610182575b600080fd5b341561009a57600080fd5b6100a2610195565b60405190815260200160405180910390f35b34156100bf57600080fd5b6100c7610203565b005b34156100d457600080fd5b6100c7600160a060020a0360043516610407565b34156100f357600080fd5b6100a2610531565b341561010657600080fd5b6100c7610594565b341561011957600080fd5b61012161068c565b604051600160a060020a03909116815260200160405180910390f35b341561014857600080fd5b61012161069b565b341561015b57600080fd5b6100c7600160a060020a03600435166106aa565b341561017a57600080fd5b6100c7610745565b341561018d57600080fd5b61012161091d565b600154600090600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156101e857600080fd5b5af115156101f557600080fd5b505050604051805191505090565b60005433600160a060020a0390811691161461021e57600080fd5b6001546002547f559f905937c3c2e4982bd603672e04f8f25340670d9467875cb718640c910fd491600160a060020a039081169163dd62ed3e9130911660405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156102a057600080fd5b5af115156102ad57600080fd5b5050506040518051600154909150600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561030857600080fd5b5af1151561031557600080fd5b5050506040518051905060405191825260208201526040908101905180910390a1600154600254600160a060020a039182169163095ea7b39116826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561039457600080fd5b5af115156103a157600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156103ee57600080fd5b5af115156103fb57600080fd5b50505060405180515050565b60005433600160a060020a0390811691161461042257600080fd5b600160a060020a038116151561043757600080fd5b6002547fe82c5f771e6fb2ea6051e875633d1c1931b70651b36d7ab2453427974caea3ba90600160a060020a031682604051600160a060020a039283168152911660208201526040908101905180910390a1600154600254600160a060020a039182169163095ea7b39116600060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156104e757600080fd5b5af115156104f457600080fd5b505050604051805150506002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03831617905561052e610203565b50565b600154600254600091600160a060020a039081169163dd62ed3e9130911660405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156101e857600080fd5b60005433600160a060020a039081169116146105af57600080fd5b600154600054600160a060020a039182169163a9059cbb9116826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561060d57600080fd5b5af1151561061a57600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561066757600080fd5b5af1151561067457600080fd5b50505060405180515050600054600160a060020a0316ff5b600054600160a060020a031681565b600254600160a060020a031681565b60005433600160a060020a039081169116146106c557600080fd5b600160a060020a03811615156106da57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080548190819033600160a060020a0390811691161461076557600080fd5b600154600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156107b557600080fd5b5af115156107c257600080fd5b5050506040518051600154600254919550600160a060020a03908116925063dd62ed3e9130911660405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561082e57600080fd5b5af1151561083b57600080fd5b505050604051805192506108579050838363ffffffff61092c16565b600154600254919250600160a060020a039081169163d73dd62391168360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156108b757600080fd5b5af115156108c457600080fd5b5050506040518051507f559f905937c3c2e4982bd603672e04f8f25340670d9467875cb718640c910fd4905082610901818463ffffffff61093e16565b60405191825260208201526040908101905180910390a1505050565b600154600160a060020a031681565b60008282111561093857fe5b50900390565b60008282018381101561094d57fe5b93925050505600a165627a7a723058203129564fbc3f7953e87cb435af6ba7ddf9211e9bac386c8d73e27425713322970029000000000000000000000000905e337c6c8645263d3521205aa37bf4d034e7450000000000000000000000004129c45b929cdb787deaae3d0e27ba5b5cd3e3ca
Deployed Bytecode
0x60606040526004361061008a5763ffffffff60e060020a6000350416630ef67887811461008f578063397986a1146100b45780636c5541b5146100c95780637040f3e5146100e857806383197ef0146100fb5780638da5cb5b1461010e578063e8edc8161461013d578063f2fde38b14610150578063f40d8d8f1461016f578063fc0c546a14610182575b600080fd5b341561009a57600080fd5b6100a2610195565b60405190815260200160405180910390f35b34156100bf57600080fd5b6100c7610203565b005b34156100d457600080fd5b6100c7600160a060020a0360043516610407565b34156100f357600080fd5b6100a2610531565b341561010657600080fd5b6100c7610594565b341561011957600080fd5b61012161068c565b604051600160a060020a03909116815260200160405180910390f35b341561014857600080fd5b61012161069b565b341561015b57600080fd5b6100c7600160a060020a03600435166106aa565b341561017a57600080fd5b6100c7610745565b341561018d57600080fd5b61012161091d565b600154600090600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156101e857600080fd5b5af115156101f557600080fd5b505050604051805191505090565b60005433600160a060020a0390811691161461021e57600080fd5b6001546002547f559f905937c3c2e4982bd603672e04f8f25340670d9467875cb718640c910fd491600160a060020a039081169163dd62ed3e9130911660405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156102a057600080fd5b5af115156102ad57600080fd5b5050506040518051600154909150600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561030857600080fd5b5af1151561031557600080fd5b5050506040518051905060405191825260208201526040908101905180910390a1600154600254600160a060020a039182169163095ea7b39116826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561039457600080fd5b5af115156103a157600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156103ee57600080fd5b5af115156103fb57600080fd5b50505060405180515050565b60005433600160a060020a0390811691161461042257600080fd5b600160a060020a038116151561043757600080fd5b6002547fe82c5f771e6fb2ea6051e875633d1c1931b70651b36d7ab2453427974caea3ba90600160a060020a031682604051600160a060020a039283168152911660208201526040908101905180910390a1600154600254600160a060020a039182169163095ea7b39116600060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156104e757600080fd5b5af115156104f457600080fd5b505050604051805150506002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03831617905561052e610203565b50565b600154600254600091600160a060020a039081169163dd62ed3e9130911660405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b15156101e857600080fd5b60005433600160a060020a039081169116146105af57600080fd5b600154600054600160a060020a039182169163a9059cbb9116826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561060d57600080fd5b5af1151561061a57600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561066757600080fd5b5af1151561067457600080fd5b50505060405180515050600054600160a060020a0316ff5b600054600160a060020a031681565b600254600160a060020a031681565b60005433600160a060020a039081169116146106c557600080fd5b600160a060020a03811615156106da57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080548190819033600160a060020a0390811691161461076557600080fd5b600154600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156107b557600080fd5b5af115156107c257600080fd5b5050506040518051600154600254919550600160a060020a03908116925063dd62ed3e9130911660405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561082e57600080fd5b5af1151561083b57600080fd5b505050604051805192506108579050838363ffffffff61092c16565b600154600254919250600160a060020a039081169163d73dd62391168360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156108b757600080fd5b5af115156108c457600080fd5b5050506040518051507f559f905937c3c2e4982bd603672e04f8f25340670d9467875cb718640c910fd4905082610901818463ffffffff61093e16565b60405191825260208201526040908101905180910390a1505050565b600154600160a060020a031681565b60008282111561093857fe5b50900390565b60008282018381101561094d57fe5b93925050505600a165627a7a723058203129564fbc3f7953e87cb435af6ba7ddf9211e9bac386c8d73e27425713322970029
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000905e337c6c8645263d3521205aa37bf4d034e7450000000000000000000000004129c45b929cdb787deaae3d0e27ba5b5cd3e3ca
-----Decoded View---------------
Arg [0] : _token (address): 0x905E337c6c8645263D3521205Aa37bf4d034e745
Arg [1] : _spender (address): 0x4129C45B929CDB787dEaae3D0e27ba5B5Cd3e3cA
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000905e337c6c8645263d3521205aa37bf4d034e745
Arg [1] : 0000000000000000000000004129c45b929cdb787deaae3d0e27ba5b5cd3e3ca
Swarm Source
bzzr://3129564fbc3f7953e87cb435af6ba7ddf9211e9bac386c8d73e2742571332297
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.