Giter VIP home page Giter VIP logo

crowdsale-contracts's Introduction

Lunyr

A decentralized world knowledge base where users earn rewards for contributing and peer reviewing.

Lunyr platform code is currently in a private repo and will be made public after the Galaxy Release.

crowdsale-contracts's People

Contributors

arnpham avatar atran262 avatar frozeman avatar illuzen avatar in10se 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

Watchers

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

crowdsale-contracts's Issues

Compilation failed

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.

Have a the fallback function payable on crowdsale contract

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.

Mitigating risks with multisig paythrough

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

  • Create a function loadRefund that is executed from multisig walle and it leaves funds on the contract

or

  • Have the default fallback function to check for the transfers coming from the multisig wallet. Example:

https://github.com/miohtama/Edgeless-Smart-Contracts/blob/master/original_contracts/original_crowdsale.sol#L80

Can't deploy UpgradeAgent to private net

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?

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.