Please see below description of Record ICO smart contract developed by [RecordFoundation].
Record 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.15 apiece.
- Record token is ERC-20 compliant.
- Allocation of Appics tokens goes in the following way:
- ICO 50%
- Founders and Team 18%
- RecordFarm Ecosystem 15%
- Investors 5%
- Advisors and Ambassadors 8%
- Bounty Program 4%
Fallback function
function() external payable
Fallback function calls function buyTokens(address _investor, uint256 _xapValue) 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.
startPreSaleRound
function startPreSaleRound() external managerOnly
Set ICO status to PreSaleStarted.
pausePreSaleRound
function pausePreSaleRound() external managerOnly
Set Ico status to PreSalePaused.
finishPreSaleRound
function finishPreSaleRound() external managerOnly
Set ICO status to PreSaleFinished.
startRoundA
function startRoundA() external managerOnly
Set ICO status to RoundAStarted.
pauseRoundA
function pauseRoundA() external managerOnly
Set ICO status to RoundAPaused.
finishRoundA
function finishRoundA() external managerOnly
Finish round A and allocate tokens for AppicsFund, EcosystemFund, SteemitFund, BountyFund.
startRoundB
function startRoundB() external managerOnly
Set ICO status to RoundBStarted.
pauseRoundB
function pauseRoundB() external managerOnly
Set ICO status to RoundBPaused.
finishRoundB
function finishRoundB() external managerOnly
Finish round B and allocate tokens for AppicsFund, EcosystemFund, SteemitFund, BountyFund.
startRoundC
function startRoundC() external managerOnly
Set ICO status to RoundCStarted.
pauseRoundC
function pauseRoundC() external managerOnly
Set ICO status to RoundCPaused.
finishRoundC
function finishRoundC() external managerOnly
Finish round C and allocate tokens for AppicsFund, EcosystemFund, SteemitFund, BountyFund.
startRoundD
function startRoundD() external managerOnly
Set ICO status to RoundDStarted.
pauseRoundD
function pauseRoundD() external managerOnly
Set ICO status to RoundDPaused.
finishRoundD
function finishRoundD() external managerOnly
Finish round D and allocate tokens for AppicsFund, EcosystemFund, SteemitFund, BountyFund.
unfreeze
function unfreeze() external managerOnly
Unfreezes tokens (enable token transfers).
freeze
function freeze() external managerOnly
freezes tokens.
buyForInvestor
function buyForInvestor(address _investor,uint256 _xapValue,string _txHash) external controllersOnly
buyForInvestor function is called by one of controllers. It uses buyTokens(address _investor, uint256 _xapValue) function to allocate tokens to investors who make a deposit in non-ETH currencies.
buyTokens
function buyTokens(address _investor, uint256 _xapValue) internal startedOnly
internal function that called by buyForInvestor and fallback functions
getBonus
function getBonus(uint256 _value) public constant returns(uint256)
get current bonus
register
function register(string _key) public
allows investors to add their public key of Appics blockchain
withdrawEther
function withdrawEther(uint256 _value) external managerOnly
LogStartPreSaleRound
event LogStartPreSaleRound();
LogPausePreSaleRound
event LogPausePreSaleRound();
LogFinishPreSaleRound
event LogFinishPreSaleRound(
address AppicsFund,
address EcosystemFund,
address SteemitFund,
address BountyFund
);
LogStartRoundA
event LogStartRoundA();
LogPauseRoundA
event LogPauseRoundA();
LogFinishRoundA
event LogFinishRoundA(
address AppicsFund,
address EcosystemFund,
address SteemitFund,
address BountyFund
);
LogStartRoundB
event LogStartRoundB();
LogPauseRoundB
event LogPauseRoundB();
LogFinishRoundB
event LogFinishRoundB(
address AppicsFund,
address EcosystemFund,
address SteemitFund,
address BountyFund
);
LogStartRoundC
event LogStartRoundC();
LogPauseRoundC
event LogPauseRoundC();
LogFinishRoundC
event LogFinishRoundC(
address AppicsFund,
address EcosystemFund,
address SteemitFund,
address BountyFund
);
LogStartRoundD
event LogStartRoundD();
LogPauseRoundD
event LogPauseRoundD();
LogFinishRoundD
event LogFinishRoundD(
address AppicsFund,
address EcosystemFund,
address SteemitFund,
address BountyFund
);
LogBuyForInvestor
event LogBuyForInvestor(address investor, uint256 aidValue, string txHash);
LogRegister
event LogRegister(address investor, string key);
- nodejs, and make sure it's version above 8.0.0
- npm
- truffle
- testrpc
- run
testrpc -a 20 -l 8000000
in terminal - run
truffle test
in another terminal to execute tests.
- check that function setRate works properly
- try to buy tokens before starting round(test gives an error that falls to .catch)
- start round
- check that function getBonus works properly
- set RateETH = 1 to check that contract rounds numbers right(1$ = 20/3 XAP)
- buy tokens for 30, 31, 32 Wei and watch how contract rounds numbers
- check we can't withdraw ether(round isn't finished)
- pause round
- check that we cannot buy tokens
- start round again
- check that we can buy tokens after second start
- finish round
- check that we cannot buy tokens
- unfreeze tokens
- withdraw ether
- check that tokens aren't frozen (send from one account to another)
- freeze tokens
- check that tokens are frozen (try to send from one account to another)
-
Change parameters of constructor in migrations/2_deploy_contracts.js
-
Add network to truffle.js: live: { host: "localhost", port: 8545, //port where node is running network_id: "1" ,// Match any network id. 1- live network, 2 - ropsten, 3 - rinkeby gas: 7721975 //optional }
-
In console in ico-smartcontract-appics then run: truffle compile
-
In geth console unlock wallet which will be used for deploy
-
Then use command: truffle migrate --network live
More information about deploy with truffle [here][truffle]