Address Contract Partially Verified
Address
0x5bC749A299c5DE62325e1a676D53527149F7aa30
Balance
0 ETH
Nonce
1
Code Size
4801 bytes
Creator
0xFC74E21e...0832 at tx 0xb3814609...35d73b
Indexed Transactions
0
Contract Bytecode
4801 bytes
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80638da5cb5b116100f9578063c602ca6a11610097578063e3b2396411610071578063e3b23964146103ad578063e4e59f11146103c0578063f2fde38b146103d3578063f94a8175146103e657600080fd5b8063c602ca6a1461034f578063d46b136c14610362578063dd62ed3e1461037457600080fd5b8063a8aa1b31116100d3578063a8aa1b3114610318578063a9059cbb1461032b578063b5e031551461033e578063c459fbb81461034657600080fd5b80638da5cb5b146102d857806395d89b41146102fd578063a457c2d71461030557600080fd5b806339509351116101665780635386682411610140578063538668241461028157806370a0823114610294578063715018a6146102bd5780638187f516146102c557600080fd5b80633950935114610246578063404e51291461025957806342966c681461026e57600080fd5b806306fdde03146101ae578063095ea7b3146101cc57806316c02129146101ef57806318160ddd1461021257806323b872dd14610224578063313ce56714610237575b600080fd5b6101b6610409565b6040516101c3919061104d565b60405180910390f35b6101df6101da3660046110b7565b61049b565b60405190151581526020016101c3565b6101df6101fd3660046110e1565b60076020526000908152604090205460ff1681565b6003545b6040519081526020016101c3565b6101df610232366004611103565b6104b2565b604051601281526020016101c3565b6101df6102543660046110b7565b610561565b61026c61026736600461114f565b61059d565b005b61026c61027c366004611182565b6105f2565b61026c61028f36600461119b565b6105ff565b6102166102a23660046110e1565b6001600160a01b031660009081526001602052604090205490565b61026c61063c565b61026c6102d33660046110e1565b610672565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016101c3565b6101b66106c2565b6101df6103133660046110b7565b6106d1565b6006546102e5906001600160a01b031681565b6101df6103393660046110b7565b61076a565b610216600581565b61021660095481565b61026c61035d3660046110e1565b610777565b6102166a71bcc1ef9311a1f980000081565b6102166103823660046111b6565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61026c6103bb36600461119b565b6107c5565b61026c6103ce36600461119b565b610809565b61026c6103e13660046110e1565b61084f565b6101df6103f43660046110e1565b60086020526000908152604090205460ff1681565b606060048054610418906111e0565b80601f0160208091040260200160405190810160405280929190818152602001828054610444906111e0565b80156104915780601f1061046657610100808354040283529160200191610491565b820191906000526020600020905b81548152906001019060200180831161047457829003601f168201915b5050505050905090565b60006104a83384846108e7565b5060015b92915050565b60006104bf848484610a0c565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156105495760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61055685338584036108e7565b506001949350505050565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916104a8918590610598908690611230565b6108e7565b6000546001600160a01b031633146105c75760405162461bcd60e51b815260040161054090611243565b6001600160a01b03919091166000908152600760205260409020805460ff1916911515919091179055565b6105fc3382610be7565b50565b6000546001600160a01b031633146106295760405162461bcd60e51b815260040161054090611243565b600a805460ff1916911515919091179055565b6000546001600160a01b031633146106665760405162461bcd60e51b815260040161054090611243565b6106706000610d39565b565b6000546001600160a01b0316331461069c5760405162461bcd60e51b815260040161054090611243565b43600955600680546001600160a01b0319166001600160a01b0392909216919091179055565b606060058054610418906111e0565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156107535760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610540565b61076033858584036108e7565b5060019392505050565b60006104a8338484610a0c565b6000546001600160a01b031633146107a15760405162461bcd60e51b815260040161054090611243565b6001600160a01b03166000908152600860205260409020805460ff19166001179055565b6000546001600160a01b031633146107ef5760405162461bcd60e51b815260040161054090611243565b600a80549115156101000261ff0019909216919091179055565b6000546001600160a01b031633146108335760405162461bcd60e51b815260040161054090611243565b600a8054911515620100000262ff000019909216919091179055565b6000546001600160a01b031633146108795760405162461bcd60e51b815260040161054090611243565b6001600160a01b0381166108de5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610540565b6105fc81610d39565b6001600160a01b0383166109495760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610540565b6001600160a01b0382166109aa5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610540565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038316610a705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610540565b6001600160a01b038216610ad25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610540565b610add838383610d89565b6001600160a01b03831660009081526001602052604090205481811015610b555760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610540565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290610b8c908490611230565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bd891815260200190565b60405180910390a35b50505050565b6001600160a01b038216610c475760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610540565b610c5382600083610d89565b6001600160a01b03821660009081526001602052604090205481811015610cc75760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610540565b6001600160a01b0383166000908152600160205260408120838303905560038054849290610cf6908490611278565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016109ff565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80600003610daa57604051637713e26f60e01b815260040160405180910390fd5b600a5462010000900460ff1615610dc057505050565b6001600160a01b03821660009081526007602052604090205460ff16158015610e0257506001600160a01b03831660009081526007602052604090205460ff16155b610e3c5760405162461bcd60e51b815260206004820152600b60248201526a109b1858dadb1a5cdd195960aa1b6044820152606401610540565b6006546001600160a01b0316610ece576001600160a01b03831660009081526008602052604081205460ff1680610e8b57506001600160a01b03831660009081526008602052604090205460ff165b905080610be15760405162461bcd60e51b8152602060048201526011602482015270151c98591948139bdd0814dd185c9d1959607a1b6044820152606401610540565b6001600160a01b0383166000908152600c6020526040902054431480610f0b57506001600160a01b0382166000908152600c602052604090205443145b15610f2957604051631eb49d6d60e11b815260040160405180910390fd5b6006546001600160a01b039081168482168114918416148115610fd957600a5460ff168015610f5c5750610f5c84611002565b15610f7a57604051631eb49d6d60e11b815260040160405180910390fd5b600a54610100900460ff168015610f9b57506a71bcc1ef9311a1f980000083115b15610fb957604051631930e3c960e11b815260040160405180910390fd5b6001600160a01b0384166000908152600c60205260409020439055610ffb565b8015610ffb576001600160a01b0385166000908152600c602052604090204390555b5050505050565b600060095460056110139190611230565b4310806110265750813b63ffffffff1615155b80156104ac5750506001600160a01b031660009081526008602052604090205460ff161590565b600060208083528351808285015260005b8181101561107a5785810183015185820160400152820161105e565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146110b257600080fd5b919050565b600080604083850312156110ca57600080fd5b6110d38361109b565b946020939093013593505050565b6000602082840312156110f357600080fd5b6110fc8261109b565b9392505050565b60008060006060848603121561111857600080fd5b6111218461109b565b925061112f6020850161109b565b9150604084013590509250925092565b803580151581146110b257600080fd5b6000806040838503121561116257600080fd5b61116b8361109b565b91506111796020840161113f565b90509250929050565b60006020828403121561119457600080fd5b5035919050565b6000602082840312156111ad57600080fd5b6110fc8261113f565b600080604083850312156111c957600080fd5b6111d28361109b565b91506111796020840161109b565b600181811c908216806111f457607f821691505b60208210810361121457634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104ac576104ac61121a565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b818103818111156104ac576104ac61121a56fea26469706673582212204bfb39085f853f8f7210b0953caf2983b988f8d1eb589e790267e6ec85e17d1764736f6c63430008130033
Verified Source Code Partial Match
Compiler: v0.8.19+commit.7dd6d404
EVM: paris
Optimization: Yes (200 runs)
STIMMY.sol 747 lines
pragma solidity ^0.8.19;
// SPDX-License-Identifier: MIT
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.19;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: 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
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.19;
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// OpenZeppelin Contracts v4.4.0 (token/ERC20/ERC20.sol)
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// File contracts/STIMMY.sol
contract STIMMY is Ownable, ERC20 {
string constant _name = "STIMMY";
string constant _symbol = "STIMMY";
uint8 constant _decimals = 18;
address public pair;
mapping(address => bool) public blacklists;
mapping(address => bool) public tradeExceptions;
/** Max buy amount per tx */
uint256 public constant MAX_BUY = 137_500_000 ether;
/** Number of blocks to count as dead land */
uint256 public constant DEADBLOCK_COUNT = 5;
/** Deadblock start blocknum */
uint256 public deadblockStart;
/** Block contracts? */
bool private _blockContracts;
/** Limit buys? */
bool private _limitBuys;
/** Crowd control measures? */
bool private _unrestricted;
/** Developer wallet map with super access */
mapping(address => bool) private whitelist;
/** Used to watch for sandwiches */
mapping(address => uint) private _lastBlockTransfer;
/** Amount must be greater than zero */
error NoZeroTransfers();
/** Not allowed */
error NotAllowed();
/** Amount exceeds max transaction */
error LimitExceeded();
constructor(address _airdropAddress, address _marketingAddress, address _developmentAddress) ERC20(_name, _symbol) {
// add addresses to exception
tradeExceptions[msg.sender] = true;
tradeExceptions[_airdropAddress] = true;
tradeExceptions[_marketingAddress] = true;
tradeExceptions[_developmentAddress] = true;
uint256 _totalSupply = 1_234_000_000 * (10 ** _decimals);
uint256 _airdropAllocation = (_totalSupply * 500) / 10000;
uint256 _marketingAllocation = (_totalSupply * 333) / 10000;
uint256 _developmentAllocation = (_totalSupply * 244) / 10000;
uint256 _remainingAllocation = _totalSupply - (_airdropAllocation + _marketingAllocation + _developmentAllocation);
_mint(msg.sender, _remainingAllocation); // Mint tokens for the contract deployer
// Mint additional tokens for airdrop, marketing, and airdrop addresses
_mint(_airdropAddress, _airdropAllocation);
_mint(_marketingAddress, _marketingAllocation);
_mint(_developmentAddress, _developmentAllocation);
_blockContracts = true;
_limitBuys = true;
}
/**
* Blacklist an address
* @param _address Address to blacklist
*/
function blacklist(address _address, bool _isBlacklisting) external onlyOwner {
blacklists[_address] = _isBlacklisting;
}
/**
* Sets pair, start trading
* @param _pair Uniswap address
*/
function setPair(address _pair) external onlyOwner {
deadblockStart = block.number;
pair = _pair;
}
/**
* Checks for exception
* @param _address Address to blacklist
*/
function _isException(address _address) internal view returns (bool) {
return tradeExceptions[_address];
}
/**
* Add address to exception
* @param _address Address to exception
*/
function addException(address _address) external onlyOwner {
tradeExceptions[_address] = true;
}
/**
* Checks if address is contract
* @param _address Address in question
* @dev Contract will have codesize
*/
function _isContract(address _address) internal view returns (bool) {
uint32 size;
assembly {
size := extcodesize(_address)
}
return (size > 0);
}
/**
* Checks if address has inhuman reflexes or if it's a contract
* @param _address Address in question
*/
function _checkIfBot(address _address) internal view returns (bool) {
return (block.number < DEADBLOCK_COUNT + deadblockStart || _isContract(_address)) && !_isException(_address);
}
/**
* Sets contract blocker
* @param _val Should we block contracts?
*/
function setBlockContracts(bool _val) external onlyOwner {
_blockContracts = _val;
}
/**
* Sets buy limiter
* @param _val Limited?
*/
function setLimitBuys(bool _val) external onlyOwner {
_limitBuys = _val;
}
/**
* Add or remove restrictions
*/
function setRestrictions(bool _val) external onlyOwner {
_unrestricted = _val;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Checks:
* - transfer amount is non-zero
* - address is not blacklisted.
* - check if trade started, only after adding pair
* - buy/sell are not executed during the same block to help alleviate sandwiches
* - buy amount does not exceed max buy during limited period
* - check for bots to alleviate snipes
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) override internal virtual {
if (amount == 0) { revert NoZeroTransfers(); }
super._beforeTokenTransfer(from, to, amount);
if (_unrestricted) { return; }
require(!blacklists[to] && !blacklists[from], "Blacklisted");
if (pair == address(0)) {
bool isAllowed = _isException(from) || _isException(to);
require(isAllowed, "Trade Not Started");
return;
}
// Watch for sandwich
if (block.number == _lastBlockTransfer[from] || block.number == _lastBlockTransfer[to]) {
revert NotAllowed();
}
bool isBuy = (from == pair);
bool isSell = (to == pair);
if (isBuy) {
// Watch for bots
if (_blockContracts && _checkIfBot(to)) { revert NotAllowed(); }
// Watch for buys exceeding max during limited period
if (_limitBuys && amount > MAX_BUY) { revert LimitExceeded(); }
_lastBlockTransfer[to] = block.number;
} else if (isSell) {
_lastBlockTransfer[from] = block.number;
}
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
}
Read Contract
DEADBLOCK_COUNT 0xb5e03155 → uint256
MAX_BUY 0xd46b136c → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
blacklists 0x16c02129 → bool
deadblockStart 0xc459fbb8 → uint256
decimals 0x313ce567 → uint8
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pair 0xa8aa1b31 → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
tradeExceptions 0xf94a8175 → bool
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
addException 0xc602ca6a
address _address
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
blacklist 0x404e5129
address _address
bool _isBlacklisting
burn 0x42966c68
uint256 value
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
renounceOwnership 0x715018a6
No parameters
setBlockContracts 0x53866824
bool _val
setLimitBuys 0xe3b23964
bool _val
setPair 0x8187f516
address _pair
setRestrictions 0xe4e59f11
bool _val
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address