Address Contract Partially Verified
Address
0x7A647637E75d34A7798Ba06BD1aDF5c084bb5dd5
Balance
0 ETH
Nonce
1
Code Size
4430 bytes
Creator
0x8e40C7F1...d243 at tx 0xa08f2473...e0db1d
Indexed Transactions
0
Contract Bytecode
4430 bytes
0x608060405234801561001057600080fd5b50600436106101985760003560e01c806370a08231116100e3578063a457c2d71161008c578063dd62ed3e11610066578063dd62ed3e14610493578063e79a198f146104c1578063f2fde38b146104c957610198565b8063a457c2d714610433578063a9059cbb1461045f578063cbafee8a1461048b57610198565b80638da5cb5b116100bd5780638da5cb5b1461041b5780638f32d59b1461042357806395d89b411461042b57610198565b806370a08231146103c957806370d5ae05146103ef578063715018a61461041357610198565b806339509351116101455780634b0e72161161011f5780634b0e7216146103475780635f3e849f1461036d5780635fb9cf20146103a357610198565b806339509351146102d257806340c10f19146102fe57806342966c681461032a57610198565b80631aa3a008116101765780631aa3a0081461027457806323b872dd1461027e578063313ce567146102b457610198565b806306fdde031461019d578063095ea7b31461021a57806318160ddd1461025a575b600080fd5b6101a56104ef565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101df5781810151838201526020016101c7565b50505050905090810190601f16801561020c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102466004803603604081101561023057600080fd5b506001600160a01b038135169060200135610528565b604080519115158252519081900360200190f35b61026261053e565b60408051918252519081900360200190f35b61027c610544565b005b6102466004803603606081101561029457600080fd5b506001600160a01b03813581169160208101359091169060400135610560565b6102bc610589565b6040805160ff9092168252519081900360200190f35b610246600480360360408110156102e857600080fd5b506001600160a01b03813516906020013561058e565b6102466004803603604081101561031457600080fd5b506001600160a01b0381351690602001356105cf565b61027c6004803603602081101561034057600080fd5b503561067a565b61027c6004803603602081101561035d57600080fd5b50356001600160a01b03166106e9565b61027c6004803603606081101561038357600080fd5b506001600160a01b03813581169160208101359091169060400135610771565b610246600480360360208110156103b957600080fd5b50356001600160a01b0316610875565b610262600480360360208110156103df57600080fd5b50356001600160a01b031661088a565b6103f76108a5565b604080516001600160a01b039092168252519081900360200190f35b61027c6108b4565b6103f761091c565b61024661092b565b6101a561093c565b6102466004803603604081101561044957600080fd5b506001600160a01b038135169060200135610975565b6102466004803603604081101561047557600080fd5b506001600160a01b0381351690602001356109b1565b6102626109d8565b610262600480360360408110156104a957600080fd5b506001600160a01b03813581169160200135166109de565b61027c610a09565b61027c600480360360208110156104df57600080fd5b50356001600160a01b0316610a22565b6040518060400160405280600881526020017f425359546f6b656e00000000000000000000000000000000000000000000000081525081565b6000610535338484610a3c565b50600192915050565b60035490565b336000908152600660205260409020805460ff19166001179055565b60008061056e858585610ac4565b9050801561058157610581858585610b16565b949350505050565b601281565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916105359185906105ca908663ffffffff610c1016565b610a3c565b60006105d961092b565b6105e257600080fd5b6004546000906105f8908463ffffffff610c2216565b101561064e5760408051600160e51b62461bcd02815260206004820152601660248201527f4e6f7420656e6f75676820746f6b656e73206c65667400000000000000000000604482015290519081900360640190fd5b600454610661908363ffffffff610c2216565b60045561066e8383610c37565b61053560008484610b16565b6005546001600160a01b031633146106dc5760408051600160e51b62461bcd02815260206004820181905260248201527f4f6e6c79206275726e416464726573732063616e206275726e20746f6b656e73604482015290519081900360640190fd5b6106e63382610ce1565b50565b6106f161092b565b6106fa57600080fd5b6107038161088a565b1561074257604051600160e51b62461bcd0281526004018080602001828103825260248152602001806110ac6024913960400191505060405180910390fd5b6005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61077961092b565b61078257600080fd5b604080517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290516000916001600160a01b038616916370a0823191602480820192602092909190829003018186803b1580156107e557600080fd5b505afa1580156107f9573d6000803e3d6000fd5b505050506040513d602081101561080f57600080fd5b505190508181101561085557604051600160e51b62461bcd02815260040180806020018281038252602b8152602001806110f8602b913960400191505060405180910390fd5b61086f6001600160a01b038516848463ffffffff610d3116565b50505050565b60066020526000908152604090205460ff1681565b6001600160a01b031660009081526001602052604090205490565b6005546001600160a01b031681565b6108bc61092b565b6108c557600080fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b6040518060400160405280600381526020017f425359000000000000000000000000000000000000000000000000000000000081525081565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916105359185906105ca908663ffffffff610c2216565b6000806109be8484610db1565b905080156109d1576109d1338585610b16565b9392505050565b60045481565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b336000908152600660205260409020805460ff19169055565b610a2a61092b565b610a3357600080fd5b6106e681610dbe565b6001600160a01b038216610a4f57600080fd5b6001600160a01b038316610a6257600080fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000610ad1848484610e39565b6001600160a01b038416600090815260026020908152604080832033808552925290912054610b0c9186916105ca908663ffffffff610c2216565b5060019392505050565b610b28826001600160a01b0316610f06565b15610bdf576001600160a01b03821660009081526006602052604090205460ff16610b5257610c0b565b604080517f29e9a3b90000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301528416602482018190526044820184905291516329e9a3b99160648082019260009290919082900301818387803b158015610bc257600080fd5b505af1158015610bd6573d6000803e3d6000fd5b50505050610c0b565b6005546001600160a01b0383811691161415610c0b57600554610c0b906001600160a01b031682610ce1565b505050565b6000828201838110156109d157600080fd5b600082821115610c3157600080fd5b50900390565b6001600160a01b038216610c4a57600080fd5b600354610c5d908263ffffffff610c1016565b6003556001600160a01b038216600090815260016020526040902054610c89908263ffffffff610c1016565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60045415610d2357604051600160e51b62461bcd0281526004018080602001828103825260288152602001806110d06028913960400191505060405180910390fd5b610d2d8282610f0c565b5050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610c0b908490610fb5565b6000610535338484610e39565b6001600160a01b038116610dd157600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001600160a01b038216610e4c57600080fd5b6001600160a01b038316600090815260016020526040902054610e75908263ffffffff610c2216565b6001600160a01b038085166000908152600160205260408082209390935590841681522054610eaa908263ffffffff610c1016565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b3b151590565b6001600160a01b038216610f1f57600080fd5b600354610f32908263ffffffff610c2216565b6003556001600160a01b038216600090815260016020526040902054610f5e908263ffffffff610c2216565b6001600160a01b0383166000818152600160209081526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b610fc7826001600160a01b0316610f06565b610fd057600080fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061100e5780518252601f199092019160209182019101610fef565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611070576040519150601f19603f3d011682016040523d82523d6000602084013e611075565b606091505b50915091508161108457600080fd5b80511561086f578080602001905160208110156110a057600080fd5b505161086f57600080fdfe4275726e2061646472657373206d7573742068617665207a65726f2062616c616e636521416c6c20746f6b656e73206d757374206265206d696e746564206265666f7265206275726e696e67476976656e20616d6f756e74206973206c6172676572207468616e2063757272656e742062616c616e6365a165627a7a72305820a35edf1e5d959bd92d7fb3851a2c5e9c84a88974e88b155877a842689680e2470029
Verified Source Code Partial Match
Compiler: v0.5.7+commit.6da8b019
EVM: petersburg
Optimization: Yes (1000 runs)
BSYToken.sol 550 lines
pragma solidity 0.5.7;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* Utility library of inline functions on addresses
*/
library Address {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://eips.ethereum.org/EIPS/eip-20
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token to a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* 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
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(value));
}
}
/**
* @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 private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
* @notice Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @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 {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require((value == 0) || (token.allowance(address(this), spender) == 0));
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must equal true).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
require(address(token).isContract());
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success);
if (returndata.length > 0) { // Return data is optional
require(abi.decode(returndata, (bool)));
}
}
}
contract TokenRecoverable is Ownable {
using SafeERC20 for IERC20;
function recoverTokens(IERC20 token, address to, uint256 amount) public onlyOwner {
uint256 balance = token.balanceOf(address(this));
require(balance >= amount, "Given amount is larger than current balance");
token.safeTransfer(to, amount);
}
}
interface ITokenReceiver {
function tokensReceived(
address from,
address to,
uint256 amount
) external;
}
contract BSYToken is TokenRecoverable, ERC20 {
using SafeMath for uint256;
using Address for address;
string public constant name = "BSYToken";
string public constant symbol = "BSY";
uint8 public constant decimals = uint8(18);
uint256 public tokensToMint = 1000000000e18; // 1 000 000 000 tokens
address public burnAddress;
mapping(address => bool) public notify;
function register() public {
notify[msg.sender] = true;
}
function unregister() public {
notify[msg.sender] = false;
}
/**
* @dev Transfer token to a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
bool success = super.transfer(to, value);
if (success) {
_postTransfer(msg.sender, to, value);
}
return success;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
bool success = super.transferFrom(from, to, value);
if (success) {
_postTransfer(from, to, value);
}
return success;
}
function _postTransfer(address from, address to, uint256 value) internal {
if (to.isContract()) {
if (notify[to] == false) return;
ITokenReceiver(to).tokensReceived(from, to, value);
} else {
if (to == burnAddress) {
_burn(burnAddress, value);
}
}
}
function _burn(address account, uint256 value) internal {
require(tokensToMint == 0, "All tokens must be minted before burning");
super._burn(account, value);
}
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address to, uint256 value) public onlyOwner returns (bool) {
require(tokensToMint.sub(value) >= 0, "Not enough tokens left");
tokensToMint = tokensToMint.sub(value);
_mint(to, value);
_postTransfer(address(0), to, value);
return true;
}
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public {
require(msg.sender == burnAddress, "Only burnAddress can burn tokens");
_burn(msg.sender, value);
}
function setBurnAddress(address _burnAddress) external onlyOwner {
require(balanceOf(_burnAddress) == 0, "Burn address must have zero balance!");
burnAddress = _burnAddress;
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
burnAddress 0x70d5ae05 → address
decimals 0x313ce567 → uint8
isOwner 0x8f32d59b → bool
name 0x06fdde03 → string
notify 0x5fb9cf20 → bool
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
tokensToMint 0xcbafee8a → uint256
totalSupply 0x18160ddd → uint256
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 value
returns: bool
burn 0x42966c68
uint256 value
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
mint 0x40c10f19
address to
uint256 value
returns: bool
recoverTokens 0x5f3e849f
address token
address to
uint256 amount
register 0x1aa3a008
No parameters
renounceOwnership 0x715018a6
No parameters
setBurnAddress 0x4b0e7216
address _burnAddress
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool
transferOwnership 0xf2fde38b
address newOwner
unregister 0xe79a198f
No parameters
Recent Transactions
No transactions found for this address