Lunyr
A decentralized world knowledge base where users earn rewards for contributing and peer reviewing.
Crowdsale contracts
License: GNU General Public License v3.0
A decentralized world knowledge base where users earn rewards for contributing and peer reviewing.
The source code won't compile. I get the following error:
truffle compile && truffle migrate
Compiling ./contracts/ERC20.sol...
Compiling ./contracts/LunyrToken.sol...
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/MultiSigWallet.sol...
Compiling ./contracts/NewToken.sol...
Compiling ./contracts/SafeMath.sol...
Compiling ./contracts/TestContract.sol...Compilation warnings encountered:
/home/user/Projects/Ethereum/crowdsale-contracts-master/contracts/LunyrToken.sol:85:48: : Initial value for constant variable has to be compile-time constant. This wil
l fail to compile with the next breaking version change.
uint256 public constant tokenCreationMax = safeMul(250000 ether, tokensPerEther);
^-----------------------------------^
,/home/user/Projects/Ethereum/crowdsale-contracts-master/contracts/LunyrToken.sol:86:48: : Initial value for constant variable has to be compile-time constant. This wi
ll fail to compile with the next breaking version change.
uint256 public constant tokenCreationMin = safeMul(25000 ether, tokensPerEther);
^----------------------------------^/home/user/Projects/Ethereum/crowdsale-contracts-master/contracts/LunyrToken.sol:85:48: : Initial value for constant variable has to be compile-time constant. This wil
l fail to compile with the next breaking version change.
uint256 public constant tokenCreationMax = safeMul(250000 ether, tokensPerEther);
^-----------------------------------^
,/home/user/Projects/Ethereum/crowdsale-contracts-master/contracts/LunyrToken.sol:86:48: : Initial value for constant variable has to be compile-time constant. This wi
ll fail to compile with the next breaking version change.
uint256 public constant tokenCreationMin = safeMul(25000 ether, tokensPerEther);
^----------------------------------^
,/home/user/Projects/Ethereum/crowdsale-contracts-master/contracts/LunyrToken.sol:113:21: : Contract with internal constructor cannot be created directly.
timeVault = new LUNVault(_lunyrMultisig);
^----------^
Compiliation failed. See above.
This is not strictly speaking an issues with a smart contract, but I'd like to raise attention on this. After speaking with Lunyr team it sounded like the approach was that people use Mist or Parity and call create
function on LunyrToken
:
https://github.com/Lunyr/crowdsale-contracts/blob/master/contracts/LunyrToken.sol#L258
This could happen through Mist or Parity browser or with MetaMask.
I'd like to stress out that you might seriously overestimate the audience capabilities to use Mist or Parity browser. All successful ETH token crowdsales have been "Please send a payment to this address with these parameters."
I'd suggest you approach this so you can give instructions for people to participate even without having a web3 capabilities. E.g. have instructions
Send a payment to address X with gas limit Y and data field Z.
This will work with MyEtherWallet and Jaxx as well. Also having data field filled will block non-compatible wallets where users are not holding private keys, like Coinbase.
It's possible to prefill data field by just having Keccak hash of create
as the payload (that's how EVM internally calls functions): http://ethereum.stackexchange.com/a/13010/620
Also it might make sense to rename create
to invest
as it reflects its nature better.
I am looking Lunyr crowdsale contract. There is one change I'd highly recommend to consider.
Currently crowdsale funds are hold on the crowdsale contract and then moved to the team multisig wallet when the crowdsale finalizes.
https://github.com/Lunyr/crowdsale-contracts/blob/master/contracts/LunyrToken.sol#L312
I'd change this so that the payment is forwarded to the multisig wallet instantly at the end of create()
:
https://github.com/Lunyr/crowdsale-contracts/blob/master/contracts/LunyrToken.sol#L280
Example:
https://github.com/Lunyr/crowdsale-contracts/blob/master/contracts/LunyrToken.sol#L312
Rationale
Albeit the risk is very low, it might be possible that the crowdfund contract ends up into a state that it cannot finalize. Thus, it makes sense for the team to have access to the funds even though the crowdsale contract is in a foobar state and recover from the situation with a manual token issuance. Few possible scenarios I can think of
A Solidity compiler bug
Somebody finds a way to fool the crowdsale contact state machinery
Not usual, but not unheard of.
Refund
In the case there is a need for a refund, ETH must be moved back from multisig wallet to the crowdsale contract.
Suggested approach include
loadRefund
that is executed from multisig walle and it leaves funds on the contractor
I'm trying to deploy the Lunyr contracts to my own private net run by geth. For some reason, it always fails to deploy the UpgradeAgent contract like this:
Running migration: 1_initial_migration.js
Replacing Migrations...
Migrations: 0x5efe2139a070a13874024cb6c7201d9d6a18943b
Saving successful migration to network...
Saving artifacts...
Running migration: 2_deploy_contracts.js
Deploying MultiSigWallet...
MultiSigWallet: 0xa79ad6b883af9338255d08b1b3bf952a5867419e
Deploying LunyrToken...
LunyrToken: 0x0bbd2736747791b50c94d2d8b26ae2cf6f3f86eb
Agent owner: 0x511b066674dc319a5c4aa8eb31dcc40d2ceb6813
Token address: 0x0bbd2736747791b50c94d2d8b26ae2cf6f3f86eb
Gas: 896254
Deploying UpgradeAgent...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
at Object.callback (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/contract.js:147:46)
at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/method.js:142:25
at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:89:9
No matter how much gas I'm willing to provide (gasEstimate), it always fails either by this error or by reaching the gas limit. Interestingly, you have this piece of code commented out:
// functionData = utils.getFunctionEncoding('UpgradeAgent(address)',[token.address]);
// return web3.eth.estimateGas({data:functionData});
// }).then(function(gasEstimate){
// console.log(gasEstimate);
If I uncomment it, it seems to work but after 50 blocks mined I get an error saying that the transaction couldn't be found. Also, the gasEstimate that it finds is 50,000,000, compared to the 2,000,000 which is hard coded now.
Any ideas why this might happen?
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.