Ethereum (ETH) token sale contract (ERC-20)
with referral program, start, end and tokens claim time settings
(administrable)
This is a customizable token sale contract with adjustable parameters. As many parameters can be changed it can be used for selling your token several times (e.g. several stages of token sale).
Contract is selling tokens in exchange of ETH, ETH is sent to your wallet (beneficiary wallet) instantly.
Buyers can purchase tokens by sending ETH to contract address or using user interface (you will be able to download a simple draft UI with main functions and QR code after creating a token sale contract).
Contract correctly processes change and decimals and automatically stops selling tokens once hardcap is filled or token sale time expires.
Tokens are locked in the contract and can be manually claimed by buyers when claim time arrives or hardcap is reached (adjustable).
You can change any settings in the admin panel: rate, hardcap, dates, tokens claim conditions and time, referral percent, purchase limit, stop/resume sale, change owner and beneficiary, throw selected admin functions.
When the token sale ends (hardcap is reached or time expires) contract sends all unsold tokens to your wallet. If any ETH balance remains on the contract (though it should not) it is also automatically sent to your wallet.
You can use it with any (ERC-20) token.
Referral commission (if it is > 0) is sent to referrer's wallet instantly, if referrer is not a buyer.
Once you have created token sale contract you need to send enough tokens to the contract (you will be able to withdraw unsold tokens any time).
Create token sale contract
Token address
Contract address of the token that you want to sell
[show my tokens]
Rate
1 ETH = tokens How many tokens buyer gets for 1 ETH (you will be able to change it in the admin panel).
Hard cap
ETH Amount (ETH) that you want to raise. After raising this amount contract will stop selling tokens.
Can be changed in admin panel.
Max. contribution
ETH Maximum amount a user can invest. This is a purchase limit for each wallet address, a user (wallet address) can not contribute more than this limit totally during the token sale.
Can be changed in admin panel.
Start time
Your local time when your token sale will begin. Before this time contract will not sell tokens.
Can be changed in admin panel.
End time
Your local time when your token sale will end. After this time contract will not sell tokens.
Can be changed in admin panel.
Unlock time
After this time buyers will be able to claim their tokens. Can be changed in admin panel.
Allow buyers to claim their tokens if hardcap is filled before token sale end time.
Can be changed in admin panel.
Referral commission
%
Commission to be paid from each referred token purchase. Paid instantly to referrer's wallet.
Can be changed in admin panel. If set to 0 referral program is off.
Beneficiary
Address where funds from token sale will be sent to. ETH are sent instantly to this wallet, they are not kept in the contract. By default this is your address. You will be able to change it later in the admin panel.
Only tokens created on this platform are shown here but you can use any valid (ERC-20) token
If you can't see your token here please input its contract address manually
Address
Name
Symbol
Choose
×
Token sale contract
Token info
Token contract address:
Name (symbol): ()
Decimals:
Total supply:
Token sale contract
Rate
1 ETH =
1 token ~ ETH
Set new rate: / ETH
Hard cap
ETH
~
Set new hardcap: ETH
Start time
Before this time token sale contract will not sell tokens
Change:
End time
After this time token sale contract will not sell tokens
Change:
Duration
Purchase limit
ETH
Maximum amount that can be contributed from one wallet totally during the token sale
Set new limit: ETH
Tokens unlock time
Tokens can be locked inside of token sale contract so that investors can claim them when certain time comes
Change time:
Hours to lock after hardcap is reached:
Referral commission
%
Referral commission is paid from each referred purchase instantly to referrer's wallet.
If you don't want to use referral program set referral percent to 0.
Change percent: %
Token sale status
Add tokens to contract:
Raised: of ETH
Sold: of
To raise: ETH
To sell:
Paid to referrers: ETH
Tokens on sale contract balance:
Admin privileges
Once you renounce a privilege you will not have admin access to this function any more, it's value will be fixed forever
Other functions
When the token sale finishes unsold tokens and any accidentally occuring balance are automatically sent from the contract to beneficiary wallet.
For any other situations these functions can be used.
Tokens that can be withdrawn:
ETH on the balance: ETH
Owner
Owner is the contract admin. Only owner has access to contract settings.
New owner:
Beneficiary
Beneficiary is the wallet address where raised funds are sent.
It may be owner's wallet or a different wallet. Beneficiary does not have admin access to the contract.
New beneficiary:
Token sale UI
You can download front-end HTML file and edit the file after downloading, or order some design on top of it.
Please keep the scripts, IDs and classes otherwise some important functions may not work properly.
Just upload index.html file to your website - and your very own token sale is live!
<div style="text-align: center">
<h1>Token info</h1>
<h2><span id="tokenName"></span> (<span class="tokenSymbol"></span>)</h2>
<p><a target="_blank" href="" id="tokenAddress"></a></p>
<!-- Reserved in case you want to show decimals and total supply: Decimals <span id="#tokenDecimals"></span> Total supply <span id="#tokenSupply"></span>-->
<p><button id="addToken" style="text-align: center">Add to Metamask</button> <button id="copyToken" style="text-align: center">Copy address</button></p>
</div>
<hr>
<div style="text-align: center">
<h1>Token sale status</h1>
<h1>
<span id="finished" style="display:none" class="status green">Finished</span>
<span id="unlocked" style="display:none" class="status green"><br>Claim unlocked</span>
<span id="locked" style="display:none" class="status err"><br>Claim locked</span>
<span id="addtokens" style="display:none" class="status err"><br>Ask token sale admin to add tokens to the sale contract!</span>
<span id="active" style="display:none" class="status green">Active</span>
<span id="paused" style="display:none" class="status err">Paused</span>
<span id="upcoming" style="display:none" class="status blue">Upcoming</span>
<span id="upcomingtimer" style="display:none" class="status blue"><br>begins in <span id="starttimer"></span></span>
<span id="activetimer" style="display:none" class="status green"><br>ends in <span id="endtimer"></span></span>
</h1>
<p><progress id="progress" value="0" max="100" style="width: 70%"></progress></p>
<p>Raised: <span id="raised"></span> of <span class="hardcap"></span> ETH</p>
<p>Tokens sold: <span id="sold"></span> of <span class="saleqty"></span> <span class="tokenSymbol"></span></p>
<p>Remaining: <span id="toraise"></span> ETH (~ <span id="unsold"></span> <span class="tokenSymbol"></span>)</p>
</div>
<hr>
<div style="text-align: center">
<h1>Buy tokens</h1>
<p>1 ETH = <span class="rate"></span> <span class="tokenSymbol"></span></p>
<p><input type="number" id="buyAmount" value="0" min="0"> ETH</p>
<p>You get: <span id="get">0</span> <span class="tokenSymbol"></span></p>
<p><button id="buyBtn" style="text-align: center">Buy</button></p>
<p>You have contributed <span id="mySpendings">?</span> of <span class="max">?</span> ETH maximum purchase limit,
can spend max. <span id="myRemaining">?</span> ETH more</p>
</div>
<hr>
<div style="text-align: center">
<h1>Token sale information</h1>
<p>Hardcap: <span class="hardcap"></span> ETH (~ <span class="saleqty"></span> <span class="tokenSymbol"></span>)</p>
<p>Rate: 1 ETH = <span class="rate"></span> <span class="tokenSymbol"></span> (~ <span class="price"></span> ETH/<span class="tokenSymbol"></span>)</p>
<p>Purchase limit: <span class="max"></span></p>
<p>Start: <span id="start"></span></p>
<p>End: <span id="end"></span></p>
<p>Duration: <span id="duration"></span></p>
<p>Tokens claim: <span id="claimtime"></span>
<span id="canhcdelay" style="display:none" class="claimstatus">Can be claimed after hardcap is reached + <span id="canhcdelayh"></span></span>
<span id="canhc" style="display:none" class="claimstatus">Can be claimed immediately after hardcap is reached</span>
<span id="cannothc" style="display:none" class="claimstatus">Can be claimed only when unlock time comes</span>
</p>
</div>
<hr>
<div style="text-align: center">
<h1>My tokens</h1>
<p>In my wallet: <span id="myTokens"></span></p>
<p>Unclaimed: <span id="myUnclaimed"></span></p>
<div id="claimstatus">
<span id="claimok" style="display:none" class="claimstatus green">Tokens are unlocked and can be claimed</span>
<span id="claimnotok" style="display:none" class="claimstatus err">Tokens are locked</span>
</div>
<p><button id="claim">Claim my tokens</button></p>
</div>
<hr>
<div style="text-align: center">
<h1>Sale contract</h1>
<p>You can also buy tokens by sending ETH directly from your wallet to this contract<br>
(please increase gas limit to 200,000 or even more for tokens with special functions like autoLP, swaps, etc.)</p>
<p><a href="" target="_blank" id="saleAddress"></a> <button id="copySale" style="text-align: center">Copy address</button></p>
<div style="text-align: center" id="saleqr"></div>
</div>
<hr>
<div id="refarea" style="text-align: center">
<h1>Referral program</h1>
<p>Share your referral link and get paid instantly to your wallet for every referred token purchase.</p>
<p>Total paid to referrers: <span id="refTotal"></span> ETH</p>
<p>Referral commission: <span id="refPercent">10</span>%</p>
<p>Your referral earnings: <span id="refMy"></span> ETH</p>
<p>Share your referral link or QR code and get commission for referred token purchases instantly to your wallet.</p>
<p><input type="text" id="referLink" size="70" readonly="true"> <button id="copyreflink">Copy link</button></p>
<div id="refqrcode">
<div style="text-align: center" id="refqr"></div>
</div>
<p id="refErr" class="err" style="display: none">Please connect your wallet on Ethereum to generate your referral link!</p>
</div>
Your token sale contract can also work without UI.
Buyers can send ETH to contract and get tokens in return instantly.
Recommended gas limit for correct contract execution 200,000 or more for normal tokens, special tokens with auto-LP, swap, taxes etc. may require gas limit over 1,000,000. Inform token buyers about this!