# Rootcore Crowdsale Token Sale In this document, we describe the token sale specification and implementation, and give an overview over the smart contracts structure.
All Bancor smart contracts, except the CrowdSaleController, are unchanged but solidity version is set to 0.4.15 Zeppelin Solidity Pausable contract was added and the Owned inheritance was replaced by Managed.
Rootcore Crowdsale allowes contributing Ether in return for Rootcoin tokens.
The tokens are ERC20 standard.
Prticipating in the sale is open to everybody with a max contribution cap. Contributing more than the account cap requires going through a KYC process. At the end of the process the account is added to the whitelist and the max cap is removed.
Participating in the pre sale requires requires going through a KYC process. At the end of the process the account is added to the whitelist. During pre sale, there's no account max cap.
During the sale period, the tokens are non transferable.
At the end of the sale, the token owner should set as the baneficiary (foundation) account.
After the end of the sale, Rootcore will deploy a Changer contract based on the BancorChanger which will hold a reserve in BNT.
Managed.sol
constructor as msg.sender, the manager can add addresses to white list by calling the addToWhitelist
function, and pause/unPause the sale as a safety measure.During Presale: only white list addresses can contribute. During sale, whitelist accounts are allowed to transfer more than MAX_CONTRIBUTION Any contributor who whishes to either participate in pre-sale, or contibute more than MAX_CONTRIBUTION should go through a KYC process in which they should provide their address to be added to the whitelist.
We use Bancor Protocol code for the most part of this project.
The only contract we changed is the CrowdsaleController.sol
itself which was changed to:
1 - support a Presale for white list accounts only.
2 - Support max contribution cap per account.
3 - Deploy the start token on creation.
4 - Addition of whitelist for MAX_CONTRIBUTION and pre sale address verification.
5 - Addition of Pauseable.sol
for safety during sale.
We use open-zeppling code for Pauseable
logic only but had to change the OwnerOnly modifier to managerOnly for quick pause if anything goes wrong during the sale.
The CrowdsaleController.sol
contract is the main contract of this project. It runs the presale and the actual sale.
Whith any legit contribution, the calculated amount of tokens are immediately assignes the sender (token issue
function is called). The same amount (1:1 ratio) is assigned to the beneficiary account.
Ether collected during the sale is stored at the ether balance of the CrowdsaleController contract and should be sent to the foundation multisig wallet when sale is over.
TODO???: add finalize sale function that will transfer Token ownership to the Bancor Changer once it's up.
computeReturn
function computeReturn(uint256 _contribution)
Computes the number of tokens that should be issued for a given contribution.
addToWhitelist
function addToWhitelist(address _address)
Adds a whitelist address for which there is no max contribution and is allowed to participate in the presale. Can be called by manager only.
removeFromWhitelist
function removeFromWhitelist(address _address)
Disables an existing whitelist address from participating presale. Can be called by manager only.
contributeETH
function contributeETH()
This is the public payable method for contributing ether during the public sale. It is used as a payable fallback function when sending money to the contract.
contributePreSale
function contributePreSale()
This is the public payable method for contributing ether during the presale. (not used as fallback)
contributeFiat
function contributeFiat(address _contributor, uint256 _amount)
This is the public payable method for allocating tokens for Fiat contributions. It can be executed by manager only during both the sale and the presale.
Contribution
event Contribution(address indexed _contributor, uint256 _amount, uint256 _return)
Triggered when a contribution is processed.
First and foremost, a Smart Token is also an ERC-20 compliant token. As such, it implements both the standard token methods and the standard token events.
Note that these methods can only be executed by the token owner.
issue
function issue(address _to, uint256 _amount)
Increases the token supply and sends the new tokens to an account.
destroy
function destroy(address _from, uint256 _amount)
Removes tokens from an account and decreases the token supply.
disableTransfers
function disableTransfers(bool _disable)
Disables transfer/transferFrom functionality.
NewSmartToken
event NewSmartToken(address _token)
Triggered when a smart token is deployed.
Issuance
event Issuance(uint256 _amount)
Triggered when the total supply is increased.
Destruction
event Destruction(uint256 _amount)
Triggered when the total supply is decreased.
Tests are included and can be run using truffle.
To run the test, execute the following commands from the project's root folder - Run testRPC:
to live network:
Rootcore Crowdsale is open source and distributed under the Apache License v2.0