Git Product home page Git Product logo

rico's People

Contributors

mesqueeb avatar mituoh avatar syrohei avatar takashi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rico's Issues

Suport truffle exec fucntions

file execute a single Transaction process for EVM

const DutchAuctionPoD = artifacts.require("DutchAuctionPoD.sol")

module.exports = async function (callback) {

  const dap = await DutchAuctionPoD.deployed()

  const podCapOfToken = 120 * 10 ** 18;
  const podCapofWei = 100000;

  const owner = web3.eth.accounts[0]

  const init = await dap.init(owner, podCapOfToken, podCapofWei).catch((err) => {
    console.log(err)
  })

}

command

truffle exec exec/DutchAuction/init.js [options --network testnet]

if account is locked, prepared a unlockingAccount.js

module.exports = async function (callback) {

  const accounts = web3.eth.accounts

  const result = web3.personal.unlockAccount(accounts[0], process.env.PASS, 100000)
  
  if (!result) [
    console.log("Error account is locked")
  ]
  console.log("Success! account is unlocked")
}

cmmand

PASS="geth account's password" truffle exec exec/unlockingAccount.js

Add ether withdrawal strategy for Round

We could to withdraw ether from contract when execTime elapsed.

function addWithdrawalRound( uint256 _roundWithdrawal, uint256 _execTime, address _to) returns (bool) {}

permission

  • execute from someOne.
  • execute from projectOwner

Add safety lock for token generation process.

add Token lock strategies

  /**
   * @dev confirm token creation strategy by projectOwner.
   */

  function strategyConfirm() external onlyProjectOwner() returns(bool) {

    require(status == Status.TokenCreated);

    require(auction.stage() == DutchAuction.Stages.AuctionDeployed);

    status = Status.TokenStructureConfirmed;

    return true;

  }

refine logic for RICO contract and Specification of PoD

  • To define Proof of Donation strategy.
  • PoD is a structure contract for store of proof of donation process and token balances.
contract SimplePoD is PoD {
  using SafeMath for uint256;

  function SimplePoD() public {
    name = "SimplePoD strategy token price = capToken/capWei ";
    version = 1;
    term = 7 days;
  }

  function processDonate(address _user) internal returns (bool) {

    tokenPrice = proofOfDonationCapOfToken / proofOfDonationCapOfWei;

    tokenBalances[_user] = tokenBalances[_user].add(tokenPrice * msg.value);

    return true;
  }
}
  function processDonate(address _user) internal returns (bool);

this function called when user get ICO process. this mean a internal invoked. if user send eth to PoD contract, PoD contract execute strategy process of ICO. project owner can build the case of ico strategy details. written in function processDonate.

definition

argument type description
name string name is a PoD name
owner address owner is RICO contract
version uint PoD version
term uint PoD receiving terms

functions

  function donate() payable public returns (bool) {

    require(status == Status.PoDStarted);

    require(block.timestamp > startTime);

    require(tx.gasprice <= 50000000000);

    if (block.timestamp > startTime + term) {
      status = Status.PoDEnded;
      endTime = now;
      require(msg.sender.send(msg.value));
      return true;
    }
    require(processDonate(msg.sender));

    require(owner.send(msg.value));

    return true;
  }

the case of using RICO framework, Proof of Donation strategy should be defined by PoD contract specifically, PoD contract must have transfer engine from PoD to the RICO contract. after ICO process. people have to access RICO contract and mint tokens.

  • RICO contract
  function mintToken(address _user) external returns(bool) {

    require(block.timestamp > pod.getEndtime() + 7 days);

    uint256 tokenValue = pod.getBalanceOfToken(_user);

    require(tokenValue > 0);

    require(token.mintable(_user, tokenValue, now));

    require(token.mint(_user));

    require(pod.resetTokenBalance(_user));

    return true;

  }

Switch Token format EIP20 to ERC223

  • Raiden contain ERC223 fixed token standard
 /*
 * Contract that is working with ERC223 tokens
 * https://github.com/ethereum/EIPs/issues/223
 */

/// @title ERC223ReceivingContract - Standard contract implementation for compatibility with ERC223 tokens.
contract ERC223ReceivingContract {

    /// @dev Function that is called when a user or another contract wants to transfer funds.
    /// @param _from Transaction initiator, analogue of msg.sender
    /// @param _value Number of tokens to transfer.
    /// @param _data Data containig a function signature and/or parameters
    function tokenFallback(address _from, uint256 _value, bytes _data) public;
}

function tokenFallback implement a refunding from contract if sender is contract. but this format is not de fact standard yet.

Add Whitelist addresses

add function for KYC executes

Checkmethod

  • address
  • maxDonations
function addWhitelists(address kycProvider,  address) returns (bool) {}

Replace Withdrawal round and Token round RICO to PoD

