Please see below description of Aida ICO smart contract developed by Phenom.Team. This is a first ever contract based upon the new concept outlined by Vitalik Buterin when investors can revoke their deposits before the end of the ICO
AID Token smart-contract is structured upon ERC20 standard. One of distinctive features of the smart-contract is the fact that token price is fixed and pegged to USD instead of ETH which protects investors from volatility risks of ETH currency. This technical feature is made possible by usage of Oracle that updates ETH/USD actual exchange rate in the smart contract every 30 minutes. The token price is set to $0.25 apiece.
Ethereum is not the only currency investors can use when investing, they can also opt to purchase AID tokens with BTC, LTC, BCC and even USD (in debit cards). Processing of transactions in these currencies is enabled by automated platform, which processes every single incoming transaction and calculates it's USD equivalent. It also tracks number of confirmations of every single transaction and emits tokens to Ethereum address of an investor, he specified in his personal profile web page. Emission itself is processed by bringing up of buyForInvestor method directly from cotroller-addresses (controllersOnly). In order to ensure smooth real-time emission of AID tokens, a unique sharding technology developed by Phenom.Team is used. The basics of the technology boils down to the procedure wherein the whole emission process is distributed among three controller-addresses, which allows to perform fast real-time token emission even when the whole Ethereum network is overloaded.
AidaIco is the first smart-contract which is structured and based upon the concept outlined by Vitalik Buterin when investors can revoke their deposits:
- For ETH investments: all tokens stashed on investor’s address get burned and invested ETH forwared back to investor’s wallet from AidaIco smart-contract.
- BTC, LTC, BCC investments: refund process sf powered by Oracle. The investment amount get refunded back to investor’s wallet, minus transaction fee.
- Withdrawal lock – during the main stage of the ICO refund is possible only till 30th January 2018, inclusive.
- AID token is ERC-20 compliant.
- Allocation of AID tokens goes in the following way:
- Bounty 1%
- Partners 3%
- Team 20%
- Public ICO 76%
Fallback function
function() external payable
Fallback function calls createTokensForEth(address _investor, uint256 _aidValue) function to create tokens when investor sends ETH directly to ICO smart contract address.
setRate
function setRate(uint256 _RateEth) external oracleOnly
Set ETH/USD exchange rate and update token price.
startPreIco
function startPreIco() external managerOnly
Set ICO status to PreIcoStarted.
pausePreIco
function pausePreIco() external managerOnly
Set Ico status to PreIcoPaused.
finishPreIco
function finishPreIco() external managerOnly
Set ICO status to PreIcoFinished.
startIco
function startIco() external managerOnly
Set ICO status to IcoStarted.
pauseIco
function startIco() external managerOnly
Set ICO status to IcoPaused.
finishIco
function finishIco() external managerOnly
Finish ICO and allocate tokens for bounty company, partners and team pools.
enableTokensTransfer
function enableTokensTransfer() external managerOnly
Unfreezes tokens (enable token transfers).
rememberEther
function rememberEther(uint256 _value, address _investor) internal
Stores amount invested from specific address.
rememberTokensEth
function rememberTokensEth(uint256 _value, address _investor) internal
Stores amount of AID tokens investor received (for ETH purchases).
rememberTokensOtherCrypto
function rememberTokensOtherCrypto(uint256 _value, address _investor) internal
Stores amount of AID tokens investor received (for purchases in BTC, LTC, BCC).
buyForInvestor
function buyForInvestor(address _investor,uint256 _aidValue,string _txHash) external controllersOnly
buyForInvestor function is called by one of controllers createTokensForOtherCrypto(address _investor, uint256 _aidValue) function to allocate tokens to investors who make a deposit in non-ETH currencies.
createTokensForOtherCrypto
function createTokensForOtherCrypto(address _investor, uint256 _aidValue) internal
Issue tokens for investors who paid in other cryptocurrencies.
createTokensForEth
function createTokensForEth(address _investor, uint256 _aidValue) internal
Issue tokens for investors who paid in ETH.
getBonus
function getBonus(uint256 _value) public constant returns(uint256)
get current bonus
daysFromIcoStart
function daysFromIcoStart() public constant returns(uint256)
Count days from Ico start day.
returnEther
function returnEther() public
Allows investors to return their investments(in ETH) if preICO or ICO_RETURN_DURATION is not over yet and burns tokens.
returnOtherCrypto
function returnOtherCrypto(address _investor, string _logString) external refundManagerOnly
This method is called by refund manager to burn tokens of investors who want to revoke their investments in other cryptocurrencies.
withdrawEther
function withdrawEther(uint256 _value) external managerOnly
Allows Company withdrawing investments when ICO_RETURN_DURATION is over
LogStartICO
event LogStartICO();
LogPauseICO
event LogPauseICO();
LogFinishICO
event LogFinishICO(address bountyFund, address partnersFund, address teamFund);
LogBuyForInvestor
event LogBuyForInvestor(address investor, uint256 aidValue, string txHash);
LogReturnEth
event LogReturnEth(address investor, uint256 eth);
LogReturnOtherCrypto
event LogReturnOtherCrypto(address investor, string logString);
- nodejs, and make sure it's version above 8.0.0
- npm
- truffle
- testrpc
- run
testrpc
in terminal - run
truffle test
in another terminal to execute tests.