Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- GDCrowdsale
- Optimization enabled
- true
- Compiler version
- v0.8.18+commit.87f61d96
- Optimization runs
- 1000000
- EVM Version
- default
- Verified at
- 2025-03-12T16:51:52.105522Z
Constructor Arguments
0x000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd0000000000000000000000008687d85e907657107323b4b3ad2b814b9647bc820000000000000000000000000000000000000000000000000000000000084b70
Arg [0] (address) : 0xabccefb00528c9c792ac7c46997f0f6ee5dcdddd
Arg [1] (address) : 0x8687d85e907657107323b4b3ad2b814b9647bc82
Arg [2] (uint256) : 543600
contracts/factory/GDCrowdsale.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
error InvalidAddress();
error InvalidAmount();
error InvalidState();
error AlreadyParticipated();
error InsufficientBalance();
error CrowdsaleNotEnded();
error CrowdsaleEnded();
error AlreadyDistributed();
error InvalidDuration();
/**
* @title GD Token Crowdsale Contract
* @dev Improved implementation of the GD token crowdsale
*/
contract GDCrowdsale is ReentrancyGuard, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using SafeERC20 for ERC20Burnable;
struct PurchaseInfo {
uint256 purchaseTime;
uint256 ethAmount;
uint256 tokenAmount;
uint256 price;
}
enum CrowdsaleState { Active, Paused, Ended }
// Immutable state variables
ERC20Burnable public immutable saleToken;
address payable public immutable fundingWallet;
uint256 public immutable startTime;
// State variables
uint256 public totalRaised;
uint256 public totalTokensSold;
CrowdsaleState public state;
uint256 public initialDuration; // Initial crowdsale duration
uint256 public extraDuration; // Additional duration for extension
// Constants
uint256 public constant MIN_PURCHASE_AMOUNT = 0.01 ether;
uint256 public constant MAX_PURCHASE_AMOUNT = 1 ether;
uint256 public constant INITIAL_PRICE_PER_UNIT = 0.01 ether; // 1M tokens = 0.01 ETH
uint256 public constant FINAL_PRICE_PER_UNIT = 0.012 ether; // 1M tokens = 0.012 ETH
// Storage
mapping(address => PurchaseInfo) public purchases;
address[] public purchasers;
// Events
event TokensPurchased(
address indexed purchaser,
uint256 ethAmount,
uint256 tokenAmount,
uint256 price,
uint256 time
);
event UnallocatedTokensDistributed(
address indexed burnAddress,
address indexed liquidityAddress,
uint256 burnAmount,
uint256 liquidityAmount,
uint256 time
);
event CrowdsaleStateChanged(
CrowdsaleState indexed previousState,
CrowdsaleState indexed newState,
uint256 time
);
event TokensWithdrawn(
address indexed token,
address indexed to,
uint256 amount,
uint256 time
);
event EthWithdrawn(
address indexed to,
uint256 amount,
uint256 time
);
event CrowdsaleDurationUpdated(
uint256 oldDuration,
uint256 newDuration,
uint256 time
);
uint256 public baseTokenAmount; // Amount of tokens per unit (1M tokens)
constructor(
ERC20Burnable _saleToken,
address payable _fundingWallet,
uint256 _initialDuration
) {
if (address(_saleToken) == address(0) || _fundingWallet == address(0))
revert InvalidAddress();
if (_initialDuration == 0) revert InvalidDuration();
saleToken = _saleToken;
fundingWallet = _fundingWallet;
startTime = block.timestamp;
initialDuration = _initialDuration; // Set initial duration
extraDuration = 0; // Initialize extra duration
state = CrowdsaleState.Active;
uint8 decimals = IERC20Metadata(address(_saleToken)).decimals();
baseTokenAmount = 1000000 * 10**decimals; // 1M tokens as base unit
}
modifier onlyWhileOpen() {
if (state != CrowdsaleState.Active) revert InvalidState();
if (block.timestamp >= startTime + initialDuration + extraDuration) revert CrowdsaleEnded();
_;
}
modifier validatePurchase(uint256 amount) {
if (purchases[msg.sender].purchaseTime != 0) revert AlreadyParticipated();
if (amount < MIN_PURCHASE_AMOUNT || amount > MAX_PURCHASE_AMOUNT)
revert InvalidAmount();
_;
}
/**
* @dev Update crowdsale duration
* @param _extraDuration Additional duration in seconds
*/
function updateCrowdsaleDuration(uint256 _extraDuration) external onlyOwner {
if (state == CrowdsaleState.Ended) revert CrowdsaleEnded();
uint256 oldDuration = initialDuration + extraDuration;
extraDuration = _extraDuration;
emit CrowdsaleDurationUpdated(oldDuration, initialDuration + extraDuration, block.timestamp);
}
/**
* @dev Get current token rate
* @return Current rate for 1M tokens
*/
function getCurrentPrice() public view returns (uint256) {
if (block.timestamp >= startTime + initialDuration) {
return FINAL_PRICE_PER_UNIT;
}
uint256 elapsed = block.timestamp - startTime;
uint256 priceIncrease = FINAL_PRICE_PER_UNIT.sub(INITIAL_PRICE_PER_UNIT)
.mul(elapsed)
.div(initialDuration);
return Math.min(
INITIAL_PRICE_PER_UNIT.add(priceIncrease),
FINAL_PRICE_PER_UNIT
);
}
/**
* @dev Calculate token amount for given ETH
* @param ethAmount Amount of ETH
* @return Token amount
*/
function calculateTokenAmount(uint256 ethAmount) public view returns (uint256) {
return ethAmount.mul(baseTokenAmount).div(getCurrentPrice());
}
/**
* @dev contribute with ETH
*/
function contribute() public payable
nonReentrant
onlyWhileOpen
validatePurchase(msg.value)
{
uint256 currentPrice = getCurrentPrice();
uint256 tokenAmount = calculateTokenAmount(msg.value);
if (saleToken.balanceOf(address(this)) < tokenAmount)
revert InsufficientBalance();
// Record purchase
purchases[msg.sender] = PurchaseInfo({
purchaseTime: block.timestamp,
ethAmount: msg.value,
tokenAmount: tokenAmount,
price: currentPrice
});
purchasers.push(msg.sender);
totalRaised = totalRaised.add(msg.value);
totalTokensSold = totalTokensSold.add(tokenAmount);
// Transfer tokens and ETH
saleToken.safeTransfer(msg.sender, tokenAmount);
(bool success, ) = fundingWallet.call{value: msg.value}("");
require(success, "ETH transfer failed");
emit TokensPurchased(
msg.sender,
msg.value,
tokenAmount,
currentPrice,
block.timestamp
);
}
/**
* @dev Distribute remaining tokens
* @param liquidityMiningAddress Address for liquidity mining
*/
function distributeUnallocatedTokens(
address liquidityMiningAddress
) external onlyOwner {
if (block.timestamp < startTime + initialDuration + extraDuration)
revert CrowdsaleNotEnded();
if (state == CrowdsaleState.Ended)
revert AlreadyDistributed();
if (liquidityMiningAddress == address(0))
revert InvalidAddress();
uint256 remaining = saleToken.balanceOf(address(this));
if (remaining == 0) revert InsufficientBalance();
uint256 halfAmount = remaining.div(2);
// Distribute tokens
saleToken.burn(halfAmount);
saleToken.safeTransfer(liquidityMiningAddress, halfAmount);
state = CrowdsaleState.Ended;
emit UnallocatedTokensDistributed(
address(0),
liquidityMiningAddress,
halfAmount,
halfAmount,
block.timestamp
);
}
/**
* @dev Set crowdsale state
* @param _state New state
*/
function setCrowdsaleState(CrowdsaleState _state) external onlyOwner {
if (_state == CrowdsaleState.Ended || state == CrowdsaleState.Ended)
revert InvalidState();
CrowdsaleState previousState = state;
state = _state;
emit CrowdsaleStateChanged(previousState, _state, block.timestamp);
}
/**
* @dev Emergency withdraw any token
* @param _token Token address
* @param _to Recipient address
*/
function emergencyWithdrawTokens(
IERC20 _token,
address _to
) external onlyOwner {
if (_to == address(0)) revert InvalidAddress();
uint256 balance = _token.balanceOf(address(this));
if (balance == 0) revert InsufficientBalance();
_token.safeTransfer(_to, balance);
emit TokensWithdrawn(
address(_token),
_to,
balance,
block.timestamp
);
}
/**
* @dev Get crowdsale status
*/
function getCrowdsaleStatus() external view returns (
uint256 currentPrice,
uint256 remainingTime,
uint256 totalParticipants,
uint256 raisedAmount,
uint256 remainingTokens,
CrowdsaleState currentState
) {
uint256 _remainingTime = 0;
uint256 totalDuration = initialDuration.add(extraDuration);
if (block.timestamp < startTime + totalDuration) {
_remainingTime = startTime.add(totalDuration).sub(block.timestamp);
}
return (
getCurrentPrice(),
_remainingTime,
purchasers.length,
totalRaised,
saleToken.balanceOf(address(this)),
state
);
}
/**
* @dev Get purchasers with pagination
*/
function getPurchasersPaginated(uint256 offset, uint256 limit)
external
view
returns (
address[] memory _purchasers,
uint256 total
)
{
uint256 end = offset + limit;
if (end > purchasers.length) {
end = purchasers.length;
}
address[] memory result = new address[](end - offset);
for (uint256 i = offset; i < end; i++) {
result[i - offset] = purchasers[i];
}
return (result, purchasers.length);
}
/**
* @dev Get purchase info for multiple addresses
*/
function getPurchaseInfoBatch(address[] calldata _purchasers)
external
view
returns (PurchaseInfo[] memory)
{
PurchaseInfo[] memory result = new PurchaseInfo[](_purchasers.length);
for (uint256 i = 0; i < _purchasers.length; i++) {
result[i] = purchases[_purchasers[i]];
}
return result;
}
/**
* @dev Get crowdsale statistics
* @return ethRaised Total ETH raised in crowdsale
* @return tokensSold Total tokens sold in crowdsale
* @return participantsCount Total number of unique participants
*/
function getCrowdsaleStats() public view returns (
uint256 ethRaised,
uint256 tokensSold,
uint256 participantsCount
) {
return (totalRaised, totalTokensSold, purchasers.length);
}
receive() external payable {
if(msg.value > 0) {
contribute();
}
}
}
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../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);
}
}
@openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
@openzeppelin/contracts/token/ERC20/ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../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 {}
}
@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);
}
@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC20.sol";
import "../../../utils/Context.sol";
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
unchecked {
_approve(account, _msgSender(), currentAllowance - amount);
}
_burn(account, amount);
}
}
@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../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);
}
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../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");
}
}
}
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
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);
}
}
}
}
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
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;
}
}
@openzeppelin/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a / b + (a % b == 0 ? 0 : 1);
}
}
@openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT
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;
}
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":1000000,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_saleToken","internalType":"contract ERC20Burnable"},{"type":"address","name":"_fundingWallet","internalType":"address payable"},{"type":"uint256","name":"_initialDuration","internalType":"uint256"}]},{"type":"error","name":"AlreadyDistributed","inputs":[]},{"type":"error","name":"AlreadyParticipated","inputs":[]},{"type":"error","name":"CrowdsaleEnded","inputs":[]},{"type":"error","name":"CrowdsaleNotEnded","inputs":[]},{"type":"error","name":"InsufficientBalance","inputs":[]},{"type":"error","name":"InvalidAddress","inputs":[]},{"type":"error","name":"InvalidAmount","inputs":[]},{"type":"error","name":"InvalidDuration","inputs":[]},{"type":"error","name":"InvalidState","inputs":[]},{"type":"event","name":"CrowdsaleDurationUpdated","inputs":[{"type":"uint256","name":"oldDuration","internalType":"uint256","indexed":false},{"type":"uint256","name":"newDuration","internalType":"uint256","indexed":false},{"type":"uint256","name":"time","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CrowdsaleStateChanged","inputs":[{"type":"uint8","name":"previousState","internalType":"enum GDCrowdsale.CrowdsaleState","indexed":true},{"type":"uint8","name":"newState","internalType":"enum GDCrowdsale.CrowdsaleState","indexed":true},{"type":"uint256","name":"time","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EthWithdrawn","inputs":[{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"time","internalType":"uint256","indexed":false}],"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":"TokensPurchased","inputs":[{"type":"address","name":"purchaser","internalType":"address","indexed":true},{"type":"uint256","name":"ethAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"tokenAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"price","internalType":"uint256","indexed":false},{"type":"uint256","name":"time","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TokensWithdrawn","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"time","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UnallocatedTokensDistributed","inputs":[{"type":"address","name":"burnAddress","internalType":"address","indexed":true},{"type":"address","name":"liquidityAddress","internalType":"address","indexed":true},{"type":"uint256","name":"burnAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"liquidityAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"time","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"FINAL_PRICE_PER_UNIT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"INITIAL_PRICE_PER_UNIT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_PURCHASE_AMOUNT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MIN_PURCHASE_AMOUNT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"baseTokenAmount","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculateTokenAmount","inputs":[{"type":"uint256","name":"ethAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"contribute","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"distributeUnallocatedTokens","inputs":[{"type":"address","name":"liquidityMiningAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdrawTokens","inputs":[{"type":"address","name":"_token","internalType":"contract IERC20"},{"type":"address","name":"_to","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"extraDuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"fundingWallet","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"ethRaised","internalType":"uint256"},{"type":"uint256","name":"tokensSold","internalType":"uint256"},{"type":"uint256","name":"participantsCount","internalType":"uint256"}],"name":"getCrowdsaleStats","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"currentPrice","internalType":"uint256"},{"type":"uint256","name":"remainingTime","internalType":"uint256"},{"type":"uint256","name":"totalParticipants","internalType":"uint256"},{"type":"uint256","name":"raisedAmount","internalType":"uint256"},{"type":"uint256","name":"remainingTokens","internalType":"uint256"},{"type":"uint8","name":"currentState","internalType":"enum GDCrowdsale.CrowdsaleState"}],"name":"getCrowdsaleStatus","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple[]","name":"","internalType":"struct GDCrowdsale.PurchaseInfo[]","components":[{"type":"uint256","name":"purchaseTime","internalType":"uint256"},{"type":"uint256","name":"ethAmount","internalType":"uint256"},{"type":"uint256","name":"tokenAmount","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"}]}],"name":"getPurchaseInfoBatch","inputs":[{"type":"address[]","name":"_purchasers","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"_purchasers","internalType":"address[]"},{"type":"uint256","name":"total","internalType":"uint256"}],"name":"getPurchasersPaginated","inputs":[{"type":"uint256","name":"offset","internalType":"uint256"},{"type":"uint256","name":"limit","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"initialDuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"purchasers","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"purchaseTime","internalType":"uint256"},{"type":"uint256","name":"ethAmount","internalType":"uint256"},{"type":"uint256","name":"tokenAmount","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"}],"name":"purchases","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ERC20Burnable"}],"name":"saleToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCrowdsaleState","inputs":[{"type":"uint8","name":"_state","internalType":"enum GDCrowdsale.CrowdsaleState"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"enum GDCrowdsale.CrowdsaleState"}],"name":"state","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalRaised","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalTokensSold","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCrowdsaleDuration","inputs":[{"type":"uint256","name":"_extraDuration","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60e06040523480156200001157600080fd5b50604051620027f8380380620027f88339810160408190526200003491620001d4565b6001600055620000443362000169565b6001600160a01b03831615806200006257506001600160a01b038216155b15620000815760405163e6c4247b60e01b815260040160405180910390fd5b80600003620000a357604051637616640160e01b815260040160405180910390fd5b6001600160a01b03808416608052821660a0524260c0526005819055600060068190556004805460ff191660018302179055506000836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000117573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200013d91906200021c565b90506200014c81600a6200035d565b6200015b90620f42406200036e565b600955506200038892505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0381168114620001d157600080fd5b50565b600080600060608486031215620001ea57600080fd5b8351620001f781620001bb565b60208501519093506200020a81620001bb565b80925050604084015190509250925092565b6000602082840312156200022f57600080fd5b815160ff811681146200024157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200029f57816000190482111562000283576200028362000248565b808516156200029157918102915b93841c939080029062000263565b509250929050565b600082620002b85750600162000357565b81620002c75750600062000357565b8160018114620002e05760028114620002eb576200030b565b600191505062000357565b60ff841115620002ff57620002ff62000248565b50506001821b62000357565b5060208310610133831016604e8410600b841016171562000330575081810a62000357565b6200033c83836200025e565b806000190482111562000353576200035362000248565b0290505b92915050565b60006200024160ff841683620002a7565b808202811582820484141762000357576200035762000248565b60805160a05160c0516123e5620004136000396000818161039f015281816106c301528181610e0f01528181610e4301528181611067015281816118b101526118f301526000818161029e01526109d901526000818161059a01528181610824015281816109ae01528181610eb10152818161119c01528181611297015261132201526123e56000f3fe6080604052600436106101c65760003560e01c80638da5cb5b116100f7578063c19d93fb11610095578063dbfb72ee11610064578063dbfb72ee14610568578063e985e36714610588578063eb91d37e146105bc578063f2fde38b146105d157600080fd5b8063c19d93fb14610508578063c5c4744c1461052f578063d7bb99ba14610545578063db1678761461054d57600080fd5b8063a8d7c20b116100d1578063a8d7c20b1461048e578063aa48b5e5146104a4578063ac2885e9146104c4578063b815a357146104f257600080fd5b80638da5cb5b146104235780638fc516e71461044e578063a24bcf461461046e57600080fd5b80635cad7cfb11610164578063715018a61161013e578063715018a61461037857806378e979251461038d5780637f49f644146102e4578063842a77d3146103c157600080fd5b80635cad7cfb1461031f57806360a09a0d1461034657806363b201171461036257600080fd5b80633c4b40b8116101a05780633c4b40b81461028c5780634781ca76146102c057806354545bfb146102e4578063576bc025146102ff57600080fd5b80630388c128146101e0578063110719ed1461021657806312923b651461024757600080fd5b366101db5734156101d9576101d96105f1565b005b600080fd5b3480156101ec57600080fd5b506102006101fb366004611ef3565b610b13565b60405161020d9190611f68565b60405180910390f35b34801561022257600080fd5b506002546003546008546040805193845260208401929092529082015260600161020d565b34801561025357600080fd5b50610267610262366004611fcc565b610c6c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161020d565b34801561029857600080fd5b506102677f000000000000000000000000000000000000000000000000000000000000000081565b3480156102cc57600080fd5b506102d660065481565b60405190815260200161020d565b3480156102f057600080fd5b506102d6662386f26fc1000081565b34801561030b57600080fd5b506101d961031a366004611fcc565b610ca3565b34801561032b57600080fd5b50610334610de4565b60405161020d9695949392919061204f565b34801561035257600080fd5b506102d6670de0b6b3a764000081565b34801561036e57600080fd5b506102d660035481565b34801561038457600080fd5b506101d9610f4d565b34801561039957600080fd5b506102d67f000000000000000000000000000000000000000000000000000000000000000081565b3480156103cd57600080fd5b506104036103dc3660046120a1565b60076020526000908152604090208054600182015460028301546003909301549192909184565b60408051948552602085019390935291830152606082015260800161020d565b34801561042f57600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff16610267565b34801561045a57600080fd5b506101d96104693660046120a1565b610fda565b34801561047a57600080fd5b506102d6610489366004611fcc565b6113da565b34801561049a57600080fd5b506102d660095481565b3480156104b057600080fd5b506101d96104bf3660046120be565b6113fb565b3480156104d057600080fd5b506104e46104df3660046120df565b61158a565b60405161020d929190612101565b3480156104fe57600080fd5b506102d660055481565b34801561051457600080fd5b506004546105229060ff1681565b60405161020d919061215f565b34801561053b57600080fd5b506102d660025481565b6101d96105f1565b34801561055957600080fd5b506102d6662aa1efb94e000081565b34801561057457600080fd5b506101d961058336600461216d565b61169c565b34801561059457600080fd5b506102677f000000000000000000000000000000000000000000000000000000000000000081565b3480156105c857600080fd5b506102d66118aa565b3480156105dd57600080fd5b506101d96105ec3660046120a1565b611977565b600260005403610662576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600090815560045460ff16600281111561068057610680611fe5565b146106b7576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546005546106e7907f00000000000000000000000000000000000000000000000000000000000000006121d5565b6106f191906121d5565b4210610729576040517fd499d29f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33600090815260076020526040902054349015610772576040517f22ce1a0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b662386f26fc1000081108061078e5750670de0b6b3a764000081115b156107c5576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006107cf6118aa565b905060006107dc346113da565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152909150819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561086b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088f91906121e8565b10156108c7576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051608081018252428152346020808301828152838501868152606085018881523360008181526007909552968420955186559151600180870191909155905160028087019190915591516003909501949094556008805494850181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee390920180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169093179092555461098191611aa7565b6002556003546109919082611aa7565b6003556109d573ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163383611aba565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163460405160006040518083038185875af1925050503d8060008114610a4f576040519150601f19603f3d011682016040523d82523d6000602084013e610a54565b606091505b5050905080610abf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610659565b604080513481526020810184905290810184905242606082015233907f34987d73948b60cfba9beeb35760c345a3be430f3540605113911ead78a0830e9060800160405180910390a2505060016000555050565b606060008267ffffffffffffffff811115610b3057610b30612201565b604051908082528060200260200182016040528015610b8c57816020015b610b796040518060800160405280600081526020016000815260200160008152602001600081525090565b815260200190600190039081610b4e5790505b50905060005b83811015610c625760076000868684818110610bb057610bb0612230565b9050602002016020810190610bc591906120a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020604051806080016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050828281518110610c4457610c44612230565b60200260200101819052508080610c5a9061225f565b915050610b92565b5090505b92915050565b60088181548110610c7c57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60015473ffffffffffffffffffffffffffffffffffffffff163314610d24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b600260045460ff166002811115610d3d57610d3d611fe5565b03610d74576040517fd499d29f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600654600554610d8691906121d5565b9050816006819055507fb6a57a98fb87d8a2ce4f0a0e88314d5db2dd60f4db3c12b1efb07675442036da81600654600554610dc191906121d5565b604080519283526020830191909152429082015260600160405180910390a15050565b600080600080600080600080610e07600654600554611aa790919063ffffffff16565b9050610e33817f00000000000000000000000000000000000000000000000000000000000000006121d5565b421015610e7157610e6e42610e687f000000000000000000000000000000000000000000000000000000000000000084611aa7565b90611b4c565b91505b610e796118aa565b6008546002546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152859291907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610f0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3191906121e8565b600454949d939c50919a509850965060ff909116945092505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b610fd86000611b58565b565b60015473ffffffffffffffffffffffffffffffffffffffff16331461105b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b60065460055461108b907f00000000000000000000000000000000000000000000000000000000000000006121d5565b61109591906121d5565b4210156110ce576040517f09af549600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260045460ff1660028111156110e7576110e7611fe5565b0361111e576040517fcce553a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661116b576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156111f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121c91906121e8565b905080600003611258576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611265826002611bcf565b6040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018290529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906342966c6890602401600060405180830381600087803b1580156112f057600080fd5b505af1158015611304573d6000803e3d6000fd5b5061134b92505073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690508483611aba565b600480547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790556040805182815260208101839052429181019190915273ffffffffffffffffffffffffffffffffffffffff8416906000907f5e9e3288e61ee42a01d4c8dbe06ad262f092567d140c1abeb34ad1443b9f021f906060015b60405180910390a3505050565b6000610c666113e76118aa565b6009546113f5908590611bdb565b90611bcf565b60015473ffffffffffffffffffffffffffffffffffffffff16331461147c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b600281600281111561149057611490611fe5565b14806114b25750600260045460ff1660028111156114b0576114b0611fe5565b145b156114e9576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6004805460ff81169183917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600281111561152a5761152a611fe5565b021790555081600281111561154157611541611fe5565b81600281111561155357611553611fe5565b6040514281527f8b0ede44a5d742d907c9beb8e7abb0f81b08b6f4626a5c357e1fe4515544adb99060200160405180910390a35050565b606060008061159984866121d5565b6008549091508111156115ab57506008545b60006115b78683612297565b67ffffffffffffffff8111156115cf576115cf612201565b6040519080825280602002602001820160405280156115f8578160200160208202803683370190505b509050855b8281101561168c576008818154811061161857611618612230565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16826116458984612297565b8151811061165557611655612230565b73ffffffffffffffffffffffffffffffffffffffff90921660209283029190910190910152806116848161225f565b9150506115fd565b5060085490969095509350505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461171d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b73ffffffffffffffffffffffffffffffffffffffff811661176a576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156117d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117fb91906121e8565b905080600003611837576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61185873ffffffffffffffffffffffffffffffffffffffff84168383611aba565b6040805182815242602082015273ffffffffffffffffffffffffffffffffffffffff80851692908616917f6b83b455c317523498e4e86849438d4356ad79ba6b355a5e6d5bc05eca6c780f91016113cd565b60006005547f00000000000000000000000000000000000000000000000000000000000000006118da91906121d5565b42106118ec5750662aa1efb94e000090565b60006119187f000000000000000000000000000000000000000000000000000000000000000042612297565b9050600061194d6005546113f584611947662386f26fc10000662aa1efb94e0000611b4c90919063ffffffff16565b90611bdb565b9050611970611963662386f26fc1000083611aa7565b662aa1efb94e0000611be7565b9250505090565b60015473ffffffffffffffffffffffffffffffffffffffff1633146119f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b73ffffffffffffffffffffffffffffffffffffffff8116611a9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610659565b611aa481611b58565b50565b6000611ab382846121d5565b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611b47908490611bfd565b505050565b6000611ab38284612297565b6001805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611ab382846122aa565b6000611ab382846122e5565b6000818310611bf65781611ab3565b5090919050565b6000611c5f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611d099092919063ffffffff16565b805190915015611b475780806020019051810190611c7d91906122fc565b611b47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610659565b6060611d188484600085611d20565b949350505050565b606082471015611db2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610659565b843b611e1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610659565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611e439190612342565b60006040518083038185875af1925050503d8060008114611e80576040519150601f19603f3d011682016040523d82523d6000602084013e611e85565b606091505b5091509150611e95828286611ea0565b979650505050505050565b60608315611eaf575081611ab3565b825115611ebf5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610659919061235e565b60008060208385031215611f0657600080fd5b823567ffffffffffffffff80821115611f1e57600080fd5b818501915085601f830112611f3257600080fd5b813581811115611f4157600080fd5b8660208260051b8501011115611f5657600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015611fbf57815180518552868101518786015285810151868601526060908101519085015260809093019290850190600101611f85565b5091979650505050505050565b600060208284031215611fde57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6003811061204b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b600060c082019050878252866020830152856040830152846060830152836080830152611e9560a0830184612014565b73ffffffffffffffffffffffffffffffffffffffff81168114611aa457600080fd5b6000602082840312156120b357600080fd5b8135611ab38161207f565b6000602082840312156120d057600080fd5b813560038110611ab357600080fd5b600080604083850312156120f257600080fd5b50508035926020909101359150565b604080825283519082018190526000906020906060840190828701845b8281101561215057815173ffffffffffffffffffffffffffffffffffffffff168452928401929084019060010161211e565b50505092019290925292915050565b60208101610c668284612014565b6000806040838503121561218057600080fd5b823561218b8161207f565b9150602083013561219b8161207f565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610c6657610c666121a6565b6000602082840312156121fa57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612290576122906121a6565b5060010190565b81810381811115610c6657610c666121a6565b6000826122e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8082028115828204841417610c6657610c666121a6565b60006020828403121561230e57600080fd5b81518015158114611ab357600080fd5b60005b83811015612339578181015183820152602001612321565b50506000910152565b6000825161235481846020870161231e565b9190910192915050565b602081526000825180602084015261237d81604085016020870161231e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212209c8d002f45ed5393f04a7e680128ccd3ff9dd380768fdb78dbf83c3ffe0b9be764736f6c63430008120033000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd0000000000000000000000008687d85e907657107323b4b3ad2b814b9647bc82000000000000000000000000000000000000000000000000000000000007e900
Deployed ByteCode
0x6080604052600436106101c65760003560e01c80638da5cb5b116100f7578063c19d93fb11610095578063dbfb72ee11610064578063dbfb72ee14610568578063e985e36714610588578063eb91d37e146105bc578063f2fde38b146105d157600080fd5b8063c19d93fb14610508578063c5c4744c1461052f578063d7bb99ba14610545578063db1678761461054d57600080fd5b8063a8d7c20b116100d1578063a8d7c20b1461048e578063aa48b5e5146104a4578063ac2885e9146104c4578063b815a357146104f257600080fd5b80638da5cb5b146104235780638fc516e71461044e578063a24bcf461461046e57600080fd5b80635cad7cfb11610164578063715018a61161013e578063715018a61461037857806378e979251461038d5780637f49f644146102e4578063842a77d3146103c157600080fd5b80635cad7cfb1461031f57806360a09a0d1461034657806363b201171461036257600080fd5b80633c4b40b8116101a05780633c4b40b81461028c5780634781ca76146102c057806354545bfb146102e4578063576bc025146102ff57600080fd5b80630388c128146101e0578063110719ed1461021657806312923b651461024757600080fd5b366101db5734156101d9576101d96105f1565b005b600080fd5b3480156101ec57600080fd5b506102006101fb366004611ef3565b610b13565b60405161020d9190611f68565b60405180910390f35b34801561022257600080fd5b506002546003546008546040805193845260208401929092529082015260600161020d565b34801561025357600080fd5b50610267610262366004611fcc565b610c6c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161020d565b34801561029857600080fd5b506102677f0000000000000000000000008687d85e907657107323b4b3ad2b814b9647bc8281565b3480156102cc57600080fd5b506102d660065481565b60405190815260200161020d565b3480156102f057600080fd5b506102d6662386f26fc1000081565b34801561030b57600080fd5b506101d961031a366004611fcc565b610ca3565b34801561032b57600080fd5b50610334610de4565b60405161020d9695949392919061204f565b34801561035257600080fd5b506102d6670de0b6b3a764000081565b34801561036e57600080fd5b506102d660035481565b34801561038457600080fd5b506101d9610f4d565b34801561039957600080fd5b506102d67f0000000000000000000000000000000000000000000000000000000067d25f5181565b3480156103cd57600080fd5b506104036103dc3660046120a1565b60076020526000908152604090208054600182015460028301546003909301549192909184565b60408051948552602085019390935291830152606082015260800161020d565b34801561042f57600080fd5b5060015473ffffffffffffffffffffffffffffffffffffffff16610267565b34801561045a57600080fd5b506101d96104693660046120a1565b610fda565b34801561047a57600080fd5b506102d6610489366004611fcc565b6113da565b34801561049a57600080fd5b506102d660095481565b3480156104b057600080fd5b506101d96104bf3660046120be565b6113fb565b3480156104d057600080fd5b506104e46104df3660046120df565b61158a565b60405161020d929190612101565b3480156104fe57600080fd5b506102d660055481565b34801561051457600080fd5b506004546105229060ff1681565b60405161020d919061215f565b34801561053b57600080fd5b506102d660025481565b6101d96105f1565b34801561055957600080fd5b506102d6662aa1efb94e000081565b34801561057457600080fd5b506101d961058336600461216d565b61169c565b34801561059457600080fd5b506102677f000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd81565b3480156105c857600080fd5b506102d66118aa565b3480156105dd57600080fd5b506101d96105ec3660046120a1565b611977565b600260005403610662576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600090815560045460ff16600281111561068057610680611fe5565b146106b7576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006546005546106e7907f0000000000000000000000000000000000000000000000000000000067d25f516121d5565b6106f191906121d5565b4210610729576040517fd499d29f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33600090815260076020526040902054349015610772576040517f22ce1a0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b662386f26fc1000081108061078e5750670de0b6b3a764000081115b156107c5576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006107cf6118aa565b905060006107dc346113da565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152909150819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd16906370a0823190602401602060405180830381865afa15801561086b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088f91906121e8565b10156108c7576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408051608081018252428152346020808301828152838501868152606085018881523360008181526007909552968420955186559151600180870191909155905160028087019190915591516003909501949094556008805494850181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee390920180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169093179092555461098191611aa7565b6002556003546109919082611aa7565b6003556109d573ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd163383611aba565b60007f0000000000000000000000008687d85e907657107323b4b3ad2b814b9647bc8273ffffffffffffffffffffffffffffffffffffffff163460405160006040518083038185875af1925050503d8060008114610a4f576040519150601f19603f3d011682016040523d82523d6000602084013e610a54565b606091505b5050905080610abf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610659565b604080513481526020810184905290810184905242606082015233907f34987d73948b60cfba9beeb35760c345a3be430f3540605113911ead78a0830e9060800160405180910390a2505060016000555050565b606060008267ffffffffffffffff811115610b3057610b30612201565b604051908082528060200260200182016040528015610b8c57816020015b610b796040518060800160405280600081526020016000815260200160008152602001600081525090565b815260200190600190039081610b4e5790505b50905060005b83811015610c625760076000868684818110610bb057610bb0612230565b9050602002016020810190610bc591906120a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020604051806080016040529081600082015481526020016001820154815260200160028201548152602001600382015481525050828281518110610c4457610c44612230565b60200260200101819052508080610c5a9061225f565b915050610b92565b5090505b92915050565b60088181548110610c7c57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60015473ffffffffffffffffffffffffffffffffffffffff163314610d24576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b600260045460ff166002811115610d3d57610d3d611fe5565b03610d74576040517fd499d29f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600654600554610d8691906121d5565b9050816006819055507fb6a57a98fb87d8a2ce4f0a0e88314d5db2dd60f4db3c12b1efb07675442036da81600654600554610dc191906121d5565b604080519283526020830191909152429082015260600160405180910390a15050565b600080600080600080600080610e07600654600554611aa790919063ffffffff16565b9050610e33817f0000000000000000000000000000000000000000000000000000000067d25f516121d5565b421015610e7157610e6e42610e687f0000000000000000000000000000000000000000000000000000000067d25f5184611aa7565b90611b4c565b91505b610e796118aa565b6008546002546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152859291907f000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd73ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610f0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3191906121e8565b600454949d939c50919a509850965060ff909116945092505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610fce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b610fd86000611b58565b565b60015473ffffffffffffffffffffffffffffffffffffffff16331461105b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b60065460055461108b907f0000000000000000000000000000000000000000000000000000000067d25f516121d5565b61109591906121d5565b4210156110ce576040517f09af549600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260045460ff1660028111156110e7576110e7611fe5565b0361111e576040517fcce553a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811661116b576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd73ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156111f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121c91906121e8565b905080600003611258576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611265826002611bcf565b6040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018290529091507f000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd73ffffffffffffffffffffffffffffffffffffffff16906342966c6890602401600060405180830381600087803b1580156112f057600080fd5b505af1158015611304573d6000803e3d6000fd5b5061134b92505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000abccefb00528c9c792ac7c46997f0f6ee5dcdddd1690508483611aba565b600480547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790556040805182815260208101839052429181019190915273ffffffffffffffffffffffffffffffffffffffff8416906000907f5e9e3288e61ee42a01d4c8dbe06ad262f092567d140c1abeb34ad1443b9f021f906060015b60405180910390a3505050565b6000610c666113e76118aa565b6009546113f5908590611bdb565b90611bcf565b60015473ffffffffffffffffffffffffffffffffffffffff16331461147c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b600281600281111561149057611490611fe5565b14806114b25750600260045460ff1660028111156114b0576114b0611fe5565b145b156114e9576040517fbaf3f0f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6004805460ff81169183917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600281111561152a5761152a611fe5565b021790555081600281111561154157611541611fe5565b81600281111561155357611553611fe5565b6040514281527f8b0ede44a5d742d907c9beb8e7abb0f81b08b6f4626a5c357e1fe4515544adb99060200160405180910390a35050565b606060008061159984866121d5565b6008549091508111156115ab57506008545b60006115b78683612297565b67ffffffffffffffff8111156115cf576115cf612201565b6040519080825280602002602001820160405280156115f8578160200160208202803683370190505b509050855b8281101561168c576008818154811061161857611618612230565b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16826116458984612297565b8151811061165557611655612230565b73ffffffffffffffffffffffffffffffffffffffff90921660209283029190910190910152806116848161225f565b9150506115fd565b5060085490969095509350505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461171d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b73ffffffffffffffffffffffffffffffffffffffff811661176a576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156117d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117fb91906121e8565b905080600003611837576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61185873ffffffffffffffffffffffffffffffffffffffff84168383611aba565b6040805182815242602082015273ffffffffffffffffffffffffffffffffffffffff80851692908616917f6b83b455c317523498e4e86849438d4356ad79ba6b355a5e6d5bc05eca6c780f91016113cd565b60006005547f0000000000000000000000000000000000000000000000000000000067d25f516118da91906121d5565b42106118ec5750662aa1efb94e000090565b60006119187f0000000000000000000000000000000000000000000000000000000067d25f5142612297565b9050600061194d6005546113f584611947662386f26fc10000662aa1efb94e0000611b4c90919063ffffffff16565b90611bdb565b9050611970611963662386f26fc1000083611aa7565b662aa1efb94e0000611be7565b9250505090565b60015473ffffffffffffffffffffffffffffffffffffffff1633146119f8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610659565b73ffffffffffffffffffffffffffffffffffffffff8116611a9b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610659565b611aa481611b58565b50565b6000611ab382846121d5565b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611b47908490611bfd565b505050565b6000611ab38284612297565b6001805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000611ab382846122aa565b6000611ab382846122e5565b6000818310611bf65781611ab3565b5090919050565b6000611c5f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611d099092919063ffffffff16565b805190915015611b475780806020019051810190611c7d91906122fc565b611b47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610659565b6060611d188484600085611d20565b949350505050565b606082471015611db2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610659565b843b611e1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610659565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051611e439190612342565b60006040518083038185875af1925050503d8060008114611e80576040519150601f19603f3d011682016040523d82523d6000602084013e611e85565b606091505b5091509150611e95828286611ea0565b979650505050505050565b60608315611eaf575081611ab3565b825115611ebf5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610659919061235e565b60008060208385031215611f0657600080fd5b823567ffffffffffffffff80821115611f1e57600080fd5b818501915085601f830112611f3257600080fd5b813581811115611f4157600080fd5b8660208260051b8501011115611f5657600080fd5b60209290920196919550909350505050565b602080825282518282018190526000919060409081850190868401855b82811015611fbf57815180518552868101518786015285810151868601526060908101519085015260809093019290850190600101611f85565b5091979650505050505050565b600060208284031215611fde57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6003811061204b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b600060c082019050878252866020830152856040830152846060830152836080830152611e9560a0830184612014565b73ffffffffffffffffffffffffffffffffffffffff81168114611aa457600080fd5b6000602082840312156120b357600080fd5b8135611ab38161207f565b6000602082840312156120d057600080fd5b813560038110611ab357600080fd5b600080604083850312156120f257600080fd5b50508035926020909101359150565b604080825283519082018190526000906020906060840190828701845b8281101561215057815173ffffffffffffffffffffffffffffffffffffffff168452928401929084019060010161211e565b50505092019290925292915050565b60208101610c668284612014565b6000806040838503121561218057600080fd5b823561218b8161207f565b9150602083013561219b8161207f565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610c6657610c666121a6565b6000602082840312156121fa57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612290576122906121a6565b5060010190565b81810381811115610c6657610c666121a6565b6000826122e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b8082028115828204841417610c6657610c666121a6565b60006020828403121561230e57600080fd5b81518015158114611ab357600080fd5b60005b83811015612339578181015183820152602001612321565b50506000910152565b6000825161235481846020870161231e565b9190910192915050565b602081526000825180602084015261237d81604085016020870161231e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea26469706673582212209c8d002f45ed5393f04a7e680128ccd3ff9dd380768fdb78dbf83c3ffe0b9be764736f6c63430008120033