dri-network / rico Goto Github PK
View Code? Open in Web Editor NEWThe Responsible Initial Coin Offering Framework
License: GNU General Public License v3.0
The Responsible Initial Coin Offering Framework
License: GNU General Public License v3.0
I found a typo for JP whitepaper.
s/Responsible Initial Coin Offersing (以下「RICO」)/Responsible Initial Coin Offering (以下「RICO」)/
We could to withdraw ether from contract when execTime elapsed.
function addWithdrawalRound( uint256 _roundWithdrawal, uint256 _execTime, address _to) returns (bool) {}
permission
When doing the tutorial:
truffle migrate --reset --network testrpc
Error: Cannot find module 'truffle-hdwallet-provider'
Hi do anyone know what this error means? I am just trying to run the deploy script.
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.
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;
}
check and list all code reviews
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;
}
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.
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.
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 changeable function for RICO token.
function changeOwner(address _newOwner) external onlyOwner() returns (bool) {
require(_newOwner != 0x0);
owner = _newOwner;
return true;
}
try
npm install solidity-compiler -g
npm ERR! code E404
npm ERR! 404 Not Found: solidity-compiler@latest
Todo:
add function for KYC executes
function addWhitelists(address kycProvider, address) returns (bool) {}
/*
* 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.
function executeNextSeries() onlyOwner() returns (bool) {}
function split
Can be called while propose submitted.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 as default NPM dependancies:
npm install [email protected] -g
npm install solidity-compiler -g
npm install ganache-cli -g
Upgrade Dependencies to use Truffle Framework v4.0.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.