function addTokenRound(uint _index) public onlyOwner() returns(bool) {

    require(status == Status.TokenCreated);

    PoD pod = PoD(pods[_index]);

    if (pod.podType() == 110)   //TOB pod
      tobLimitWei = tobLimitWei.add(pod.proofOfDonationCapOfWei());
      
    pod.init();

    nowSupply = nowSupply.add(pod.proofOfDonationCapOfToken());

    require(nowSupply <= totalSupply);

    AddTokenRound(address(pod));

    return true;
  }
 function addWithdrawalRound(uint256 _distributeWei, uint256 _execTime, address _to, bool _isMM) public onlyOwner() returns(bool) {

    require(status == Status.TokenCreated);

    require(_execTime >= block.timestamp);  

    require(wLimitWei[_to][_distributeWei] == 0);  

    if (_isMM)
      require(tobLimitWei >= nowReserveWei.add(_distributeWei));

    wLimitWei[_to][_distributeWei] = _execTime;

    nowReserveWei = nowReserveWei.add(_distributeWei);

    AddWithdrawalRound(_distributeWei, _execTime, _to, _isMM, nowReserveWei);

    return true;
  }

both round's logic to be strictly. so to implement flexible, architecture transition to PoD.

Check the All code reviews

check and list all code reviews

  • function method check
  • function params declared check
  • function statement check
  • function recall check
  • function failback check
  • function memory load check

Add "Series Round" sutra for ICO strategy

  • If a token creation event has been end, Proof of Donation executes a single Token creation event. but Some ICO project implement a second ICO strategies. RICO take off it easy as a simple execute.
function executeNextSeries() onlyOwner() returns (bool)  {}
  • the fail of the DAO, function split Can be called while propose submitted.

Upgrade Dependencies

Upgrade Dependencies to use Truffle Framework v4.0.1

  • upgrade Solidity Compiler v0.4.18
  • EPM package support.
  • support Coding Guideline with Revert() on metropolis HF

upon deploy.js → UnhandledPromiseRejectionWarning: Error:

There is an issue with the promise returned from const wallet in the deploy script.

Problematic line:

const wallet = await MultiSigWalletWithDailyLimit.new([multisigWalletAddress1, multisigWalletAddress2], 2, multisigWalletDailyLimit)

Error in console:

(node:34173) UnhandledPromiseRejectionWarning: Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:41484:16)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:329530:36
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:325200:9
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328229:7)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176415:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176705:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176860:12)
at IncomingMessage. (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176820:24)
at IncomingMessage.emit (events.js:164:20)
at endReadableNT (_stream_readable.js:1062:12)
(node:34173) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:34173) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Typo Whitepaper[JP]

I found a typo for JP whitepaper.

s/Responsible Initial Coin Offersing (以下「RICO」)/Responsible Initial Coin Offering (以下「RICO」)/

Replace DutchAuction strategy Gnosis to Raiden

Raiden DutchAuction code is

 /// @dev Calculates the token price (WEI / RDN) at the current timestamp
    /// during the auction; elapsed time = 0 before auction starts.
    /// Based on the provided parameters, the price does not change in the first
    /// `price_constant^(1/price_exponent)` seconds due to rounding.
    /// Rounding in `decay_rate` also produces values that increase instead of decrease
    /// in the beginning; these spikes decrease over time and are noticeable
    /// only in first hours. This should be calculated before usage.
    /// @return Returns the token price - Wei per RDN.
    function calcTokenPrice() constant private returns (uint) {
        uint elapsed;
        if (stage == Stages.AuctionStarted) {
            elapsed = now - start_time;
        }

        uint decay_rate = elapsed ** price_exponent / price_constant;
        return price_start * (1 + elapsed) / (1 + elapsed + decay_rate);
    } 

also Gnosis DutchAuction is

/// @dev Calculates stop price
    /// @return Returns stop price
    function calcStopPrice()
        constant
        public
        returns (uint)
    {
        return totalReceived * 10**18 / MAX_TOKENS_SOLD + 1;
    }

    /// @dev Calculates token price
    /// @return Returns token price
    function calcTokenPrice()
        constant
        public
        returns (uint)
    {
        return priceFactor * 10**18 / (block.number - startBlock + 7500) + 1;
    }

It seems like Raiden code is simplified more than Gnosis code.

Add Feature for Changeable Token Owner.

Add changeable function for RICO token.

function changeOwner(address _newOwner) external onlyOwner() returns (bool) {
        require(_newOwner != 0x0);

        owner = _newOwner;

        return true;
}

solidity-compiler doesn't exist

try
npm install solidity-compiler -g

npm ERR! code E404
npm ERR! 404 Not Found: solidity-compiler@latest

Todo:

  • remove from dependencies
  • check compilation issues without solidity-compiler

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.