Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Record ICO Contract

Please see below description of Record ICO smart contract developed by [RecordFoundation].

Overview

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.

The Crowdsale Specification

  • 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%

Code

RecordICO Functions

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

AppicsIco Events

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);

Prerequisites

  1. nodejs, and make sure it's version above 8.0.0
  2. npm
  3. truffle
  4. testrpc

Run tests

  1. run testrpc -a 20 -l 8000000 in terminal
  2. run truffle test in another terminal to execute tests.

Structure of tests

  1. check that function setRate works properly
  2. try to buy tokens before starting round(test gives an error that falls to .catch)
  3. start round
  4. check that function getBonus works properly
  5. set RateETH = 1 to check that contract rounds numbers right(1$ = 20/3 XAP)
  6. buy tokens for 30, 31, 32 Wei and watch how contract rounds numbers
  7. check we can't withdraw ether(round isn't finished)
  8. pause round
  9. check that we cannot buy tokens
  10. start round again
  11. check that we can buy tokens after second start
  12. finish round
  13. check that we cannot buy tokens
  14. unfreeze tokens
  15. withdraw ether
  16. check that tokens aren't frozen (send from one account to another)
  17. freeze tokens
  18. check that tokens are frozen (try to send from one account to another)

Deploy contract with truffle to network

  1. Change parameters of constructor in migrations/2_deploy_contracts.js

  2. 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 }

  3. In console in ico-smartcontract-appics then run: truffle compile

  4. In geth console unlock wallet which will be used for deploy

  5. Then use command: truffle migrate --network live

    More information about deploy with truffle [here][truffle]

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.