Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Contract
Write Contract
Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB 0x27ada2a045d929600858b959c031e05d05c51b31.
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
Verify & Publish
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
- Contract name:
- BABYTOKEN
- Optimization enabled
- true
- Compiler version
- v0.8.4+commit.c7e474f2
- Optimization runs
- 200
- Verified at
- 2023-09-22T23:11:50.852791Z
Contract source code
// Dependency file: @openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// pragma solidity ^0.8.0;
/**
* @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);
}
// Dependency file: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @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);
}
// Dependency file: @openzeppelin/contracts/utils/Context.sol
// pragma solidity ^0.8.0;
/**
* @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;
}
}
// Dependency file: @openzeppelin/contracts/token/ERC20/ERC20.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
// import "@openzeppelin/contracts/utils/Context.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 {}
}
// Dependency file: @openzeppelin/contracts/utils/Address.sol
// pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// Dependency file: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/utils/Address.sol";
/**
* @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 IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
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));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
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),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_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) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - 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 not be false).
* @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. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// Dependency file: @openzeppelin/contracts/access/Ownable.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts/utils/Context.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() {
_setOwner(_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 {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// Dependency file: @openzeppelin/contracts/utils/math/SafeMath.sol
// pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// 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-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
// Dependency file: @openzeppelin/contracts/proxy/Clones.sol
// pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
* deploying minimal proxy contracts, also known as "clones".
*
* > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
* > a minimal bytecode implementation that delegates all calls to a known, fixed address.
*
* The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
* (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
* deterministic method.
*
* _Available since v3.4._
*/
library Clones {
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create opcode, which should never revert.
*/
function clone(address implementation) internal returns (address instance) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
instance := create(0, ptr, 0x37)
}
require(instance != address(0), "ERC1167: create failed");
}
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create2 opcode and a `salt` to deterministically deploy
* the clone. Using the same `implementation` and `salt` multiple time will revert, since
* the clones cannot be deployed twice at the same address.
*/
function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
instance := create2(0, ptr, 0x37, salt)
}
require(instance != address(0), "ERC1167: create2 failed");
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(
address implementation,
bytes32 salt,
address deployer
) internal pure returns (address predicted) {
assembly {
let ptr := mload(0x40)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(ptr, 0x14), shl(0x60, implementation))
mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000)
mstore(add(ptr, 0x38), shl(0x60, deployer))
mstore(add(ptr, 0x4c), salt)
mstore(add(ptr, 0x6c), keccak256(ptr, 0x37))
predicted := keccak256(add(ptr, 0x37), 0x55)
}
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(address implementation, bytes32 salt)
internal
view
returns (address predicted)
{
return predictDeterministicAddress(implementation, salt, address(this));
}
}
// Dependency file: contracts/libs/SafeERC20NoRevert.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title SafeERC20NoRevert
* @dev Taken from OpenZeppelin's SafeERC20 implementation, just return a bool value without reverting
* Clients using this function need to check for the return value themselves.
*/
library SafeERC20NoRevert {
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal returns (bool) {
(bool success, bytes memory returndata) = address(token).call(
abi.encodeWithSelector(token.transfer.selector, to, value)
);
return
success &&
(returndata.length == 0 || abi.decode(returndata, (bool))) &&
address(token).code.length > 0;
}
}
// Dependency file: contracts/interfaces/IUniswapV2Factory.sol
// pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(
address indexed token0,
address indexed token1,
address pair,
uint256
);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB)
external
view
returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB)
external
returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
// Dependency file: contracts/interfaces/IUniswapV2Router02.sol
// pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
// Dependency file: @openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol
// pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @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);
}
// Dependency file: @openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
/**
* @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);
}
// Dependency file: @openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// pragma solidity ^0.8.0;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
require(_initializing || !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
}
// Dependency file: @openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal initializer {
__Context_init_unchained();
}
function __Context_init_unchained() internal initializer {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
uint256[50] private __gap;
}
// Dependency file: @openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
// import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
// import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
// import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.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 ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
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.
*/
function __ERC20_init(string memory name_, string memory symbol_) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name_, symbol_);
}
function __ERC20_init_unchained(string memory name_, string memory symbol_) internal initializer {
_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 {}
uint256[45] private __gap;
}
// Dependency file: @openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// pragma solidity ^0.8.0;
// import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
// import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
_setOwner(_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 {
_setOwner(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");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
uint256[49] private __gap;
}
// Dependency file: contracts/interfaces/IUniswapV2Pair.sol
// pragma solidity >=0.5.0;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// Dependency file: contracts/libs/SafeMathInt.sol
// pragma solidity =0.8.4;
/**
* @title SafeMathInt
* @dev Math operations for int256 with overflow safety checks.
*/
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b) internal pure returns (int256) {
int256 c = a * b;
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
/**
* @dev Division of two int256 variables and fails on overflow.
*/
function div(int256 a, int256 b) internal pure returns (int256) {
// Prevent overflow when dividing MIN_INT256 by -1
require(b != -1 || a != MIN_INT256);
// Solidity already throws when dividing by 0.
return a / b;
}
/**
* @dev Subtracts two int256 variables and fails on overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two int256 variables and fails on overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Converts to absolute value, and fails on overflow.
*/
function abs(int256 a) internal pure returns (int256) {
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
function toUint256Safe(int256 a) internal pure returns (uint256) {
require(a >= 0);
return uint256(a);
}
}
// Dependency file: contracts/libs/SafeMathUint.sol
// pragma solidity =0.8.4;
/**
* @title SafeMathUint
* @dev Math operations with safety checks that revert on error
*/
library SafeMathUint {
function toInt256Safe(uint256 a) internal pure returns (int256) {
int256 b = int256(a);
require(b >= 0);
return b;
}
}
// Dependency file: contracts/baby/IterableMapping.sol
// pragma solidity =0.8.4;
library IterableMapping {
// Iterable mapping from address to uint;
struct Map {
address[] keys;
mapping(address => uint256) values;
mapping(address => uint256) indexOf;
mapping(address => bool) inserted;
}
function get(Map storage map, address key) public view returns (uint256) {
return map.values[key];
}
function getIndexOfKey(Map storage map, address key)
public
view
returns (int256)
{
if (!map.inserted[key]) {
return -1;
}
return int256(map.indexOf[key]);
}
function getKeyAtIndex(Map storage map, uint256 index)
public
view
returns (address)
{
return map.keys[index];
}
function size(Map storage map) public view returns (uint256) {
return map.keys.length;
}
function set(
Map storage map,
address key,
uint256 val
) public {
if (map.inserted[key]) {
map.values[key] = val;
} else {
map.inserted[key] = true;
map.values[key] = val;
map.indexOf[key] = map.keys.length;
map.keys.push(key);
}
}
function remove(Map storage map, address key) public {
if (!map.inserted[key]) {
return;
}
delete map.inserted[key];
delete map.values[key];
uint256 index = map.indexOf[key];
uint256 lastIndex = map.keys.length - 1;
address lastKey = map.keys[lastIndex];
map.indexOf[lastKey] = index;
delete map.indexOf[key];
map.keys[index] = lastKey;
map.keys.pop();
}
}
// Dependency file: contracts/baby/BabyTokenDividendTracker.sol
// pragma solidity =0.8.4;
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/access/Ownable.sol";
// import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
// import "@openzeppelin/contracts/utils/math/SafeMath.sol";
// import "contracts/interfaces/IUniswapV2Factory.sol";
// import "contracts/interfaces/IUniswapV2Router02.sol";
// import "contracts/interfaces/IUniswapV2Pair.sol";
// import "contracts/libs/SafeMathInt.sol";
// import "contracts/libs/SafeMathUint.sol";
// import "contracts/libs/SafeERC20NoRevert.sol";
// import "contracts/baby/IterableMapping.sol";
/// @title Dividend-Paying Token Interface
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev An interface for a dividend-paying token contract.
interface DividendPayingTokenInterface {
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function dividendOf(address _owner) external view returns (uint256);
/// @notice Withdraws the ether distributed to the sender.
/// @dev SHOULD transfer `dividendOf(msg.sender)` wei to `msg.sender`, and `dividendOf(msg.sender)` SHOULD be 0 after the transfer.
/// MUST emit a `DividendWithdrawn` event if the amount of ether transferred is greater than 0.
function withdrawDividend() external;
/// @dev This event MUST emit when ether is distributed to token holders.
/// @param from The address which sends ether to this contract.
/// @param weiAmount The amount of distributed ether in wei.
event DividendsDistributed(address indexed from, uint256 weiAmount);
/// @dev This event MUST emit when an address withdraws their dividend.
/// @param to The address which withdraws ether from this contract.
/// @param weiAmount The amount of withdrawn ether in wei.
event DividendWithdrawn(address indexed to, uint256 weiAmount);
}
/// @title Dividend-Paying Token Optional Interface
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev OPTIONAL functions for a dividend-paying token contract.
interface DividendPayingTokenOptionalInterface {
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function withdrawableDividendOf(address _owner)
external
view
returns (uint256);
/// @notice View the amount of dividend in wei that an address has withdrawn.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has withdrawn.
function withdrawnDividendOf(address _owner)
external
view
returns (uint256);
/// @notice View the amount of dividend in wei that an address has earned in total.
/// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has earned in total.
function accumulativeDividendOf(address _owner)
external
view
returns (uint256);
}
/// @title Dividend-Paying Token
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev A mintable ERC20 token that allows anyone to pay and distribute ether
/// to token holders as dividends and allows token holders to withdraw their dividends.
/// Reference: the source code of PoWH3D: https://etherscan.io/address/0xB3775fB83F7D12A36E0475aBdD1FCA35c091efBe#code
contract DividendPayingToken is
ERC20Upgradeable,
OwnableUpgradeable,
DividendPayingTokenInterface,
DividendPayingTokenOptionalInterface
{
using SafeMath for uint256;
using SafeMathUint for uint256;
using SafeMathInt for int256;
address public rewardToken;
// With `magnitude`, we can properly distribute dividends even if the amount of received ether is small.
// For more discussion about choosing the value of `magnitude`,
// see https://github.com/ethereum/EIPs/issues/1726#issuecomment-472352728
uint256 internal constant magnitude = 2**128;
uint256 internal magnifiedDividendPerShare;
// About dividendCorrection:
// If the token balance of a `_user` is never changed, the dividend of `_user` can be computed with:
// `dividendOf(_user) = dividendPerShare * balanceOf(_user)`.
// When `balanceOf(_user)` is changed (via minting/burning/transferring tokens),
// `dividendOf(_user)` should not be changed,
// but the computed value of `dividendPerShare * balanceOf(_user)` is changed.
// To keep the `dividendOf(_user)` unchanged, we add a correction term:
// `dividendOf(_user) = dividendPerShare * balanceOf(_user) + dividendCorrectionOf(_user)`,
// where `dividendCorrectionOf(_user)` is updated whenever `balanceOf(_user)` is changed:
// `dividendCorrectionOf(_user) = dividendPerShare * (old balanceOf(_user)) - (new balanceOf(_user))`.
// So now `dividendOf(_user)` returns the same value before and after `balanceOf(_user)` is changed.
mapping(address => int256) internal magnifiedDividendCorrections;
mapping(address => uint256) internal withdrawnDividends;
uint256 public totalDividendsDistributed;
function __DividendPayingToken_init(
address _rewardToken,
string memory _name,
string memory _symbol
) internal initializer {
__Ownable_init();
__ERC20_init(_name, _symbol);
rewardToken = _rewardToken;
}
function distributeCAKEDividends(uint256 amount) public onlyOwner {
require(totalSupply() > 0);
if (amount > 0) {
magnifiedDividendPerShare = magnifiedDividendPerShare.add(
(amount).mul(magnitude) / totalSupply()
);
emit DividendsDistributed(msg.sender, amount);
totalDividendsDistributed = totalDividendsDistributed.add(amount);
}
}
/// @notice Withdraws the ether distributed to the sender.
/// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function withdrawDividend() public virtual override {
_withdrawDividendOfUser(payable(msg.sender));
}
/// @notice Withdraws the ether distributed to the sender.
/// @dev It emits a `DividendWithdrawn` event if the amount of withdrawn ether is greater than 0.
function _withdrawDividendOfUser(address payable user)
internal
returns (uint256)
{
uint256 _withdrawableDividend = withdrawableDividendOf(user);
if (_withdrawableDividend > 0) {
withdrawnDividends[user] = withdrawnDividends[user].add(
_withdrawableDividend
);
emit DividendWithdrawn(user, _withdrawableDividend);
bool success = SafeERC20NoRevert.safeTransfer(
IERC20(rewardToken),
user,
_withdrawableDividend
);
if (!success) {
withdrawnDividends[user] = withdrawnDividends[user].sub(
_withdrawableDividend
);
return 0;
}
return _withdrawableDividend;
}
return 0;
}
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function dividendOf(address _owner) public view override returns (uint256) {
return withdrawableDividendOf(_owner);
}
/// @notice View the amount of dividend in wei that an address can withdraw.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` can withdraw.
function withdrawableDividendOf(address _owner)
public
view
override
returns (uint256)
{
return accumulativeDividendOf(_owner).sub(withdrawnDividends[_owner]);
}
/// @notice View the amount of dividend in wei that an address has withdrawn.
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has withdrawn.
function withdrawnDividendOf(address _owner)
public
view
override
returns (uint256)
{
return withdrawnDividends[_owner];
}
/// @notice View the amount of dividend in wei that an address has earned in total.
/// @dev accumulativeDividendOf(_owner) = withdrawableDividendOf(_owner) + withdrawnDividendOf(_owner)
/// = (magnifiedDividendPerShare * balanceOf(_owner) + magnifiedDividendCorrections[_owner]) / magnitude
/// @param _owner The address of a token holder.
/// @return The amount of dividend in wei that `_owner` has earned in total.
function accumulativeDividendOf(address _owner)
public
view
override
returns (uint256)
{
return
magnifiedDividendPerShare
.mul(balanceOf(_owner))
.toInt256Safe()
.add(magnifiedDividendCorrections[_owner])
.toUint256Safe() / magnitude;
}
/// @dev Internal function that transfer tokens from one address to another.
/// Update magnifiedDividendCorrections to keep dividends unchanged.
/// @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 virtual override {
require(false);
int256 _magCorrection = magnifiedDividendPerShare
.mul(value)
.toInt256Safe();
magnifiedDividendCorrections[from] = magnifiedDividendCorrections[from]
.add(_magCorrection);
magnifiedDividendCorrections[to] = magnifiedDividendCorrections[to].sub(
_magCorrection
);
}
/// @dev Internal function that mints tokens to an account.
/// Update magnifiedDividendCorrections to keep dividends unchanged.
/// @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 override {
super._mint(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[
account
].sub((magnifiedDividendPerShare.mul(value)).toInt256Safe());
}
/// @dev Internal function that burns an amount of the token of a given account.
/// Update magnifiedDividendCorrections to keep dividends unchanged.
/// @param account The account whose tokens will be burnt.
/// @param value The amount that will be burnt.
function _burn(address account, uint256 value) internal override {
super._burn(account, value);
magnifiedDividendCorrections[account] = magnifiedDividendCorrections[
account
].add((magnifiedDividendPerShare.mul(value)).toInt256Safe());
}
function _setBalance(address account, uint256 newBalance) internal {
uint256 currentBalance = balanceOf(account);
if (newBalance > currentBalance) {
uint256 mintAmount = newBalance.sub(currentBalance);
_mint(account, mintAmount);
} else if (newBalance < currentBalance) {
uint256 burnAmount = currentBalance.sub(newBalance);
_burn(account, burnAmount);
}
}
}
contract BABYTOKENDividendTracker is OwnableUpgradeable, DividendPayingToken {
using SafeMath for uint256;
using SafeMathInt for int256;
using IterableMapping for IterableMapping.Map;
IterableMapping.Map private tokenHoldersMap;
uint256 public lastProcessedIndex;
mapping(address => bool) public excludedFromDividends;
mapping(address => uint256) public lastClaimTimes;
uint256 public claimWait;
uint256 public minimumTokenBalanceForDividends;
event ExcludeFromDividends(address indexed account);
event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);
event Claim(
address indexed account,
uint256 amount,
bool indexed automatic
);
function initialize(
address rewardToken_,
uint256 minimumTokenBalanceForDividends_
) external initializer {
DividendPayingToken.__DividendPayingToken_init(
rewardToken_,
"DIVIDEND_TRACKER",
"DIVIDEND_TRACKER"
);
claimWait = 3600;
minimumTokenBalanceForDividends = minimumTokenBalanceForDividends_;
}
function _transfer(
address,
address,
uint256
) internal pure override {
require(false, "Dividend_Tracker: No transfers allowed");
}
function withdrawDividend() public pure override {
require(
false,
"Dividend_Tracker: withdrawDividend disabled. Use the 'claim' function on the main BABYTOKEN contract."
);
}
function excludeFromDividends(address account) external onlyOwner {
require(!excludedFromDividends[account]);
excludedFromDividends[account] = true;
_setBalance(account, 0);
tokenHoldersMap.remove(account);
emit ExcludeFromDividends(account);
}
function isExcludedFromDividends(address account)
public
view
returns (bool)
{
return excludedFromDividends[account];
}
function updateClaimWait(uint256 newClaimWait) external onlyOwner {
require(
newClaimWait >= 3600 && newClaimWait <= 86400,
"Dividend_Tracker: claimWait must be updated to between 1 and 24 hours"
);
require(
newClaimWait != claimWait,
"Dividend_Tracker: Cannot update claimWait to same value"
);
emit ClaimWaitUpdated(newClaimWait, claimWait);
claimWait = newClaimWait;
}
function updateMinimumTokenBalanceForDividends(uint256 amount)
external
onlyOwner
{
minimumTokenBalanceForDividends = amount;
}
function getLastProcessedIndex() external view returns (uint256) {
return lastProcessedIndex;
}
function getNumberOfTokenHolders() external view returns (uint256) {
return tokenHoldersMap.keys.length;
}
function getAccount(address _account)
public
view
returns (
address account,
int256 index,
int256 iterationsUntilProcessed,
uint256 withdrawableDividends,
uint256 totalDividends,
uint256 lastClaimTime,
uint256 nextClaimTime,
uint256 secondsUntilAutoClaimAvailable
)
{
account = _account;
index = tokenHoldersMap.getIndexOfKey(account);
iterationsUntilProcessed = -1;
if (index >= 0) {
if (uint256(index) > lastProcessedIndex) {
iterationsUntilProcessed = index.sub(
int256(lastProcessedIndex)
);
} else {
uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length >
lastProcessedIndex
? tokenHoldersMap.keys.length.sub(lastProcessedIndex)
: 0;
iterationsUntilProcessed = index.add(
int256(processesUntilEndOfArray)
);
}
}
withdrawableDividends = withdrawableDividendOf(account);
totalDividends = accumulativeDividendOf(account);
lastClaimTime = lastClaimTimes[account];
nextClaimTime = lastClaimTime > 0 ? lastClaimTime.add(claimWait) : 0;
secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp
? nextClaimTime.sub(block.timestamp)
: 0;
}
function getAccountAtIndex(uint256 index)
public
view
returns (
address,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
if (index >= tokenHoldersMap.size()) {
return (address(0), -1, -1, 0, 0, 0, 0, 0);
}
address account = tokenHoldersMap.getKeyAtIndex(index);
return getAccount(account);
}
function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {
if (lastClaimTime > block.timestamp) {
return false;
}
return block.timestamp.sub(lastClaimTime) >= claimWait;
}
function setBalance(address payable account, uint256 newBalance)
external
onlyOwner
{
if (excludedFromDividends[account]) {
return;
}
if (newBalance >= minimumTokenBalanceForDividends) {
_setBalance(account, newBalance);
tokenHoldersMap.set(account, newBalance);
} else {
_setBalance(account, 0);
tokenHoldersMap.remove(account);
}
processAccount(account, true);
}
function process(uint256 gas)
public
returns (
uint256,
uint256,
uint256
)
{
uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;
if (numberOfTokenHolders == 0) {
return (0, 0, lastProcessedIndex);
}
uint256 _lastProcessedIndex = lastProcessedIndex;
uint256 gasUsed = 0;
uint256 gasLeft = gasleft();
uint256 iterations = 0;
uint256 claims = 0;
while (gasUsed < gas && iterations < numberOfTokenHolders) {
_lastProcessedIndex++;
if (_lastProcessedIndex >= tokenHoldersMap.keys.length) {
_lastProcessedIndex = 0;
}
address account = tokenHoldersMap.keys[_lastProcessedIndex];
if (canAutoClaim(lastClaimTimes[account])) {
if (processAccount(payable(account), true)) {
claims++;
}
}
iterations++;
uint256 newGasLeft = gasleft();
if (gasLeft > newGasLeft) {
gasUsed = gasUsed.add(gasLeft.sub(newGasLeft));
}
gasLeft = newGasLeft;
}
lastProcessedIndex = _lastProcessedIndex;
return (iterations, claims, lastProcessedIndex);
}
function processAccount(address payable account, bool automatic)
public
onlyOwner
returns (bool)
{
uint256 amount = _withdrawDividendOfUser(account);
if (amount > 0) {
lastClaimTimes[account] = block.timestamp;
emit Claim(account, amount, automatic);
return true;
}
return false;
}
}
// Dependency file: contracts/BaseToken.sol
// pragma solidity =0.8.4;
enum TokenType {
standard,
antiBotStandard,
liquidityGenerator,
antiBotLiquidityGenerator,
baby,
antiBotBaby,
buybackBaby,
antiBotBuybackBaby
}
abstract contract BaseToken {
event TokenCreated(
address indexed owner,
address indexed token,
TokenType tokenType,
uint256 version
);
}
// Root file: contracts/baby/BabyToken.sol
pragma solidity =0.8.4;
// import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
// import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
// import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// import "@openzeppelin/contracts/access/Ownable.sol";
// import "@openzeppelin/contracts/utils/math/SafeMath.sol";
// import "@openzeppelin/contracts/proxy/Clones.sol";
// import "@openzeppelin/contracts/utils/Address.sol";
// import "contracts/libs/SafeERC20NoRevert.sol";
// import "contracts/interfaces/IUniswapV2Factory.sol";
// import "contracts/interfaces/IUniswapV2Router02.sol";
// import "contracts/baby/BabyTokenDividendTracker.sol";
// import "contracts/BaseToken.sol";
contract BABYTOKEN is ERC20, Ownable, BaseToken {
using SafeMath for uint256;
using Address for address;
using Address for address payable;
using SafeERC20 for IERC20;
uint256 public constant VERSION = 4;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private swapping;
BABYTOKENDividendTracker public dividendTracker;
address public rewardToken;
uint256 public swapTokensAtAmount;
uint256 public tokenRewardsFee;
uint256 public liquidityFee;
uint256 public marketingFee;
uint256 public totalFees;
address public _marketingWalletAddress;
uint256 public gasForProcessing;
// exlcude from fees and max transaction amount
mapping(address => bool) private _isExcludedFromFees;
// store addresses that a automatic market maker pairs. Any transfer *to* these addresses
// could be subject to a maximum transfer amount
mapping(address => bool) public automatedMarketMakerPairs;
event ExcludeFromFees(address indexed account);
event ExcludeMultipleAccountsFromFees(address[] accounts);
event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);
event GasForProcessingUpdated(
uint256 indexed newValue,
uint256 indexed oldValue
);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
event SendDividends(uint256 tokensSwapped, uint256 amount);
event ProcessedDividendTracker(
uint256 iterations,
uint256 claims,
uint256 lastProcessedIndex,
bool indexed automatic,
uint256 gas,
address indexed processor
);
constructor(
string memory name_,
string memory symbol_,
uint256 totalSupply_,
address[4] memory addrs, // reward, router, marketing wallet, dividendTracker
uint256[3] memory feeSettings, // rewards, liquidity, marketing
uint256 minimumTokenBalanceForDividends_,
address serviceFeeReceiver_,
uint256 serviceFee_
) payable ERC20(name_, symbol_) {
rewardToken = addrs[0];
_marketingWalletAddress = addrs[2];
require(
msg.sender != _marketingWalletAddress,
"Owner and marketing wallet cannot be the same"
);
require(
!_marketingWalletAddress.isContract(),
"Marketing wallet cannot be a contract"
);
tokenRewardsFee = feeSettings[0];
liquidityFee = feeSettings[1];
marketingFee = feeSettings[2];
totalFees = tokenRewardsFee.add(liquidityFee).add(marketingFee);
require(totalFees <= 25, "Total fee is over 25%");
swapTokensAtAmount = totalSupply_.div(1000); // 0.1%
// use by default 300,000 gas to process auto-claiming dividends
gasForProcessing = 300000;
dividendTracker = BABYTOKENDividendTracker(
payable(Clones.clone(addrs[3]))
);
dividendTracker.initialize(
rewardToken,
minimumTokenBalanceForDividends_
);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(addrs[1]);
// Create a uniswap pair for this new token
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = _uniswapV2Pair;
_setAutomatedMarketMakerPair(_uniswapV2Pair, true);
// exclude from receiving dividends
dividendTracker.excludeFromDividends(address(dividendTracker));
dividendTracker.excludeFromDividends(address(this));
dividendTracker.excludeFromDividends(owner());
dividendTracker.excludeFromDividends(address(0xdead));
dividendTracker.excludeFromDividends(address(_uniswapV2Router));
// exclude from paying fees or having max transaction amount
_isExcludedFromFees[owner()] = true;
_isExcludedFromFees[_marketingWalletAddress] = true;
_isExcludedFromFees[address(this)] = true;
/*
_mint is an internal function in ERC20.sol that is only called here,
and CANNOT be called ever again
*/
_mint(owner(), totalSupply_);
emit TokenCreated(owner(), address(this), TokenType.baby, VERSION);
payable(serviceFeeReceiver_).transfer(serviceFee_);
}
receive() external payable {}
function setSwapTokensAtAmount(uint256 amount) external onlyOwner {
require(
amount > totalSupply() / 10**5,
"BABYTOKEN: Amount must be greater than 0.001% of total supply"
);
swapTokensAtAmount = amount;
}
function excludeFromFees(address account) external onlyOwner {
require(
!_isExcludedFromFees[account],
"BABYTOKEN: Account is already excluded"
);
_isExcludedFromFees[account] = true;
emit ExcludeFromFees(account);
}
function excludeMultipleAccountsFromFees(address[] calldata accounts)
external
onlyOwner
{
for (uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFees[accounts[i]] = true;
}
emit ExcludeMultipleAccountsFromFees(accounts);
}
function setMarketingWallet(address payable wallet) external onlyOwner {
require(
wallet != address(0),
"BABYTOKEN: The marketing wallet cannot be the value of zero"
);
require(!wallet.isContract(), "Marketing wallet cannot be a contract");
_marketingWalletAddress = wallet;
}
function setTokenRewardsFee(uint256 value) external onlyOwner {
tokenRewardsFee = value;
totalFees = tokenRewardsFee.add(liquidityFee).add(marketingFee);
require(totalFees <= 25, "Total fee is over 25%");
}
function setLiquiditFee(uint256 value) external onlyOwner {
liquidityFee = value;
totalFees = tokenRewardsFee.add(liquidityFee).add(marketingFee);
require(totalFees <= 25, "Total fee is over 25%");
}
function setMarketingFee(uint256 value) external onlyOwner {
marketingFee = value;
totalFees = tokenRewardsFee.add(liquidityFee).add(marketingFee);
require(totalFees <= 25, "Total fee is over 25%");
}
function _setAutomatedMarketMakerPair(address pair, bool value) private {
require(
automatedMarketMakerPairs[pair] != value,
"BABYTOKEN: Automated market maker pair is already set to that value"
);
automatedMarketMakerPairs[pair] = value;
if (value) {
dividendTracker.excludeFromDividends(pair);
}
emit SetAutomatedMarketMakerPair(pair, value);
}
function updateGasForProcessing(uint256 newValue) public onlyOwner {
require(
newValue >= 200000 && newValue <= 500000,
"BABYTOKEN: gasForProcessing must be between 200,000 and 500,000"
);
require(
newValue != gasForProcessing,
"BABYTOKEN: Cannot update gasForProcessing to same value"
);
emit GasForProcessingUpdated(newValue, gasForProcessing);
gasForProcessing = newValue;
}
function updateClaimWait(uint256 claimWait) external onlyOwner {
dividendTracker.updateClaimWait(claimWait);
}
function getClaimWait() external view returns (uint256) {
return dividendTracker.claimWait();
}
function updateMinimumTokenBalanceForDividends(uint256 amount)
external
onlyOwner
{
dividendTracker.updateMinimumTokenBalanceForDividends(amount);
}
function getMinimumTokenBalanceForDividends()
external
view
returns (uint256)
{
return dividendTracker.minimumTokenBalanceForDividends();
}
function getTotalDividendsDistributed() external view returns (uint256) {
return dividendTracker.totalDividendsDistributed();
}
function isExcludedFromFees(address account) public view returns (bool) {
return _isExcludedFromFees[account];
}
function withdrawableDividendOf(address account)
public
view
returns (uint256)
{
return dividendTracker.withdrawableDividendOf(account);
}
function dividendTokenBalanceOf(address account)
public
view
returns (uint256)
{
return dividendTracker.balanceOf(account);
}
function excludeFromDividends(address account) external onlyOwner {
dividendTracker.excludeFromDividends(account);
}
function isExcludedFromDividends(address account)
public
view
returns (bool)
{
return dividendTracker.isExcludedFromDividends(account);
}
function getAccountDividendsInfo(address account)
external
view
returns (
address,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
return dividendTracker.getAccount(account);
}
function getAccountDividendsInfoAtIndex(uint256 index)
external
view
returns (
address,
int256,
int256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
return dividendTracker.getAccountAtIndex(index);
}
function processDividendTracker(uint256 gas) external {
(
uint256 iterations,
uint256 claims,
uint256 lastProcessedIndex
) = dividendTracker.process(gas);
emit ProcessedDividendTracker(
iterations,
claims,
lastProcessedIndex,
false,
gas,
tx.origin
);
}
function claim() external {
dividendTracker.processAccount(payable(msg.sender), false);
}
function getLastProcessedIndex() external view returns (uint256) {
return dividendTracker.getLastProcessedIndex();
}
function getNumberOfDividendTokenHolders() external view returns (uint256) {
return dividendTracker.getNumberOfTokenHolders();
}
function _transfer(
address from,
address to,
uint256 amount
) internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if (amount == 0) {
super._transfer(from, to, 0);
return;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= swapTokensAtAmount;
if (
canSwap &&
!swapping &&
!automatedMarketMakerPairs[from] &&
from != owner() &&
to != owner() &&
totalFees > 0
) {
swapping = true;
if (marketingFee > 0) {
uint256 marketingTokens = contractTokenBalance
.mul(marketingFee)
.div(totalFees);
swapAndSendToFee(marketingTokens);
}
if (liquidityFee > 0) {
uint256 swapTokens = contractTokenBalance.mul(liquidityFee).div(
totalFees
);
swapAndLiquify(swapTokens);
}
uint256 sellTokens = balanceOf(address(this));
if (sellTokens > 0) {
swapAndSendDividends(sellTokens);
}
swapping = false;
}
bool takeFee = !swapping;
// if any account belongs to _isExcludedFromFee account then remove the fee
if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {
takeFee = false;
}
if (takeFee && totalFees > 0) {
uint256 fees = amount.mul(totalFees).div(100);
amount = amount.sub(fees);
super._transfer(from, address(this), fees);
}
super._transfer(from, to, amount);
try
dividendTracker.setBalance(payable(from), balanceOf(from))
{} catch {}
try dividendTracker.setBalance(payable(to), balanceOf(to)) {} catch {}
if (!swapping) {
uint256 gas = gasForProcessing;
try dividendTracker.process(gas) returns (
uint256 iterations,
uint256 claims,
uint256 lastProcessedIndex
) {
emit ProcessedDividendTracker(
iterations,
claims,
lastProcessedIndex,
true,
gas,
tx.origin
);
} catch {}
}
}
function swapAndSendToFee(uint256 tokens) private {
uint256 initialCAKEBalance = IERC20(rewardToken).balanceOf(
address(this)
);
swapTokensForCake(tokens);
uint256 newBalance = (IERC20(rewardToken).balanceOf(address(this))).sub(
initialCAKEBalance
);
IERC20(rewardToken).safeTransfer(_marketingWalletAddress, newBalance);
}
function swapAndLiquify(uint256 tokens) private {
// split the contract balance into halves
uint256 half = tokens.div(2);
uint256 otherHalf = tokens.sub(half);
// capture the contract's current ETH balance.
// this is so that we can capture exactly the amount of ETH that the
// swap creates, and not make the liquidity event include any ETH that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for ETH
swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
// how much ETH did we just swap into?
uint256 newBalance = address(this).balance.sub(initialBalance);
// add liquidity to uniswap
addLiquidity(otherHalf, newBalance);
emit SwapAndLiquify(half, newBalance, otherHalf);
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function swapTokensForCake(uint256 tokenAmount) private {
address[] memory path = new address[](3);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
path[2] = rewardToken;
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{ value: ethAmount }(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0xdead),
block.timestamp
);
}
function swapAndSendDividends(uint256 tokens) private {
swapTokensForCake(tokens);
uint256 dividends = IERC20(rewardToken).balanceOf(address(this));
bool success = SafeERC20NoRevert.safeTransfer(
IERC20(rewardToken),
address(dividendTracker),
dividends
);
if (success) {
dividendTracker.distributeCAKEDividends(dividends);
emit SendDividends(tokens, dividends);
}
}
}
Contract ABI
[{"type":"constructor","stateMutability":"payable","inputs":[{"type":"string","name":"name_","internalType":"string"},{"type":"string","name":"symbol_","internalType":"string"},{"type":"uint256","name":"totalSupply_","internalType":"uint256"},{"type":"address[4]","name":"addrs","internalType":"address[4]"},{"type":"uint256[3]","name":"feeSettings","internalType":"uint256[3]"},{"type":"uint256","name":"minimumTokenBalanceForDividends_","internalType":"uint256"},{"type":"address","name":"serviceFeeReceiver_","internalType":"address"},{"type":"uint256","name":"serviceFee_","internalType":"uint256"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ExcludeFromFees","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ExcludeMultipleAccountsFromFees","inputs":[{"type":"address[]","name":"accounts","internalType":"address[]","indexed":false}],"anonymous":false},{"type":"event","name":"GasForProcessingUpdated","inputs":[{"type":"uint256","name":"newValue","internalType":"uint256","indexed":true},{"type":"uint256","name":"oldValue","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ProcessedDividendTracker","inputs":[{"type":"uint256","name":"iterations","internalType":"uint256","indexed":false},{"type":"uint256","name":"claims","internalType":"uint256","indexed":false},{"type":"uint256","name":"lastProcessedIndex","internalType":"uint256","indexed":false},{"type":"bool","name":"automatic","internalType":"bool","indexed":true},{"type":"uint256","name":"gas","internalType":"uint256","indexed":false},{"type":"address","name":"processor","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"SendDividends","inputs":[{"type":"uint256","name":"tokensSwapped","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"SetAutomatedMarketMakerPair","inputs":[{"type":"address","name":"pair","internalType":"address","indexed":true},{"type":"bool","name":"value","internalType":"bool","indexed":true}],"anonymous":false},{"type":"event","name":"SwapAndLiquify","inputs":[{"type":"uint256","name":"tokensSwapped","internalType":"uint256","indexed":false},{"type":"uint256","name":"ethReceived","internalType":"uint256","indexed":false},{"type":"uint256","name":"tokensIntoLiqudity","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TokenCreated","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint8","name":"tokenType","internalType":"enum TokenType","indexed":false},{"type":"uint256","name":"version","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"VERSION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"_marketingWalletAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"automatedMarketMakerPairs","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claim","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"dividendTokenBalanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract BABYTOKENDividendTracker"}],"name":"dividendTracker","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"excludeFromDividends","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"excludeFromFees","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"excludeMultipleAccountsFromFees","inputs":[{"type":"address[]","name":"accounts","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"gasForProcessing","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"int256","name":"","internalType":"int256"},{"type":"int256","name":"","internalType":"int256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getAccountDividendsInfo","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"int256","name":"","internalType":"int256"},{"type":"int256","name":"","internalType":"int256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getAccountDividendsInfoAtIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getClaimWait","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getLastProcessedIndex","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getMinimumTokenBalanceForDividends","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getNumberOfDividendTokenHolders","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalDividendsDistributed","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExcludedFromDividends","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isExcludedFromFees","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"liquidityFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"marketingFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"processDividendTracker","inputs":[{"type":"uint256","name":"gas","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setLiquiditFee","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMarketingFee","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMarketingWallet","inputs":[{"type":"address","name":"wallet","internalType":"address payable"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSwapTokensAtAmount","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenRewardsFee","inputs":[{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"swapTokensAtAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenRewardsFee","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalFees","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"uniswapV2Pair","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IUniswapV2Router02"}],"name":"uniswapV2Router","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateClaimWait","inputs":[{"type":"uint256","name":"claimWait","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateGasForProcessing","inputs":[{"type":"uint256","name":"newValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateMinimumTokenBalanceForDividends","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawableDividendOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60806040526040516200409838038062004098833981016040819052620000269162000d7f565b8751889088906200003f90600390602085019062000b9a565b5080516200005590600490602084019062000b9a565b505050620000726200006c6200080960201b60201c565b6200080d565b8451600980546001600160a01b03199081166001600160a01b03938416179091556040870151600f805490921692169182179055331415620001115760405162461bcd60e51b815260206004820152602d60248201527f4f776e657220616e64206d61726b6574696e672077616c6c65742063616e6e6f60448201526c74206265207468652073616d6560981b60648201526084015b60405180910390fd5b600f5462000134906001600160a01b03166200085f602090811b6200194c17901c565b15620001915760405162461bcd60e51b815260206004820152602560248201527f4d61726b6574696e672077616c6c65742063616e6e6f74206265206120636f6e6044820152641d1c9858dd60da1b606482015260840162000108565b8351600b819055602080860151600c8190556040870151600d819055620001dd939092620001c992906200195262000865821b17901c565b6200086560201b620019521790919060201c565b600e81905560191015620002345760405162461bcd60e51b815260206004820152601560248201527f546f74616c20666565206973206f766572203235250000000000000000000000604482015260640162000108565b620002506103e8876200087a60201b6200195e1790919060201c565b600a55620493e06010556200027785600360200201516200088860201b6200196a1760201c565b600880546001600160a01b0319166001600160a01b0392831690811790915560095460405163cd6dc68760e01b815292166004830152602482018590529063cd6dc68790604401600060405180830381600087803b158015620002d957600080fd5b505af1158015620002ee573d6000803e3d6000fd5b505050506000856001600481106200031657634e487b7160e01b600052603260045260246000fd5b602002015190506000816001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156200035957600080fd5b505afa1580156200036e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000394919062000d62565b6001600160a01b031663c9c6539630846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015620003dd57600080fd5b505afa158015620003f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000418919062000d62565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156200046157600080fd5b505af115801562000476573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200049c919062000d62565b600680546001600160a01b038086166001600160a01b03199283161790925560078054928416929091169190911790559050620004db81600162000937565b60085460405163031e79db60e41b81526001600160a01b0390911660048201819052906331e79db090602401600060405180830381600087803b1580156200052257600080fd5b505af115801562000537573d6000803e3d6000fd5b505060085460405163031e79db60e41b81523060048201526001600160a01b0390911692506331e79db09150602401600060405180830381600087803b1580156200058157600080fd5b505af115801562000596573d6000803e3d6000fd5b50506008546001600160a01b031691506331e79db09050620005c06005546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b1580156200060257600080fd5b505af115801562000617573d6000803e3d6000fd5b505060085460405163031e79db60e41b815261dead60048201526001600160a01b0390911692506331e79db09150602401600060405180830381600087803b1580156200066357600080fd5b505af115801562000678573d6000803e3d6000fd5b505060085460405163031e79db60e41b81526001600160a01b03868116600483015290911692506331e79db09150602401600060405180830381600087803b158015620006c457600080fd5b505af1158015620006d9573d6000803e3d6000fd5b50505050600160116000620006f362000aa660201b60201c565b6001600160a01b03908116825260208083019390935260409182016000908120805495151560ff19968716179055600f54909116815260119092528082208054841660019081179091553083529120805490921617905562000768620007616005546001600160a01b031690565b8962000ab5565b306200077c6005546001600160a01b031690565b6001600160a01b03167f56358b41df5fa59f5639228f0930994cbdde383c8a8fd74e06c04e1deebe3562600480604051620007b992919062000e8f565b60405180910390a36040516001600160a01b0385169084156108fc029085906000818181858888f19350505050158015620007f8573d6000803e3d6000fd5b505050505050505050505062000fb3565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b3b151590565b600062000873828462000f1a565b9392505050565b600062000873828462000f3f565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116620009325760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c656400000000000000000000604482015260640162000108565b919050565b6001600160a01b03821660009081526012602052604090205460ff1615158115151415620009da5760405162461bcd60e51b815260206004820152604360248201527f42414259544f4b454e3a204175746f6d61746564206d61726b6574206d616b6560448201527f72207061697220697320616c72656164792073657420746f20746861742076616064820152626c756560e81b608482015260a40162000108565b6001600160a01b0382166000908152601260205260409020805460ff1916821580159190911790915562000a6a5760085460405163031e79db60e41b81526001600160a01b038481166004830152909116906331e79db090602401600060405180830381600087803b15801562000a5057600080fd5b505af115801562000a65573d6000803e3d6000fd5b505050505b604051811515906001600160a01b038416907fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab90600090a35050565b6005546001600160a01b031690565b6001600160a01b03821662000b0d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640162000108565b806002600082825462000b21919062000f1a565b90915550506001600160a01b0382166000908152602081905260408120805483929062000b5090849062000f1a565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b82805462000ba89062000f60565b90600052602060002090601f01602090048101928262000bcc576000855562000c17565b82601f1062000be757805160ff191683800117855562000c17565b8280016001018555821562000c17579182015b8281111562000c1757825182559160200191906001019062000bfa565b5062000c2592915062000c29565b5090565b5b8082111562000c25576000815560010162000c2a565b80516001600160a01b03811681146200093257600080fd5b600082601f83011262000c69578081fd5b604051606081016001600160401b038111828210171562000c8e5762000c8e62000f9d565b60405280836060810186101562000ca3578384fd5b835b600381101562000cc657815183526020928301929091019060010162000ca5565b509195945050505050565b600082601f83011262000ce2578081fd5b81516001600160401b0381111562000cfe5762000cfe62000f9d565b602062000d14601f8301601f1916820162000ee7565b828152858284870101111562000d28578384fd5b835b8381101562000d4757858101830151828201840152820162000d2a565b8381111562000d5857848385840101525b5095945050505050565b60006020828403121562000d74578081fd5b620008738262000c40565b6000806000806000806000806101a0898b03121562000d9c578384fd5b88516001600160401b038082111562000db3578586fd5b62000dc18c838d0162000cd1565b995060209150818b01518181111562000dd8578687fd5b62000de68d828e0162000cd1565b9950505060408a015196508a607f8b011262000e00578485fd5b62000e0a62000ebc565b8060608c0160e08d018e81111562000e20578889fd5b885b600481101562000e4a5762000e378362000c40565b8552938501939185019160010162000e22565b5082995062000e5a8f8262000c58565b98505050505050610140890151925062000e786101608a0162000c40565b915061018089015190509295985092959890939650565b604081016008841062000eb257634e487b7160e01b600052602160045260246000fd5b9281526020015290565b604051608081016001600160401b038111828210171562000ee15762000ee162000f9d565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000f125762000f1262000f9d565b604052919050565b6000821982111562000f3a57634e487b7160e01b81526011600452602481fd5b500190565b60008262000f5b57634e487b7160e01b81526012600452602481fd5b500490565b600181811c9082168062000f7557607f821691505b6020821081141562000f9757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6130d58062000fc36000396000f3fe6080604052600436106102e85760003560e01c8063715018a611610190578063b62496f5116100dc578063e708a0f911610095578063f27fd2541161006f578063f27fd2541461091c578063f2fde38b1461093c578063f7c618c11461095c578063ffa1ad741461097c57600080fd5b8063e708a0f9146108d1578063e7841ec0146108e7578063e98030c7146108fc57600080fd5b8063b62496f5146107f0578063bdd4f29f14610820578063c705c56914610835578063dd62ed3e14610855578063e2f456051461089b578063e57f14e1146108b157600080fd5b8063a26579ad11610149578063a9059cbb11610123578063a9059cbb1461072b578063ad56c13c1461074b578063adefd90c146107b0578063afa4f3b2146107d057600080fd5b8063a26579ad146106d6578063a457c2d7146106eb578063a8b9d2401461070b57600080fd5b8063715018a614610642578063871c128d146106575780638da5cb5b1461067757806395d89b411461069557806398118cb4146106aa5780639c1b8af5146106c057600080fd5b8063395093511161024f5780635d098b38116102085780636843cd84116101e25780636843cd84146105b65780636b67c4df146105d6578063700bb191146105ec57806370a082311461060c57600080fd5b80635d098b3814610561578063625e764c1461058157806364b0f653146105a157600080fd5b806339509351146104935780634144d9e4146104b357806349bd5a5e146104d35780634e71d92d146104f35780634ed080c7146105085780634fbee1931461052857600080fd5b806318160ddd116102a157806318160ddd146103ed57806323b872dd146104025780632c1f52161461042257806330bb4cff14610442578063313ce5671461045757806331e79db01461047357600080fd5b806306fdde03146102f4578063095ea7b31461031f5780630c43c79b1461034f5780630dcb2e891461037157806313114a9d146103915780631694505e146103b557600080fd5b366102ef57005b600080fd5b34801561030057600080fd5b50610309610991565b6040516103169190612e24565b60405180910390f35b34801561032b57600080fd5b5061033f61033a366004612ca2565b610a23565b6040519015158152602001610316565b34801561035b57600080fd5b5061036f61036a366004612ccd565b610a39565b005b34801561037d57600080fd5b5061036f61038c366004612d5d565b610b2a565b34801561039d57600080fd5b506103a7600e5481565b604051908152602001610316565b3480156103c157600080fd5b506006546103d5906001600160a01b031681565b6040516001600160a01b039091168152602001610316565b3480156103f957600080fd5b506002546103a7565b34801561040e57600080fd5b5061033f61041d366004612bf9565b610bb6565b34801561042e57600080fd5b506008546103d5906001600160a01b031681565b34801561044e57600080fd5b506103a7610c62565b34801561046357600080fd5b5060405160128152602001610316565b34801561047f57600080fd5b5061036f61048e366004612b89565b610ce4565b34801561049f57600080fd5b5061033f6104ae366004612ca2565b610d40565b3480156104bf57600080fd5b50600f546103d5906001600160a01b031681565b3480156104df57600080fd5b506007546103d5906001600160a01b031681565b3480156104ff57600080fd5b5061036f610d7c565b34801561051457600080fd5b5061036f610523366004612d5d565b610e03565b34801561053457600080fd5b5061033f610543366004612b89565b6001600160a01b031660009081526011602052604090205460ff1690565b34801561056d57600080fd5b5061036f61057c366004612b89565b610e9b565b34801561058d57600080fd5b5061036f61059c366004612d5d565b610fc9565b3480156105ad57600080fd5b506103a761100d565b3480156105c257600080fd5b506103a76105d1366004612b89565b611052565b3480156105e257600080fd5b506103a7600d5481565b3480156105f857600080fd5b5061036f610607366004612d5d565b6110d7565b34801561061857600080fd5b506103a7610627366004612b89565b6001600160a01b031660009081526020819052604090205490565b34801561064e57600080fd5b5061036f6111b9565b34801561066357600080fd5b5061036f610672366004612d5d565b6111ef565b34801561068357600080fd5b506005546001600160a01b03166103d5565b3480156106a157600080fd5b5061030961134c565b3480156106b657600080fd5b506103a7600c5481565b3480156106cc57600080fd5b506103a760105481565b3480156106e257600080fd5b506103a761135b565b3480156106f757600080fd5b5061033f610706366004612ca2565b6113a0565b34801561071757600080fd5b506103a7610726366004612b89565b611439565b34801561073757600080fd5b5061033f610746366004612ca2565b61146c565b34801561075757600080fd5b5061076b610766366004612b89565b611479565b604080516001600160a01b0390991689526020890197909752958701949094526060860192909252608085015260a084015260c083015260e082015261010001610316565b3480156107bc57600080fd5b5061036f6107cb366004612d5d565b611523565b3480156107dc57600080fd5b5061036f6107eb366004612d5d565b611567565b3480156107fc57600080fd5b5061033f61080b366004612b89565b60126020526000908152604090205460ff1681565b34801561082c57600080fd5b506103a7611621565b34801561084157600080fd5b5061033f610850366004612b89565b611666565b34801561086157600080fd5b506103a7610870366004612bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156108a757600080fd5b506103a7600a5481565b3480156108bd57600080fd5b5061036f6108cc366004612b89565b6116e4565b3480156108dd57600080fd5b506103a7600b5481565b3480156108f357600080fd5b506103a76117d2565b34801561090857600080fd5b5061036f610917366004612d5d565b611817565b34801561092857600080fd5b5061076b610937366004612d5d565b611872565b34801561094857600080fd5b5061036f610957366004612b89565b6118b4565b34801561096857600080fd5b506009546103d5906001600160a01b031681565b34801561098857600080fd5b506103a7600481565b6060600380546109a09061301e565b80601f01602080910402602001604051908101604052809291908181526020018280546109cc9061301e565b8015610a195780601f106109ee57610100808354040283529160200191610a19565b820191906000526020600020905b8154815290600101906020018083116109fc57829003601f168201915b5050505050905090565b6000610a30338484611a07565b50600192915050565b6005546001600160a01b03163314610a6c5760405162461bcd60e51b8152600401610a6390612e9a565b60405180910390fd5b60005b81811015610aec57600160116000858585818110610a9d57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610ab29190612b89565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610ae481613059565b915050610a6f565b507f6f058e77d614a1061fc197c99cdde12f5fa414c92529bbe8f48b02f8d9f4f95d8282604051610b1e929190612dd6565b60405180910390a15050565b6005546001600160a01b03163314610b545760405162461bcd60e51b8152600401610a6390612e9a565b600854604051630dcb2e8960e01b8152600481018390526001600160a01b0390911690630dcb2e89906024015b600060405180830381600087803b158015610b9b57600080fd5b505af1158015610baf573d6000803e3d6000fd5b5050505050565b6000610bc3848484611b2b565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610c485760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610a63565b610c558533858403611a07565b60019150505b9392505050565b600854604080516342d359d760e11b815290516000926001600160a01b0316916385a6b3ae916004808301926020929190829003018186803b158015610ca757600080fd5b505afa158015610cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdf9190612d75565b905090565b6005546001600160a01b03163314610d0e5760405162461bcd60e51b8152600401610a6390612e9a565b60085460405163031e79db60e41b81526001600160a01b038381166004830152909116906331e79db090602401610b81565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610a30918590610d77908690612f84565b611a07565b60085460405163bc4c4b3760e01b8152336004820152600060248201526001600160a01b039091169063bc4c4b3790604401602060405180830381600087803b158015610dc857600080fd5b505af1158015610ddc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190612d3d565b50565b6005546001600160a01b03163314610e2d5760405162461bcd60e51b8152600401610a6390612e9a565b600b819055600d54600c54610e4e9190610e48908490611952565b90611952565b600e81905560191015610e005760405162461bcd60e51b8152602060048201526015602482015274546f74616c20666565206973206f7665722032352560581b6044820152606401610a63565b6005546001600160a01b03163314610ec55760405162461bcd60e51b8152600401610a6390612e9a565b6001600160a01b038116610f415760405162461bcd60e51b815260206004820152603b60248201527f42414259544f4b454e3a20546865206d61726b6574696e672077616c6c65742060448201527f63616e6e6f74206265207468652076616c7565206f66207a65726f00000000006064820152608401610a63565b6001600160a01b0381163b15610fa75760405162461bcd60e51b815260206004820152602560248201527f4d61726b6574696e672077616c6c65742063616e6e6f74206265206120636f6e6044820152641d1c9858dd60da1b6064820152608401610a63565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610ff35760405162461bcd60e51b8152600401610a6390612e9a565b600d819055600c54600b54610e4e918391610e4891611952565b600854604080516304ddf6ef60e11b815290516000926001600160a01b0316916309bbedde916004808301926020929190829003018186803b158015610ca757600080fd5b6008546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a08231906024015b60206040518083038186803b15801561109957600080fd5b505afa1580156110ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190612d75565b92915050565b6008546040516001624d3b8760e01b0319815260048101839052600091829182916001600160a01b03169063ffb2c47990602401606060405180830381600087803b15801561112557600080fd5b505af1158015611139573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115d9190612d8d565b604080518481526020810184905290810182905260608101889052929550909350915032906000907fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a98906080015b60405180910390a350505050565b6005546001600160a01b031633146111e35760405162461bcd60e51b8152600401610a6390612e9a565b6111ed6000611f82565b565b6005546001600160a01b031633146112195760405162461bcd60e51b8152600401610a6390612e9a565b62030d40811015801561122f57506207a1208111155b6112a15760405162461bcd60e51b815260206004820152603f60248201527f42414259544f4b454e3a20676173466f7250726f63657373696e67206d75737460448201527f206265206265747765656e203230302c30303020616e64203530302c303030006064820152608401610a63565b6010548114156113195760405162461bcd60e51b815260206004820152603760248201527f42414259544f4b454e3a2043616e6e6f742075706461746520676173466f725060448201527f726f63657373696e6720746f2073616d652076616c75650000000000000000006064820152608401610a63565b60105460405182907f40d7e40e79af4e8e5a9b3c57030d8ea93f13d669c06d448c4d631d4ae7d23db790600090a3601055565b6060600480546109a09061301e565b60085460408051631bc9e27b60e21b815290516000926001600160a01b031691636f2789ec916004808301926020929190829003018186803b158015610ca757600080fd5b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156114225760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610a63565b61142f3385858403611a07565b5060019392505050565b6008546040516302a2e74960e61b81526001600160a01b038381166004830152600092169063a8b9d24090602401611081565b6000610a30338484611b2b565b60085460405163fbcbc0f160e01b81526001600160a01b038381166004830152600092839283928392839283928392839291169063fbcbc0f1906024015b6101006040518083038186803b1580156114d057600080fd5b505afa1580156114e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115089190612c39565b97509750975097509750975097509750919395975091939597565b6005546001600160a01b0316331461154d5760405162461bcd60e51b8152600401610a6390612e9a565b600c819055600d54600b54610e4e9190610e489084611952565b6005546001600160a01b031633146115915760405162461bcd60e51b8152600401610a6390612e9a565b620186a061159e60025490565b6115a89190612f9c565b811161161c5760405162461bcd60e51b815260206004820152603d60248201527f42414259544f4b454e3a20416d6f756e74206d7573742062652067726561746560448201527f72207468616e20302e30303125206f6620746f74616c20737570706c790000006064820152608401610a63565b600a55565b60085460408051632f842d8560e21b815290516000926001600160a01b03169163be10b614916004808301926020929190829003018186803b158015610ca757600080fd5b60085460405163c705c56960e01b81526001600160a01b038381166004830152600092169063c705c5699060240160206040518083038186803b1580156116ac57600080fd5b505afa1580156116c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190612d3d565b6005546001600160a01b0316331461170e5760405162461bcd60e51b8152600401610a6390612e9a565b6001600160a01b03811660009081526011602052604090205460ff16156117865760405162461bcd60e51b815260206004820152602660248201527f42414259544f4b454e3a204163636f756e7420697320616c726561647920657860448201526518db1d59195960d21b6064820152608401610a63565b6001600160a01b038116600081815260116020526040808220805460ff19166001179055517f57a00f76b5f242fb1e04b0b514a6974665a5b07bce45e39f36dabff4a042d9369190a250565b6008546040805163039e107b60e61b815290516000926001600160a01b03169163e7841ec0916004808301926020929190829003018186803b158015610ca757600080fd5b6005546001600160a01b031633146118415760405162461bcd60e51b8152600401610a6390612e9a565b60085460405163e98030c760e01b8152600481018390526001600160a01b039091169063e98030c790602401610b81565b600854604051635183d6fd60e01b81526004810183905260009182918291829182918291829182916001600160a01b0390911690635183d6fd906024016114b7565b6005546001600160a01b031633146118de5760405162461bcd60e51b8152600401610a6390612e9a565b6001600160a01b0381166119435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a63565b610e0081611f82565b3b151590565b6000610c5b8284612f84565b6000610c5b8284612f9c565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116611a025760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610a63565b919050565b6001600160a01b038316611a695760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a63565b6001600160a01b038216611aca5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a63565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611b515760405162461bcd60e51b8152600401610a6390612ecf565b6001600160a01b038216611b775760405162461bcd60e51b8152600401610a6390612e57565b80611b8d57611b8883836000611fd4565b505050565b30600090815260208190526040902054600a5481108015908190611bbb5750600754600160a01b900460ff16155b8015611be057506001600160a01b03851660009081526012602052604090205460ff16155b8015611bfa57506005546001600160a01b03868116911614155b8015611c1457506005546001600160a01b03858116911614155b8015611c2257506000600e54115b15611cd2576007805460ff60a01b1916600160a01b179055600d5415611c72576000611c65600e54611c5f600d548661212190919063ffffffff16565b9061195e565b9050611c708161212d565b505b600c5415611ca4576000611c97600e54611c5f600c548661212190919063ffffffff16565b9050611ca28161225c565b505b306000908152602081905260409020548015611cc357611cc3816122e3565b506007805460ff60a01b191690555b6007546001600160a01b03861660009081526011602052604090205460ff600160a01b909204821615911680611d2057506001600160a01b03851660009081526011602052604090205460ff165b15611d29575060005b808015611d3857506000600e54115b15611d74576000611d596064611c5f600e548861212190919063ffffffff16565b9050611d658582612430565b9450611d72873083611fd4565b505b611d7f868686611fd4565b6008546001600160a01b031663e30443bc87611db0816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015611df657600080fd5b505af1925050508015611e07575060015b506008546001600160a01b031663e30443bc86611e39816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015611e7f57600080fd5b505af1925050508015611e90575060015b50600754600160a01b900460ff16611f7a576010546008546040516001624d3b8760e01b03198152600481018390526001600160a01b039091169063ffb2c47990602401606060405180830381600087803b158015611eee57600080fd5b505af1925050508015611f1e575060408051601f3d908101601f19168201909252611f1b91810190612d8d565b60015b611f2757611f78565b60408051848152602081018490529081018290526060810185905232906001907fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a989060800160405180910390a35050505b505b505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038316611ffa5760405162461bcd60e51b8152600401610a6390612ecf565b6001600160a01b0382166120205760405162461bcd60e51b8152600401610a6390612e57565b6001600160a01b038316600090815260208190526040902054818110156120985760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610a63565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906120cf908490612f84565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111ab91815260200190565b50505050565b6000610c5b8284612fbc565b6009546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561217157600080fd5b505afa158015612185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121a99190612d75565b90506121b48261243c565b6009546040516370a0823160e01b815230600482015260009161223c9184916001600160a01b0316906370a082319060240160206040518083038186803b1580156121fe57600080fd5b505afa158015612212573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122369190612d75565b90612430565b600f54600954919250611b88916001600160a01b039081169116836125fa565b600061226982600261195e565b905060006122778383612430565b9050476122838361264c565b600061228f4783612430565b905061229b838261279b565b60408051858152602081018390529081018490527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a15050505050565b6122ec8161243c565b6009546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561233057600080fd5b505afa158015612344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123689190612d75565b60095460085491925060009161238b916001600160a01b03908116911684612855565b90508015611b885760085460405163ba72a95560e01b8152600481018490526001600160a01b039091169063ba72a95590602401600060405180830381600087803b1580156123d957600080fd5b505af11580156123ed573d6000803e3d6000fd5b505060408051868152602081018690527f80195cc573b02cc48460cbca6e6e4cc85ddb91959d946e1c3025ea3d87942dc3935001905060405180910390a1505050565b6000610c5b8284612fdb565b6040805160038082526080820190925260009160208201606080368337019050509050308160008151811061248157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156124d557600080fd5b505afa1580156124e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250d9190612ba5565b8160018151811061252e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260095482519116908290600290811061256d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526006546125939130911684611a07565b600654604051635c11d79560e01b81526001600160a01b0390911690635c11d795906125cc908590600090869030904290600401612f14565b600060405180830381600087803b1580156125e657600080fd5b505af1158015611f7a573d6000803e3d6000fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611b8890849061293f565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061268f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156126e357600080fd5b505afa1580156126f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271b9190612ba5565b8160018151811061273c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526006546127629130911684611a07565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac947906125cc908590600090869030904290600401612f14565b6006546127b39030906001600160a01b031684611a07565b60065460405163f305d71960e01b815230600482015260248101849052600060448201819052606482015261dead60848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561281c57600080fd5b505af1158015612830573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610baf9190612d8d565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283928392918816916128b39190612dba565b6000604051808303816000865af19150503d80600081146128f0576040519150601f19603f3d011682016040523d82523d6000602084013e6128f5565b606091505b509150915081801561291f57508051158061291f57508080602001905181019061291f9190612d3d565b801561293557506000866001600160a01b03163b115b9695505050505050565b6000612994826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a119092919063ffffffff16565b805190915015611b8857808060200190518101906129b29190612d3d565b611b885760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a63565b6060612a208484600085612a28565b949350505050565b606082471015612a895760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a63565b843b612ad75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a63565b600080866001600160a01b03168587604051612af39190612dba565b60006040518083038185875af1925050503d8060008114612b30576040519150601f19603f3d011682016040523d82523d6000602084013e612b35565b606091505b5091509150612b45828286612b50565b979650505050505050565b60608315612b5f575081610c5b565b825115612b6f5782518084602001fd5b8160405162461bcd60e51b8152600401610a639190612e24565b600060208284031215612b9a578081fd5b8135610c5b8161308a565b600060208284031215612bb6578081fd5b8151610c5b8161308a565b60008060408385031215612bd3578081fd5b8235612bde8161308a565b91506020830135612bee8161308a565b809150509250929050565b600080600060608486031215612c0d578081fd5b8335612c188161308a565b92506020840135612c288161308a565b929592945050506040919091013590565b600080600080600080600080610100898b031215612c55578384fd5b8851612c608161308a565b809850506020890151965060408901519550606089015194506080890151935060a0890151925060c0890151915060e089015190509295985092959890939650565b60008060408385031215612cb4578182fd5b8235612cbf8161308a565b946020939093013593505050565b60008060208385031215612cdf578182fd5b823567ffffffffffffffff80821115612cf6578384fd5b818501915085601f830112612d09578384fd5b813581811115612d17578485fd5b8660208260051b8501011115612d2b578485fd5b60209290920196919550909350505050565b600060208284031215612d4e578081fd5b81518015158114610c5b578182fd5b600060208284031215612d6e578081fd5b5035919050565b600060208284031215612d86578081fd5b5051919050565b600080600060608486031215612da1578283fd5b8351925060208401519150604084015190509250925092565b60008251612dcc818460208701612ff2565b9190910192915050565b60208082528181018390526000908460408401835b86811015612e19578235612dfe8161308a565b6001600160a01b031682529183019190830190600101612deb565b509695505050505050565b6020815260008251806020840152612e43816040850160208701612ff2565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015612f635784516001600160a01b031683529383019391830191600101612f3e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612f9757612f97613074565b500190565b600082612fb757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612fd657612fd6613074565b500290565b600082821015612fed57612fed613074565b500390565b60005b8381101561300d578181015183820152602001612ff5565b8381111561211b5750506000910152565b600181811c9082168061303257607f821691505b6020821081141561305357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561306d5761306d613074565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610e0057600080fdfea2646970667358221220318360b040886b3e05fd3ff12e50d7e402973bf3fe56a73b04cb78503e7c818564736f6c6343000804003300000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000d92289838d21a99680000000000000000000000000000007901a3569679aec3501dbec59399f327854a70fe000000000000000000000000af5e33cb31a3454c950bee39ed1c76fd65b394cf00000000000000000000000080a94f765793766d5978a19a9d6fdaddac5660000000000000000000000000004abf5dc2563a9b2d97cebc90ae7ce7f41e938d3a00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000012d231c7c593eec00000000000000000000000000004b04213c2774f77e60702880654206b116d00508000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000000013464c55464659204452494e4b532046414e5441000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006464c554646590000000000000000000000000000000000000000000000000000
Deployed ByteCode
0x6080604052600436106102e85760003560e01c8063715018a611610190578063b62496f5116100dc578063e708a0f911610095578063f27fd2541161006f578063f27fd2541461091c578063f2fde38b1461093c578063f7c618c11461095c578063ffa1ad741461097c57600080fd5b8063e708a0f9146108d1578063e7841ec0146108e7578063e98030c7146108fc57600080fd5b8063b62496f5146107f0578063bdd4f29f14610820578063c705c56914610835578063dd62ed3e14610855578063e2f456051461089b578063e57f14e1146108b157600080fd5b8063a26579ad11610149578063a9059cbb11610123578063a9059cbb1461072b578063ad56c13c1461074b578063adefd90c146107b0578063afa4f3b2146107d057600080fd5b8063a26579ad146106d6578063a457c2d7146106eb578063a8b9d2401461070b57600080fd5b8063715018a614610642578063871c128d146106575780638da5cb5b1461067757806395d89b411461069557806398118cb4146106aa5780639c1b8af5146106c057600080fd5b8063395093511161024f5780635d098b38116102085780636843cd84116101e25780636843cd84146105b65780636b67c4df146105d6578063700bb191146105ec57806370a082311461060c57600080fd5b80635d098b3814610561578063625e764c1461058157806364b0f653146105a157600080fd5b806339509351146104935780634144d9e4146104b357806349bd5a5e146104d35780634e71d92d146104f35780634ed080c7146105085780634fbee1931461052857600080fd5b806318160ddd116102a157806318160ddd146103ed57806323b872dd146104025780632c1f52161461042257806330bb4cff14610442578063313ce5671461045757806331e79db01461047357600080fd5b806306fdde03146102f4578063095ea7b31461031f5780630c43c79b1461034f5780630dcb2e891461037157806313114a9d146103915780631694505e146103b557600080fd5b366102ef57005b600080fd5b34801561030057600080fd5b50610309610991565b6040516103169190612e24565b60405180910390f35b34801561032b57600080fd5b5061033f61033a366004612ca2565b610a23565b6040519015158152602001610316565b34801561035b57600080fd5b5061036f61036a366004612ccd565b610a39565b005b34801561037d57600080fd5b5061036f61038c366004612d5d565b610b2a565b34801561039d57600080fd5b506103a7600e5481565b604051908152602001610316565b3480156103c157600080fd5b506006546103d5906001600160a01b031681565b6040516001600160a01b039091168152602001610316565b3480156103f957600080fd5b506002546103a7565b34801561040e57600080fd5b5061033f61041d366004612bf9565b610bb6565b34801561042e57600080fd5b506008546103d5906001600160a01b031681565b34801561044e57600080fd5b506103a7610c62565b34801561046357600080fd5b5060405160128152602001610316565b34801561047f57600080fd5b5061036f61048e366004612b89565b610ce4565b34801561049f57600080fd5b5061033f6104ae366004612ca2565b610d40565b3480156104bf57600080fd5b50600f546103d5906001600160a01b031681565b3480156104df57600080fd5b506007546103d5906001600160a01b031681565b3480156104ff57600080fd5b5061036f610d7c565b34801561051457600080fd5b5061036f610523366004612d5d565b610e03565b34801561053457600080fd5b5061033f610543366004612b89565b6001600160a01b031660009081526011602052604090205460ff1690565b34801561056d57600080fd5b5061036f61057c366004612b89565b610e9b565b34801561058d57600080fd5b5061036f61059c366004612d5d565b610fc9565b3480156105ad57600080fd5b506103a761100d565b3480156105c257600080fd5b506103a76105d1366004612b89565b611052565b3480156105e257600080fd5b506103a7600d5481565b3480156105f857600080fd5b5061036f610607366004612d5d565b6110d7565b34801561061857600080fd5b506103a7610627366004612b89565b6001600160a01b031660009081526020819052604090205490565b34801561064e57600080fd5b5061036f6111b9565b34801561066357600080fd5b5061036f610672366004612d5d565b6111ef565b34801561068357600080fd5b506005546001600160a01b03166103d5565b3480156106a157600080fd5b5061030961134c565b3480156106b657600080fd5b506103a7600c5481565b3480156106cc57600080fd5b506103a760105481565b3480156106e257600080fd5b506103a761135b565b3480156106f757600080fd5b5061033f610706366004612ca2565b6113a0565b34801561071757600080fd5b506103a7610726366004612b89565b611439565b34801561073757600080fd5b5061033f610746366004612ca2565b61146c565b34801561075757600080fd5b5061076b610766366004612b89565b611479565b604080516001600160a01b0390991689526020890197909752958701949094526060860192909252608085015260a084015260c083015260e082015261010001610316565b3480156107bc57600080fd5b5061036f6107cb366004612d5d565b611523565b3480156107dc57600080fd5b5061036f6107eb366004612d5d565b611567565b3480156107fc57600080fd5b5061033f61080b366004612b89565b60126020526000908152604090205460ff1681565b34801561082c57600080fd5b506103a7611621565b34801561084157600080fd5b5061033f610850366004612b89565b611666565b34801561086157600080fd5b506103a7610870366004612bc1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3480156108a757600080fd5b506103a7600a5481565b3480156108bd57600080fd5b5061036f6108cc366004612b89565b6116e4565b3480156108dd57600080fd5b506103a7600b5481565b3480156108f357600080fd5b506103a76117d2565b34801561090857600080fd5b5061036f610917366004612d5d565b611817565b34801561092857600080fd5b5061076b610937366004612d5d565b611872565b34801561094857600080fd5b5061036f610957366004612b89565b6118b4565b34801561096857600080fd5b506009546103d5906001600160a01b031681565b34801561098857600080fd5b506103a7600481565b6060600380546109a09061301e565b80601f01602080910402602001604051908101604052809291908181526020018280546109cc9061301e565b8015610a195780601f106109ee57610100808354040283529160200191610a19565b820191906000526020600020905b8154815290600101906020018083116109fc57829003601f168201915b5050505050905090565b6000610a30338484611a07565b50600192915050565b6005546001600160a01b03163314610a6c5760405162461bcd60e51b8152600401610a6390612e9a565b60405180910390fd5b60005b81811015610aec57600160116000858585818110610a9d57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610ab29190612b89565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610ae481613059565b915050610a6f565b507f6f058e77d614a1061fc197c99cdde12f5fa414c92529bbe8f48b02f8d9f4f95d8282604051610b1e929190612dd6565b60405180910390a15050565b6005546001600160a01b03163314610b545760405162461bcd60e51b8152600401610a6390612e9a565b600854604051630dcb2e8960e01b8152600481018390526001600160a01b0390911690630dcb2e89906024015b600060405180830381600087803b158015610b9b57600080fd5b505af1158015610baf573d6000803e3d6000fd5b5050505050565b6000610bc3848484611b2b565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610c485760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610a63565b610c558533858403611a07565b60019150505b9392505050565b600854604080516342d359d760e11b815290516000926001600160a01b0316916385a6b3ae916004808301926020929190829003018186803b158015610ca757600080fd5b505afa158015610cbb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdf9190612d75565b905090565b6005546001600160a01b03163314610d0e5760405162461bcd60e51b8152600401610a6390612e9a565b60085460405163031e79db60e41b81526001600160a01b038381166004830152909116906331e79db090602401610b81565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610a30918590610d77908690612f84565b611a07565b60085460405163bc4c4b3760e01b8152336004820152600060248201526001600160a01b039091169063bc4c4b3790604401602060405180830381600087803b158015610dc857600080fd5b505af1158015610ddc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190612d3d565b50565b6005546001600160a01b03163314610e2d5760405162461bcd60e51b8152600401610a6390612e9a565b600b819055600d54600c54610e4e9190610e48908490611952565b90611952565b600e81905560191015610e005760405162461bcd60e51b8152602060048201526015602482015274546f74616c20666565206973206f7665722032352560581b6044820152606401610a63565b6005546001600160a01b03163314610ec55760405162461bcd60e51b8152600401610a6390612e9a565b6001600160a01b038116610f415760405162461bcd60e51b815260206004820152603b60248201527f42414259544f4b454e3a20546865206d61726b6574696e672077616c6c65742060448201527f63616e6e6f74206265207468652076616c7565206f66207a65726f00000000006064820152608401610a63565b6001600160a01b0381163b15610fa75760405162461bcd60e51b815260206004820152602560248201527f4d61726b6574696e672077616c6c65742063616e6e6f74206265206120636f6e6044820152641d1c9858dd60da1b6064820152608401610a63565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610ff35760405162461bcd60e51b8152600401610a6390612e9a565b600d819055600c54600b54610e4e918391610e4891611952565b600854604080516304ddf6ef60e11b815290516000926001600160a01b0316916309bbedde916004808301926020929190829003018186803b158015610ca757600080fd5b6008546040516370a0823160e01b81526001600160a01b03838116600483015260009216906370a08231906024015b60206040518083038186803b15801561109957600080fd5b505afa1580156110ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190612d75565b92915050565b6008546040516001624d3b8760e01b0319815260048101839052600091829182916001600160a01b03169063ffb2c47990602401606060405180830381600087803b15801561112557600080fd5b505af1158015611139573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115d9190612d8d565b604080518481526020810184905290810182905260608101889052929550909350915032906000907fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a98906080015b60405180910390a350505050565b6005546001600160a01b031633146111e35760405162461bcd60e51b8152600401610a6390612e9a565b6111ed6000611f82565b565b6005546001600160a01b031633146112195760405162461bcd60e51b8152600401610a6390612e9a565b62030d40811015801561122f57506207a1208111155b6112a15760405162461bcd60e51b815260206004820152603f60248201527f42414259544f4b454e3a20676173466f7250726f63657373696e67206d75737460448201527f206265206265747765656e203230302c30303020616e64203530302c303030006064820152608401610a63565b6010548114156113195760405162461bcd60e51b815260206004820152603760248201527f42414259544f4b454e3a2043616e6e6f742075706461746520676173466f725060448201527f726f63657373696e6720746f2073616d652076616c75650000000000000000006064820152608401610a63565b60105460405182907f40d7e40e79af4e8e5a9b3c57030d8ea93f13d669c06d448c4d631d4ae7d23db790600090a3601055565b6060600480546109a09061301e565b60085460408051631bc9e27b60e21b815290516000926001600160a01b031691636f2789ec916004808301926020929190829003018186803b158015610ca757600080fd5b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156114225760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610a63565b61142f3385858403611a07565b5060019392505050565b6008546040516302a2e74960e61b81526001600160a01b038381166004830152600092169063a8b9d24090602401611081565b6000610a30338484611b2b565b60085460405163fbcbc0f160e01b81526001600160a01b038381166004830152600092839283928392839283928392839291169063fbcbc0f1906024015b6101006040518083038186803b1580156114d057600080fd5b505afa1580156114e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115089190612c39565b97509750975097509750975097509750919395975091939597565b6005546001600160a01b0316331461154d5760405162461bcd60e51b8152600401610a6390612e9a565b600c819055600d54600b54610e4e9190610e489084611952565b6005546001600160a01b031633146115915760405162461bcd60e51b8152600401610a6390612e9a565b620186a061159e60025490565b6115a89190612f9c565b811161161c5760405162461bcd60e51b815260206004820152603d60248201527f42414259544f4b454e3a20416d6f756e74206d7573742062652067726561746560448201527f72207468616e20302e30303125206f6620746f74616c20737570706c790000006064820152608401610a63565b600a55565b60085460408051632f842d8560e21b815290516000926001600160a01b03169163be10b614916004808301926020929190829003018186803b158015610ca757600080fd5b60085460405163c705c56960e01b81526001600160a01b038381166004830152600092169063c705c5699060240160206040518083038186803b1580156116ac57600080fd5b505afa1580156116c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d19190612d3d565b6005546001600160a01b0316331461170e5760405162461bcd60e51b8152600401610a6390612e9a565b6001600160a01b03811660009081526011602052604090205460ff16156117865760405162461bcd60e51b815260206004820152602660248201527f42414259544f4b454e3a204163636f756e7420697320616c726561647920657860448201526518db1d59195960d21b6064820152608401610a63565b6001600160a01b038116600081815260116020526040808220805460ff19166001179055517f57a00f76b5f242fb1e04b0b514a6974665a5b07bce45e39f36dabff4a042d9369190a250565b6008546040805163039e107b60e61b815290516000926001600160a01b03169163e7841ec0916004808301926020929190829003018186803b158015610ca757600080fd5b6005546001600160a01b031633146118415760405162461bcd60e51b8152600401610a6390612e9a565b60085460405163e98030c760e01b8152600481018390526001600160a01b039091169063e98030c790602401610b81565b600854604051635183d6fd60e01b81526004810183905260009182918291829182918291829182916001600160a01b0390911690635183d6fd906024016114b7565b6005546001600160a01b031633146118de5760405162461bcd60e51b8152600401610a6390612e9a565b6001600160a01b0381166119435760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a63565b610e0081611f82565b3b151590565b6000610c5b8284612f84565b6000610c5b8284612f9c565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116611a025760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610a63565b919050565b6001600160a01b038316611a695760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a63565b6001600160a01b038216611aca5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a63565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611b515760405162461bcd60e51b8152600401610a6390612ecf565b6001600160a01b038216611b775760405162461bcd60e51b8152600401610a6390612e57565b80611b8d57611b8883836000611fd4565b505050565b30600090815260208190526040902054600a5481108015908190611bbb5750600754600160a01b900460ff16155b8015611be057506001600160a01b03851660009081526012602052604090205460ff16155b8015611bfa57506005546001600160a01b03868116911614155b8015611c1457506005546001600160a01b03858116911614155b8015611c2257506000600e54115b15611cd2576007805460ff60a01b1916600160a01b179055600d5415611c72576000611c65600e54611c5f600d548661212190919063ffffffff16565b9061195e565b9050611c708161212d565b505b600c5415611ca4576000611c97600e54611c5f600c548661212190919063ffffffff16565b9050611ca28161225c565b505b306000908152602081905260409020548015611cc357611cc3816122e3565b506007805460ff60a01b191690555b6007546001600160a01b03861660009081526011602052604090205460ff600160a01b909204821615911680611d2057506001600160a01b03851660009081526011602052604090205460ff165b15611d29575060005b808015611d3857506000600e54115b15611d74576000611d596064611c5f600e548861212190919063ffffffff16565b9050611d658582612430565b9450611d72873083611fd4565b505b611d7f868686611fd4565b6008546001600160a01b031663e30443bc87611db0816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015611df657600080fd5b505af1925050508015611e07575060015b506008546001600160a01b031663e30443bc86611e39816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015611e7f57600080fd5b505af1925050508015611e90575060015b50600754600160a01b900460ff16611f7a576010546008546040516001624d3b8760e01b03198152600481018390526001600160a01b039091169063ffb2c47990602401606060405180830381600087803b158015611eee57600080fd5b505af1925050508015611f1e575060408051601f3d908101601f19168201909252611f1b91810190612d8d565b60015b611f2757611f78565b60408051848152602081018490529081018290526060810185905232906001907fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a989060800160405180910390a35050505b505b505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038316611ffa5760405162461bcd60e51b8152600401610a6390612ecf565b6001600160a01b0382166120205760405162461bcd60e51b8152600401610a6390612e57565b6001600160a01b038316600090815260208190526040902054818110156120985760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610a63565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906120cf908490612f84565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111ab91815260200190565b50505050565b6000610c5b8284612fbc565b6009546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561217157600080fd5b505afa158015612185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121a99190612d75565b90506121b48261243c565b6009546040516370a0823160e01b815230600482015260009161223c9184916001600160a01b0316906370a082319060240160206040518083038186803b1580156121fe57600080fd5b505afa158015612212573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122369190612d75565b90612430565b600f54600954919250611b88916001600160a01b039081169116836125fa565b600061226982600261195e565b905060006122778383612430565b9050476122838361264c565b600061228f4783612430565b905061229b838261279b565b60408051858152602081018390529081018490527f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619060600160405180910390a15050505050565b6122ec8161243c565b6009546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561233057600080fd5b505afa158015612344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123689190612d75565b60095460085491925060009161238b916001600160a01b03908116911684612855565b90508015611b885760085460405163ba72a95560e01b8152600481018490526001600160a01b039091169063ba72a95590602401600060405180830381600087803b1580156123d957600080fd5b505af11580156123ed573d6000803e3d6000fd5b505060408051868152602081018690527f80195cc573b02cc48460cbca6e6e4cc85ddb91959d946e1c3025ea3d87942dc3935001905060405180910390a1505050565b6000610c5b8284612fdb565b6040805160038082526080820190925260009160208201606080368337019050509050308160008151811061248157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156124d557600080fd5b505afa1580156124e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250d9190612ba5565b8160018151811061252e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260095482519116908290600290811061256d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526006546125939130911684611a07565b600654604051635c11d79560e01b81526001600160a01b0390911690635c11d795906125cc908590600090869030904290600401612f14565b600060405180830381600087803b1580156125e657600080fd5b505af1158015611f7a573d6000803e3d6000fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611b8890849061293f565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061268f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156126e357600080fd5b505afa1580156126f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271b9190612ba5565b8160018151811061273c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526006546127629130911684611a07565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac947906125cc908590600090869030904290600401612f14565b6006546127b39030906001600160a01b031684611a07565b60065460405163f305d71960e01b815230600482015260248101849052600060448201819052606482015261dead60848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561281c57600080fd5b505af1158015612830573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610baf9190612d8d565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009283928392918816916128b39190612dba565b6000604051808303816000865af19150503d80600081146128f0576040519150601f19603f3d011682016040523d82523d6000602084013e6128f5565b606091505b509150915081801561291f57508051158061291f57508080602001905181019061291f9190612d3d565b801561293557506000866001600160a01b03163b115b9695505050505050565b6000612994826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a119092919063ffffffff16565b805190915015611b8857808060200190518101906129b29190612d3d565b611b885760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a63565b6060612a208484600085612a28565b949350505050565b606082471015612a895760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a63565b843b612ad75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a63565b600080866001600160a01b03168587604051612af39190612dba565b60006040518083038185875af1925050503d8060008114612b30576040519150601f19603f3d011682016040523d82523d6000602084013e612b35565b606091505b5091509150612b45828286612b50565b979650505050505050565b60608315612b5f575081610c5b565b825115612b6f5782518084602001fd5b8160405162461bcd60e51b8152600401610a639190612e24565b600060208284031215612b9a578081fd5b8135610c5b8161308a565b600060208284031215612bb6578081fd5b8151610c5b8161308a565b60008060408385031215612bd3578081fd5b8235612bde8161308a565b91506020830135612bee8161308a565b809150509250929050565b600080600060608486031215612c0d578081fd5b8335612c188161308a565b92506020840135612c288161308a565b929592945050506040919091013590565b600080600080600080600080610100898b031215612c55578384fd5b8851612c608161308a565b809850506020890151965060408901519550606089015194506080890151935060a0890151925060c0890151915060e089015190509295985092959890939650565b60008060408385031215612cb4578182fd5b8235612cbf8161308a565b946020939093013593505050565b60008060208385031215612cdf578182fd5b823567ffffffffffffffff80821115612cf6578384fd5b818501915085601f830112612d09578384fd5b813581811115612d17578485fd5b8660208260051b8501011115612d2b578485fd5b60209290920196919550909350505050565b600060208284031215612d4e578081fd5b81518015158114610c5b578182fd5b600060208284031215612d6e578081fd5b5035919050565b600060208284031215612d86578081fd5b5051919050565b600080600060608486031215612da1578283fd5b8351925060208401519150604084015190509250925092565b60008251612dcc818460208701612ff2565b9190910192915050565b60208082528181018390526000908460408401835b86811015612e19578235612dfe8161308a565b6001600160a01b031682529183019190830190600101612deb565b509695505050505050565b6020815260008251806020840152612e43816040850160208701612ff2565b601f01601f19169190910160400192915050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015612f635784516001600160a01b031683529383019391830191600101612f3e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612f9757612f97613074565b500190565b600082612fb757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615612fd657612fd6613074565b500290565b600082821015612fed57612fed613074565b500390565b60005b8381101561300d578181015183820152602001612ff5565b8381111561211b5750506000910152565b600181811c9082168061303257607f821691505b6020821081141561305357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561306d5761306d613074565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610e0057600080fdfea2646970667358221220318360b040886b3e05fd3ff12e50d7e402973bf3fe56a73b04cb78503e7c818564736f6c63430008040033