Transaction Hash:
Block:
17519917 at Jun-20-2023 09:07:47 AM +UTC
Transaction Fee:
0.000399356656852412 ETH
$1.10
Gas Used:
28,588 Gas / 13.969380749 Gwei
Emitted Events:
171 |
ERC20TRX.Approval( owner=[Sender] 0x94830e3469cd3c9e42e8851872107f147e41ac92, spender=0x68b34658...D8665Fc45, value=0 )
|
Account State Difference:
Address | Before | After | State Difference | ||
---|---|---|---|---|---|
0x94830E34...47e41ac92 |
0.202853862238915207 Eth
Nonce: 78
|
0.202454505582062795 Eth
Nonce: 79
| 0.000399356656852412 | ||
0xE1Be5D3f...884dA6c67 | |||||
0xFeebabE6...Dd4f70CeA
Miner
| (eth-builder) | 33.479976907189118293 Eth | 33.479979765989118293 Eth | 0.0000028588 |
Execution Trace
ERC20TRX.approve( _spender=0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45, _value=0 ) => ( True )
{"BasicToken.sol":{"content":"pragma solidity ^0.4.18;\n\n\nimport \u0027./SafeMath.sol\u0027;\n\n/**\n * @title ERC20Basic\n * @dev Simpler version of ERC20 interface\n */\ncontract ERC20Basic {\n function totalSupply() public constant returns (uint);\n function balanceOf(address who) public view returns (uint256);\n function transfer(address to, uint256 value) public returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n}\n\n/**\n * @title Basic token\n * @dev Basic version of StandardToken, with no allowances.\n */\ncontract BasicToken is ERC20Basic {\n using SafeMath for uint256;\n\n mapping(address =\u003e uint256) balances;\n\n /**\n * @dev transfer token for a specified address\n * @param _to The address to transfer to.\n * @param _value The amount to be transferred.\n */\n function transfer(address _to, uint256 _value) public returns (bool) {\n require(_to != address(0));\n require(_value \u003c= balances[msg.sender]);\n\n // SafeMath.sub will throw if there is not enough balance.\n balances[msg.sender] = balances[msg.sender].sub(_value);\n balances[_to] = balances[_to].add(_value);\n Transfer(msg.sender, _to, _value);\n return true;\n }\n\n /**\n * @dev Gets the balance of the specified address.\n * @param _owner The address to query the the balance of.\n * @return An uint256 representing the amount owned by the passed address.\n */\n function balanceOf(address _owner) public view returns (uint256 balance) {\n return balances[_owner];\n }\n\n}\n"},"BlackList.sol":{"content":"pragma solidity ^0.4.18;\n\nimport \"./Ownable.sol\";\n\ncontract BlackList is Ownable {\n\n function getBlackListStatus(address _maker) external constant returns (bool) {\n return isBlackListed[_maker];\n }\n\n mapping (address =\u003e bool) public isBlackListed;\n\n function addBlackList (address _evilUser) public onlyOwner {\n isBlackListed[_evilUser] = true;\n AddedBlackList(_evilUser);\n }\n\n function removeBlackList (address _clearedUser) public onlyOwner {\n isBlackListed[_clearedUser] = false;\n RemovedBlackList(_clearedUser);\n }\n\n event AddedBlackList(address indexed _user);\n\n event RemovedBlackList(address indexed _user);\n\n}\n"},"ERC20TRX.sol":{"content":"pragma solidity ^0.4.18;\n\nimport \"./StandardTokenWithFees.sol\";\nimport \"./Pausable.sol\";\nimport \"./BlackList.sol\";\n\ncontract UpgradedStandardToken is StandardToken {\n // those methods are called by the legacy contract\n // and they must ensure msg.sender to be the contract address\n uint public _totalSupply;\n function transferByLegacy(address from, address to, uint value) public returns (bool);\n function transferFromByLegacy(address sender, address from, address spender, uint value) public returns (bool);\n function approveByLegacy(address from, address spender, uint value) public returns (bool);\n function increaseApprovalByLegacy(address from, address spender, uint addedValue) public returns (bool);\n function decreaseApprovalByLegacy(address from, address spender, uint subtractedValue) public returns (bool);\n}\n\n/**\n * ERC20 TRON Token (TRX)\n */\n\ncontract ERC20TRX is Pausable, StandardTokenWithFees, BlackList {\n\n address public upgradedAddress;\n bool public deprecated;\n\n // The contract can be initialized with a number of tokens\n // All the tokens are deposited to the owner address\n function ERC20TRX() public {\n _totalSupply = 0; \n name = \"TRON\";\n symbol = \"TRX\";\n decimals = 6;\n deprecated = false;\n }\n\n // Forward ERC20 methods to upgraded contract if this one is deprecated\n function transfer(address _to, uint _value) public whenNotPaused returns (bool) {\n require(!isBlackListed[msg.sender]);\n if (deprecated) {\n return UpgradedStandardToken(upgradedAddress).transferByLegacy(msg.sender, _to, _value);\n } else {\n return super.transfer(_to, _value);\n }\n }\n\n // Forward ERC20 methods to upgraded contract if this one is deprecated\n function transferFrom(address _from, address _to, uint _value) public whenNotPaused returns (bool) {\n require(!isBlackListed[_from]);\n if (deprecated) {\n return UpgradedStandardToken(upgradedAddress).transferFromByLegacy(msg.sender, _from, _to, _value);\n } else {\n return super.transferFrom(_from, _to, _value);\n }\n }\n\n // Forward ERC20 methods to upgraded contract if this one is deprecated\n function balanceOf(address who) public constant returns (uint) {\n if (deprecated) {\n return UpgradedStandardToken(upgradedAddress).balanceOf(who);\n } else {\n return super.balanceOf(who);\n }\n }\n\n // Allow checks of balance at time of deprecation\n function oldBalanceOf(address who) public constant returns (uint) {\n if (deprecated) {\n return super.balanceOf(who);\n }\n }\n\n // Forward ERC20 methods to upgraded contract if this one is deprecated\n function approve(address _spender, uint _value) public whenNotPaused returns (bool) {\n if (deprecated) {\n return UpgradedStandardToken(upgradedAddress).approveByLegacy(msg.sender, _spender, _value);\n } else {\n return super.approve(_spender, _value);\n }\n }\n\n function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool) {\n if (deprecated) {\n return UpgradedStandardToken(upgradedAddress).increaseApprovalByLegacy(msg.sender, _spender, _addedValue);\n } else {\n return super.increaseApproval(_spender, _addedValue);\n }\n }\n\n function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool) {\n if (deprecated) {\n return UpgradedStandardToken(upgradedAddress).decreaseApprovalByLegacy(msg.sender, _spender, _subtractedValue);\n } else {\n return super.decreaseApproval(_spender, _subtractedValue);\n }\n }\n\n // Forward ERC20 methods to upgraded contract if this one is deprecated\n function allowance(address _owner, address _spender) public constant returns (uint remaining) {\n if (deprecated) {\n return StandardToken(upgradedAddress).allowance(_owner, _spender);\n } else {\n return super.allowance(_owner, _spender);\n }\n }\n\n // deprecate current contract in favour of a new one\n function deprecate(address _upgradedAddress) public onlyOwner {\n require(_upgradedAddress != address(0));\n deprecated = true;\n upgradedAddress = _upgradedAddress;\n Deprecate(_upgradedAddress);\n }\n\n // deprecate current contract if favour of a new one\n function totalSupply() public constant returns (uint) {\n if (deprecated) {\n return StandardToken(upgradedAddress).totalSupply();\n } else {\n return _totalSupply;\n }\n }\n\n // Issue a new amount of tokens\n // these tokens are deposited into the owner address\n //\n // @param _amount Number of tokens to be issued\n function issue(uint amount) public onlyOwner {\n balances[owner] = balances[owner].add(amount);\n _totalSupply = _totalSupply.add(amount);\n Issue(amount);\n Transfer(address(0), owner, amount);\n }\n\n // Redeem tokens.\n // These tokens are withdrawn from the owner address\n // if the balance must be enough to cover the redeem\n // or the call will fail.\n // @param _amount Number of tokens to be issued\n function redeem(uint amount) public onlyOwner {\n _totalSupply = _totalSupply.sub(amount);\n balances[owner] = balances[owner].sub(amount);\n Redeem(amount);\n Transfer(owner, address(0), amount);\n }\n\n function destroyBlackFunds (address _blackListedUser) public onlyOwner {\n require(isBlackListed[_blackListedUser]);\n uint dirtyFunds = balanceOf(_blackListedUser);\n balances[_blackListedUser] = 0;\n _totalSupply = _totalSupply.sub(dirtyFunds);\n DestroyedBlackFunds(_blackListedUser, dirtyFunds);\n }\n\n event DestroyedBlackFunds(address indexed _blackListedUser, uint _balance);\n\n // Called when new token are issued\n event Issue(uint amount);\n\n // Called when tokens are redeemed\n event Redeem(uint amount);\n\n // Called when contract is deprecated\n event Deprecate(address newAddress);\n\n}\n"},"Migrations.sol":{"content":"pragma solidity ^0.4.4;\n/* solhint-disable var-name-mixedcase */\n\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function Migrations() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address newAddress) public restricted {\n Migrations upgraded = Migrations(newAddress);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n"},"MultiSigWallet.sol":{"content":"pragma solidity ^0.4.10;\n\n/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.\n/// @author Stefan George - \[email protected]\u003e\ncontract MultiSigWallet {\n\n uint constant public MAX_OWNER_COUNT = 50;\n\n event Confirmation(address indexed sender, uint indexed transactionId);\n event Revocation(address indexed sender, uint indexed transactionId);\n event Submission(uint indexed transactionId);\n event Execution(uint indexed transactionId);\n event ExecutionFailure(uint indexed transactionId);\n event Deposit(address indexed sender, uint value);\n event OwnerAddition(address indexed owner);\n event OwnerRemoval(address indexed owner);\n event RequirementChange(uint required);\n\n mapping (uint =\u003e Transaction) public transactions;\n mapping (uint =\u003e mapping (address =\u003e bool)) public confirmations;\n mapping (address =\u003e bool) public isOwner;\n address[] public owners;\n uint public required;\n uint public transactionCount;\n\n struct Transaction {\n address destination;\n uint value;\n bytes data;\n bool executed;\n }\n\n modifier onlyWallet() {\n if (msg.sender != address(this))\n throw;\n _;\n }\n\n modifier ownerDoesNotExist(address owner) {\n if (isOwner[owner])\n throw;\n _;\n }\n\n modifier ownerExists(address owner) {\n if (!isOwner[owner])\n throw;\n _;\n }\n\n modifier transactionExists(uint transactionId) {\n if (transactions[transactionId].destination == 0)\n throw;\n _;\n }\n\n modifier confirmed(uint transactionId, address owner) {\n if (!confirmations[transactionId][owner])\n throw;\n _;\n }\n\n modifier notConfirmed(uint transactionId, address owner) {\n if (confirmations[transactionId][owner])\n throw;\n _;\n }\n\n modifier notExecuted(uint transactionId) {\n if (transactions[transactionId].executed)\n throw;\n _;\n }\n\n modifier notNull(address _address) {\n if (_address == 0)\n throw;\n _;\n }\n\n modifier validRequirement(uint ownerCount, uint _required) {\n if ( ownerCount \u003e MAX_OWNER_COUNT\n || _required \u003e ownerCount\n || _required == 0\n || ownerCount == 0)\n throw;\n _;\n }\n\n /// @dev Fallback function allows to deposit ether.\n function()\n payable\n {\n if (msg.value \u003e 0)\n Deposit(msg.sender, msg.value);\n }\n\n /*\n * Public functions\n */\n /// @dev Contract constructor sets initial owners and required number of confirmations.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n function MultiSigWallet(address[] _owners, uint _required)\n public\n validRequirement(_owners.length, _required)\n {\n for (uint i=0; i\u003c_owners.length; i++) {\n if (isOwner[_owners[i]] || _owners[i] == 0)\n throw;\n isOwner[_owners[i]] = true;\n }\n owners = _owners;\n required = _required;\n }\n\n /// @dev Allows to add a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of new owner.\n function addOwner(address owner)\n public\n onlyWallet\n ownerDoesNotExist(owner)\n notNull(owner)\n validRequirement(owners.length + 1, required)\n {\n isOwner[owner] = true;\n owners.push(owner);\n OwnerAddition(owner);\n }\n\n /// @dev Allows to remove an owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner.\n function removeOwner(address owner)\n public\n onlyWallet\n ownerExists(owner)\n {\n isOwner[owner] = false;\n for (uint i=0; i\u003cowners.length - 1; i++)\n if (owners[i] == owner) {\n owners[i] = owners[owners.length - 1];\n break;\n }\n owners.length -= 1;\n if (required \u003e owners.length)\n changeRequirement(owners.length);\n OwnerRemoval(owner);\n }\n\n /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner to be replaced.\n /// @param owner Address of new owner.\n function replaceOwner(address owner, address newOwner)\n public\n onlyWallet\n ownerExists(owner)\n ownerDoesNotExist(newOwner)\n {\n for (uint i=0; i\u003cowners.length; i++)\n if (owners[i] == owner) {\n owners[i] = newOwner;\n break;\n }\n isOwner[owner] = false;\n isOwner[newOwner] = true;\n OwnerRemoval(owner);\n OwnerAddition(newOwner);\n }\n\n /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.\n /// @param _required Number of required confirmations.\n function changeRequirement(uint _required)\n public\n onlyWallet\n validRequirement(owners.length, _required)\n {\n required = _required;\n RequirementChange(_required);\n }\n\n /// @dev Allows an owner to submit and confirm a transaction.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function submitTransaction(address destination, uint value, bytes data)\n public\n returns (uint transactionId)\n {\n transactionId = addTransaction(destination, value, data);\n confirmTransaction(transactionId);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n {\n confirmations[transactionId][msg.sender] = true;\n Confirmation(msg.sender, transactionId);\n executeTransaction(transactionId);\n }\n\n /// @dev Allows an owner to revoke a confirmation for a transaction.\n /// @param transactionId Transaction ID.\n function revokeConfirmation(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n confirmations[transactionId][msg.sender] = false;\n Revocation(msg.sender, transactionId);\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint transactionId)\n public\n notExecuted(transactionId)\n {\n if (isConfirmed(transactionId)) {\n Transaction tx = transactions[transactionId];\n tx.executed = true;\n if (tx.destination.call.value(tx.value)(tx.data))\n Execution(transactionId);\n else {\n ExecutionFailure(transactionId);\n tx.executed = false;\n }\n }\n }\n\n /// @dev Returns the confirmation status of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Confirmation status.\n function isConfirmed(uint transactionId)\n public\n constant\n returns (bool)\n {\n uint count = 0;\n for (uint i=0; i\u003cowners.length; i++) {\n if (confirmations[transactionId][owners[i]])\n count += 1;\n if (count == required)\n return true;\n }\n }\n\n /*\n * Internal functions\n */\n /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function addTransaction(address destination, uint value, bytes data)\n internal\n notNull(destination)\n returns (uint transactionId)\n {\n transactionId = transactionCount;\n transactions[transactionId] = Transaction({\n destination: destination,\n value: value,\n data: data,\n executed: false\n });\n transactionCount += 1;\n Submission(transactionId);\n }\n\n /*\n * Web3 call functions\n */\n /// @dev Returns number of confirmations of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Number of confirmations.\n function getConfirmationCount(uint transactionId)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i\u003cowners.length; i++)\n if (confirmations[transactionId][owners[i]])\n count += 1;\n }\n\n /// @dev Returns total number of transactions after filers are applied.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Total number of transactions after filters are applied.\n function getTransactionCount(bool pending, bool executed)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i\u003ctransactionCount; i++)\n if ( pending \u0026\u0026 !transactions[i].executed\n || executed \u0026\u0026 transactions[i].executed)\n count += 1;\n }\n\n /// @dev Returns list of owners.\n /// @return List of owner addresses.\n function getOwners()\n public\n constant\n returns (address[])\n {\n return owners;\n }\n\n /// @dev Returns array with owner addresses, which confirmed transaction.\n /// @param transactionId Transaction ID.\n /// @return Returns array of owner addresses.\n function getConfirmations(uint transactionId)\n public\n constant\n returns (address[] _confirmations)\n {\n address[] memory confirmationsTemp = new address[](owners.length);\n uint count = 0;\n uint i;\n for (i=0; i\u003cowners.length; i++)\n if (confirmations[transactionId][owners[i]]) {\n confirmationsTemp[count] = owners[i];\n count += 1;\n }\n _confirmations = new address[](count);\n for (i=0; i\u003ccount; i++)\n _confirmations[i] = confirmationsTemp[i];\n }\n\n /// @dev Returns list of transaction IDs in defined range.\n /// @param from Index start position of transaction array.\n /// @param to Index end position of transaction array.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Returns array of transaction IDs.\n function getTransactionIds(uint from, uint to, bool pending, bool executed)\n public\n constant\n returns (uint[] _transactionIds)\n {\n uint[] memory transactionIdsTemp = new uint[](transactionCount);\n uint count = 0;\n uint i;\n for (i=0; i\u003ctransactionCount; i++)\n if ( pending \u0026\u0026 !transactions[i].executed\n || executed \u0026\u0026 transactions[i].executed)\n {\n transactionIdsTemp[count] = i;\n count += 1;\n }\n _transactionIds = new uint[](to - from);\n for (i=from; i\u003cto; i++)\n _transactionIds[i - from] = transactionIdsTemp[i];\n }\n}\n"},"Ownable.sol":{"content":"pragma solidity ^0.4.18;\n\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n address public owner;\n\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n\n /**\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n * account.\n */\n function Ownable() public {\n owner = msg.sender;\n }\n\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n\n /**\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\n * @param newOwner The address to transfer ownership to.\n */\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0));\n OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n}\n"},"Pausable.sol":{"content":"pragma solidity ^0.4.18;\n\n\nimport \"./Ownable.sol\";\n\n\n/**\n * @title Pausable\n * @dev Base contract which allows children to implement an emergency stop mechanism.\n */\ncontract Pausable is Ownable {\n event Pause();\n event Unpause();\n\n bool public paused = false;\n\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n */\n modifier whenNotPaused() {\n require(!paused);\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n */\n modifier whenPaused() {\n require(paused);\n _;\n }\n\n /**\n * @dev called by the owner to pause, triggers stopped state\n */\n function pause() onlyOwner whenNotPaused public {\n paused = true;\n Pause();\n }\n\n /**\n * @dev called by the owner to unpause, returns to normal state\n */\n function unpause() onlyOwner whenPaused public {\n paused = false;\n Unpause();\n }\n}\n"},"SafeMath.sol":{"content":"pragma solidity ^0.4.18;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMath {\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n assert(c / a == b);\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // assert(b \u003e 0); // Solidity automatically throws when dividing by 0\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn\u0027t hold\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n assert(b \u003c= a);\n return a - b;\n }\n\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n assert(c \u003e= a);\n return c;\n }\n}\n"},"StandardToken.sol":{"content":"pragma solidity ^0.4.18;\n\n\nimport \u0027./BasicToken.sol\u0027;\n\n\n/**\n * @title ERC20 interface\n */\ncontract ERC20 is ERC20Basic {\n function allowance(address owner, address spender) public view returns (uint256);\n function transferFrom(address from, address to, uint256 value) public returns (bool);\n function approve(address spender, uint256 value) public returns (bool);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\n/**\n * @title Standard ERC20 token\n *\n * @dev Implementation of the basic standard token.\n */\ncontract StandardToken is ERC20, BasicToken {\n\n mapping (address =\u003e mapping (address =\u003e uint256)) internal allowed;\n\n\n /**\n * @dev Transfer tokens from one address to another\n * @param _from address The address which you want to send tokens from\n * @param _to address The address which you want to transfer to\n * @param _value uint256 the amount of tokens to be transferred\n */\n function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {\n require(_to != address(0));\n require(_value \u003c= balances[_from]);\n require(_value \u003c= allowed[_from][msg.sender]);\n\n balances[_from] = balances[_from].sub(_value);\n balances[_to] = balances[_to].add(_value);\n allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);\n Transfer(_from, _to, _value);\n return true;\n }\n\n /**\n * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.\n *\n * Beware that changing an allowance with this method brings the risk that someone may use both the old\n * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this\n * race condition is to first reduce the spender\u0027s allowance to 0 and set the desired value afterwards:\n * @param _spender The address which will spend the funds.\n * @param _value The amount of tokens to be spent.\n */\n function approve(address _spender, uint256 _value) public returns (bool) {\n allowed[msg.sender][_spender] = _value;\n Approval(msg.sender, _spender, _value);\n return true;\n }\n\n /**\n * @dev Function to check the amount of tokens that an owner allowed to a spender.\n * @param _owner address The address which owns the funds.\n * @param _spender address The address which will spend the funds.\n * @return A uint256 specifying the amount of tokens still available for the spender.\n */\n function allowance(address _owner, address _spender) public view returns (uint256) {\n return allowed[_owner][_spender];\n }\n\n /**\n * approve should be called when allowed[_spender] == 0. To increment\n * allowed value is better to use this function to avoid 2 calls (and wait until\n * the first transaction is mined)\n * From MonolithDAO Token.sol\n */\n function increaseApproval(address _spender, uint _addedValue) public returns (bool) {\n allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);\n Approval(msg.sender, _spender, allowed[msg.sender][_spender]);\n return true;\n }\n\n function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {\n uint oldValue = allowed[msg.sender][_spender];\n if (_subtractedValue \u003e oldValue) {\n allowed[msg.sender][_spender] = 0;\n } else {\n allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);\n }\n Approval(msg.sender, _spender, allowed[msg.sender][_spender]);\n return true;\n }\n\n}\n"},"StandardTokenWithFees.sol":{"content":"pragma solidity ^0.4.18;\n\nimport \"./StandardToken.sol\";\nimport \"./Ownable.sol\";\n\ncontract StandardTokenWithFees is StandardToken, Ownable {\n\n // Additional variables for use if transaction fees ever became necessary\n uint256 public basisPointsRate = 0;\n uint256 public maximumFee = 0;\n uint256 constant MAX_SETTABLE_BASIS_POINTS = 20;\n uint256 constant MAX_SETTABLE_FEE = 50;\n\n string public name;\n string public symbol;\n uint8 public decimals;\n uint public _totalSupply;\n\n uint public constant MAX_UINT = 2**256 - 1;\n\n function calcFee(uint _value) constant returns (uint) {\n uint fee = (_value.mul(basisPointsRate)).div(10000);\n if (fee \u003e maximumFee) {\n fee = maximumFee;\n }\n return fee;\n }\n\n function transfer(address _to, uint _value) public returns (bool) {\n uint fee = calcFee(_value);\n uint sendAmount = _value.sub(fee);\n\n super.transfer(_to, sendAmount);\n if (fee \u003e 0) {\n super.transfer(owner, fee);\n }\n return true;\n }\n\n function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {\n require(_to != address(0));\n require(_value \u003c= balances[_from]);\n require(_value \u003c= allowed[_from][msg.sender]);\n\n uint fee = calcFee(_value);\n uint sendAmount = _value.sub(fee);\n\n balances[_from] = balances[_from].sub(_value);\n balances[_to] = balances[_to].add(sendAmount);\n if (allowed[_from][msg.sender] \u003c MAX_UINT) {\n allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);\n }\n Transfer(_from, _to, sendAmount);\n if (fee \u003e 0) {\n balances[owner] = balances[owner].add(fee);\n Transfer(_from, owner, fee);\n }\n return true;\n }\n\n function setParams(uint newBasisPoints, uint newMaxFee) public onlyOwner {\n // Ensure transparency by hardcoding limit beyond which fees can never be added\n require(newBasisPoints \u003c MAX_SETTABLE_BASIS_POINTS);\n require(newMaxFee \u003c MAX_SETTABLE_FEE);\n\n basisPointsRate = newBasisPoints;\n maximumFee = newMaxFee.mul(uint(10)**decimals);\n\n Params(basisPointsRate, maximumFee);\n }\n\n // Called if contract ever adds fees\n event Params(uint feeBasisPoints, uint maxFee);\n\n}\n"}}