- Contract name:
- ERC20Template
- Optimization enabled
- true
- Compiler version
- v0.4.24+commit.e67f0147
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2021-12-01 19:40:36.562942Z
Constructor Arguments
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000115eec47f6cf7e350000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001753656e642061206265657220746f206120667269656e6400000000000000000000000000000000000000000000000000000000000000000000000000000000044245455200000000000000000000000000000000000000000000000000000000
Arg [0] (string) : Send a beer to a friend
Arg [1] (string) : BEER
Arg [2] (uint256) : 21000000000000000000000000
Arg [3] (uint8) : 18
Contract source code
pragma solidity ^0.4.24;
/**
* @dev Math operations with safety checks that throw on error. This contract is based
* on the source code at https://goo.gl/iyQsmU.
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
* @param _a Factor number.
* @param _b Factor number.
*/
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;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
* @param _a Dividend number.
* @param _b Divisor number.
*/
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;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
* @param _a Minuend number.
* @param _b Subtrahend number.
*/
function sub(
uint256 _a,
uint256 _b
)
internal
pure
returns (uint256)
{
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
* @param _a Number.
* @param _b Number.
*/
function add(
uint256 _a,
uint256 _b
)
internal
pure
returns (uint256)
{
uint256 c = _a + _b;
assert(c >= _a);
return c;
}
}
pragma solidity ^0.4.24;
/**
* @dev The contract has an owner address, and provides basic authorization control whitch
* simplifies the implementation of user permissions. This contract is based on the source code
* at https://goo.gl/n2ZGVt.
*/
contract Ownable {
address public owner;
/**
* @dev An event which is triggered when the owner is changed.
* @param previousOwner The address of the previous owner.
* @param newOwner The address of the new owner.
*/
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The constructor sets the original `owner` of the contract to the sender account.
*/
constructor()
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
)
onlyOwner
public
{
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
pragma solidity ^0.4.24;
/**
* @title A standard interface for tokens.
*/
interface ERC20Interface {
/**
* @dev Returns the name of the token.
*/
function name()
external
view
returns (string _name);
/**
* @dev Returns the symbol of the token.
*/
function symbol()
external
view
returns (string _symbol);
/**
* @dev Returns the number of decimals the token uses.
*/
function decimals()
external
view
returns (uint8 _decimals);
/**
* @dev Returns the total token supply.
*/
function totalSupply()
external
view
returns (uint256 _totalSupply);
/**
* @dev Returns the account balance of another account with address _owner.
* @param _owner The address from which the balance will be retrieved.
*/
function balanceOf(
address _owner
)
external
view
returns (uint256 _balance);
/**
* @dev Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The
* function SHOULD throw if the _from account balance does not have enough tokens to spend.
* @param _to The address of the recipient.
* @param _value The amount of token to be transferred.
*/
function transfer(
address _to,
uint256 _value
)
external
returns (bool _success);
/**
* @dev Transfers _value amount of tokens from address _from to address _to, and MUST fire the
* Transfer event.
* @param _from The address of the sender.
* @param _to The address of the recipient.
* @param _value The amount of token to be transferred.
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
external
returns (bool _success);
/**
* @dev Allows _spender to withdraw from your account multiple times, up to
* the _value amount. If this function is called again it overwrites the current
* allowance with _value.
* @param _spender The address of the account able to transfer the tokens.
* @param _value The amount of tokens to be approved for transfer.
*/
function approve(
address _spender,
uint256 _value
)
external
returns (bool _success);
/**
* @dev Returns the amount which _spender is still allowed to withdraw from _owner.
* @param _owner The address of the account owning tokens.
* @param _spender The address of the account able to transfer the tokens.
*/
function allowance(
address _owner,
address _spender
)
external
view
returns (uint256 _remaining);
/**
* @dev Triggers when tokens are transferred, including zero value transfers.
*/
event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
/**
* @dev Triggers on any successful call to approve(address _spender, uint256 _value).
*/
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
}
pragma solidity ^0.4.24;
/**
* @title ERC20 standard token implementation.
* @dev Standard ERC20 token. This contract follows the implementation at https://goo.gl/mLbAPJ.
*/
contract ERC20Template is
ERC20Interface,
Ownable
{
using SafeMath for uint256;
/**
* Token name.
*/
string internal tokenName;
/**
* Token symbol.
*/
string internal tokenSymbol;
/**
* Number of decimals.
*/
uint8 internal tokenDecimals;
/**
* Total supply of tokens.
*/
uint256 internal tokenTotalSupply;
/**
* Balance information map.
*/
mapping (address => uint256) internal balances;
/**
* Token allowance mapping.
*/
mapping (address => mapping (address => uint256)) internal allowed;
event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
/**
* @dev Trigger on any successful call to approve(address _spender, uint256 _value).
*/
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
constructor(string _name,string _symbol,uint256 _totalSupply,uint8 _tokenDecimals)
public
{
tokenName = _name;
tokenSymbol = _symbol;
tokenDecimals = _tokenDecimals;
tokenTotalSupply = _totalSupply;
balances[msg.sender] = tokenTotalSupply;
emit Transfer(address(0), msg.sender, tokenTotalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name()
external
view
returns (string _name)
{
_name = tokenName;
}
/**
* @dev Returns the symbol of the token.
*/
function symbol()
external
view
returns (string _symbol)
{
_symbol = tokenSymbol;
}
/**
* @dev Returns the number of decimals the token uses.
*/
function decimals()
external
view
returns (uint8 _decimals)
{
_decimals = tokenDecimals;
}
/**
* @dev Returns the total token supply.
*/
function totalSupply()
external
view
returns (uint256 _totalSupply)
{
_totalSupply = tokenTotalSupply;
}
/**
* @dev Returns the account balance of another account with address _owner.
* @param _owner The address from which the balance will be retrieved.
*/
function balanceOf(
address _owner
)
external
view
returns (uint256 _balance)
{
_balance = balances[_owner];
}
/**
* @dev Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The
* function SHOULD throw if the _from account balance does not have enough tokens to spend.
* @param _to The address of the recipient.
* @param _value The amount of token to be transferred.
*/
function transfer(
address _to,
uint256 _value
)
public
returns (bool _success)
{
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
_success = true;
}
/**
* @dev Allows _spender to withdraw from your account multiple times, up to the _value amount. If
* this function is called again it overwrites the current allowance with _value.
* @param _spender The address of the account able to transfer the tokens.
* @param _value The amount of tokens to be approved for transfer.
*/
function approve(
address _spender,
uint256 _value
)
public
returns (bool _success)
{
require(_spender != address(0), "_spender address invalid");
require(_value <= balances[msg.sender], "approve value could not more than balance");
allowed[msg.sender][_spender] =allowed[msg.sender][_spender].add(_value) ;
emit Approval(msg.sender, _spender, _value);
_success = true;
}
/**
* @dev Returns the amount which _spender is still allowed to withdraw from _owner.
* @param _owner The address of the account owning tokens.
* @param _spender The address of the account able to transfer the tokens.
*/
function allowance(
address _owner,
address _spender
)
external
view
returns (uint256 _remaining)
{
_remaining = allowed[_owner][_spender];
}
/**
* @dev Transfers _value amount of tokens from address _from to address _to, and MUST fire the
* Transfer event.
* @param _from The address of the sender.
* @param _to The address of the recipient.
* @param _value The amount of token to be transferred.
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool _success)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
_success = true;
}
}
Contract ABI
[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"_name"}],"name":"name","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"_success"}],"name":"approve","inputs":[{"type":"address","name":"_spender"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"_totalSupply"}],"name":"totalSupply","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"_success"}],"name":"transferFrom","inputs":[{"type":"address","name":"_from"},{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint8","name":"_decimals"}],"name":"decimals","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"_balance"}],"name":"balanceOf","inputs":[{"type":"address","name":"_owner"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"owner","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"string","name":"_symbol"}],"name":"symbol","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"bool","name":"_success"}],"name":"transfer","inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"_remaining"}],"name":"allowance","inputs":[{"type":"address","name":"_owner"},{"type":"address","name":"_spender"}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"_newOwner"}],"constant":false},{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"string","name":"_name"},{"type":"string","name":"_symbol"},{"type":"uint256","name":"_totalSupply"},{"type":"uint8","name":"_tokenDecimals"}]},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"_from","indexed":true},{"type":"address","name":"_to","indexed":true},{"type":"uint256","name":"_value","indexed":false}],"anonymous":false},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"_owner","indexed":true},{"type":"address","name":"_spender","indexed":true},{"type":"uint256","name":"_value","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false}]
Deployed ByteCode
0x6080604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b3578063095ea7b31461013d57806318160ddd1461017557806323b872dd1461019c578063313ce567146101c657806370a08231146101f15780638da5cb5b1461021257806395d89b4114610243578063a9059cbb14610258578063dd62ed3e1461027c578063f2fde38b146102a3575b600080fd5b3480156100bf57600080fd5b506100c86102c6565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101025781810151838201526020016100ea565b50505050905090810190601f16801561012f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014957600080fd5b50610161600160a060020a036004351660243561035b565b604080519115158252519081900360200190f35b34801561018157600080fd5b5061018a610513565b60408051918252519081900360200190f35b3480156101a857600080fd5b50610161600160a060020a0360043581169060243516604435610519565b3480156101d257600080fd5b506101db61067b565b6040805160ff9092168252519081900360200190f35b3480156101fd57600080fd5b5061018a600160a060020a0360043516610684565b34801561021e57600080fd5b5061022761069f565b60408051600160a060020a039092168252519081900360200190f35b34801561024f57600080fd5b506100c86106ae565b34801561026457600080fd5b50610161600160a060020a036004351660243561070c565b34801561028857600080fd5b5061018a600160a060020a03600435811690602435166107ed565b3480156102af57600080fd5b506102c4600160a060020a0360043516610818565b005b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156103515780601f1061032657610100808354040283529160200191610351565b820191906000526020600020905b81548152906001019060200180831161033457829003601f168201915b5050505050905090565b6000600160a060020a03831615156103d457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f5f7370656e646572206164647265737320696e76616c69640000000000000000604482015290519081900360640190fd5b3360009081526005602052604090205482111561047857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f617070726f76652076616c756520636f756c64206e6f74206d6f72652074686160448201527f6e2062616c616e63650000000000000000000000000000000000000000000000606482015290519081900360840190fd5b336000908152600660209081526040808320600160a060020a03871684529091529020546104ac908363ffffffff6108ac16565b336000818152600660209081526040808320600160a060020a03891680855290835292819020949094558351868152935191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b60045490565b600160a060020a03831660009081526005602052604081205482111561053e57600080fd5b600160a060020a038416600090815260066020908152604080832033845290915290205482111561056e57600080fd5b600160a060020a038416600090815260056020526040902054610597908363ffffffff6108c216565b600160a060020a0380861660009081526005602052604080822093909355908516815220546105cc908363ffffffff6108ac16565b600160a060020a038085166000908152600560209081526040808320949094559187168152600682528281203382529091522054610610908363ffffffff6108c216565b600160a060020a03808616600081815260066020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60035460ff1690565b600160a060020a031660009081526005602052604090205490565b600054600160a060020a031681565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156103515780601f1061032657610100808354040283529160200191610351565b3360009081526005602052604081205482111561072857600080fd5b600160a060020a038316151561073d57600080fd5b3360009081526005602052604090205461075d908363ffffffff6108c216565b3360009081526005602052604080822092909255600160a060020a0385168152205461078f908363ffffffff6108ac16565b600160a060020a0384166000818152600560209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b600054600160a060020a0316331461082f57600080fd5b600160a060020a038116151561084457600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000828201838110156108bb57fe5b9392505050565b6000828211156108ce57fe5b509003905600a165627a7a723058203843767a7beeb61e9ae0838c157a42abfa72818c746a40451b1557774de9fb080029