MrPeachesSale

Claim Peaches

function claimPeaches() external {
require(liquidityGeneratedAt != 0, 'Liquidity not generated');
uint tokens = tokenBalances[msg.sender];
require(tokens > 0 , "Nothing to claim");
stableCoinContributed[msg.sender] = 0;
tokenBalances[msg.sender] = 0;
peaches.safeTransfer(msg.sender, tokens);
emit PeachesClaimed(msg.sender, tokens);
}

Liquidity Generation

function generateLiquidity() external {
require(publicSaleClosedAt != 0, 'Public sale open');
require(liquidityGeneratedAt == 0, 'Liquidity generated');
require(block.timestamp > publicSaleClosedAt.add(30 minutes), 'Too early');
uint stableCoinBalance = stableCoin.balanceOf(address(this));
require(stableCoinBalance > 0, 'Stablecoin balance is zero');
stableCoin.safeApprove(address(uniswapRouter), stableCoinBalance);
uint amountPeaches = stableCoinBalance.mul(multiplier).div(uniswapRate);
peaches.safeApprove(address(uniswapRouter), amountPeaches);
(uint amountA, uint amountB, uint liquidity) = uniswapRouter.addLiquidity(
address(peaches),
address(stableCoin),
amountPeaches,
stableCoinBalance,
amountPeaches.sub(amountPeaches / 10),
stableCoinBalance.sub(stableCoinBalance / 10),
address(this),
block.timestamp.add(2 hours)
);
liquidityGeneratedAt = block.timestamp;
emit LiquidityGenerated(amountA, amountB, liquidity);
}

Emergency Withdraw

function emergencyWithdrawCoins() external {
require(publicSaleClosedAt != 0, 'Public sale open');
require(liquidityGeneratedAt == 0, 'Liquidity generated');
require(block.timestamp > publicSaleClosedAt.add(30 minutes).add(3 days), 'Too early');
uint contributedAmount = stableCoinContributed[msg.sender];
require(contributedAmount > 0, 'Nothing to withdraw');
tokenBalances[msg.sender] = 0;
stableCoinContributed[msg.sender] = 0;
stableCoin.safeTransfer(msg.sender, contributedAmount);
emit EmergencyWithdrawn(msg.sender, contributedAmount);
}
This software is experimental please use at your own risk.