Code Monkey home page Code Monkey logo

smart-contract's Introduction

Slock.it smart contracts

What is it?

The Ethereum solidity smart contracts for the Slock.it project

Contact

Please contact us on our slack

smart-contract's People

Contributors

cjentzsch avatar cryptocolm avatar griffgreen avatar lefterisjp avatar pirapira avatar simon-jentzsch avatar u2 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  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  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

smart-contract's Issues

mining contract failed

When I ran the test, I found that geth could not mine contract.

$ geth --dev --genesis genesis_block.json --datadir ./data  console 2>> out.log.geth
instance: Geth/v1.3.2/darwin/go1.5.1
 datadir: data
coinbase: 0xd2bfd41dfd7932d5daa46d26770b8685f3f6a556
at block: 0 (Thu, 01 Jan 1970 08:00:00 CST)
modules: admin:1.0 db:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 shh:1.0 txpool:1.0 web3:1.0
> loadScript("deploy.js")
unlocking
setting service provider and daoCreator
mining contract plz wait
true
> miner.start(1); admin.sleepBlocks(1); miner.stop();
true
> dao
{
  address: undefined
}
> 

The log:

I0206 14:35:22.454587   74433 ethash.go:252] Generating DAG: 98%
I0206 14:35:22.454671   74433 ethash.go:252] Generating DAG: 99%
I0206 14:35:22.454750   74433 ethash.go:252] Generating DAG: 100%
I0206 14:35:22.454868   74433 ethash.go:237] Done generating DAG for epoch 0, it took 5.884362ms
I0206 14:35:25.211608   74433 worker.go:349] 🔨  Mined block (#1 / 260ad13e). Wait 5 blocks for confirmation
I0206 14:35:25.212028   74433 worker.go:570] commit new work on block 2 with 0 txs & 0 uncles. Took 388.439µs
I0206 14:35:25.212342   74433 worker.go:570] commit new work on block 2 with 0 txs & 0 uncles. Took 267.607µs
I0206 14:35:37.152659   74433 worker.go:349] 🔨  Mined block (#2 / a3830cef). Wait 5 blocks for confirmation
I0206 14:35:37.153008   74433 worker.go:570] commit new work on block 3 with 0 txs & 0 uncles. Took 314.533µs
I0206 14:35:37.153385   74433 worker.go:570] commit new work on block 3 with 0 txs & 0 uncles. Took 328.791µs
I0206 14:35:59.650526   74433 miner.go:119] Starting mining operation (CPU=1 TOT=2)
I0206 14:35:59.650945   74433 worker.go:570] commit new work on block 3 with 0 txs & 0 uncles. Took 361.47µs
I0206 14:36:02.624874   74433 worker.go:349] 🔨  Mined block (#3 / 72c9945e). Wait 5 blocks for confirmation
I0206 14:36:02.625242   74433 worker.go:570] commit new work on block 4 with 0 txs & 0 uncles. Took 333.41µs
I0206 14:36:02.625566   74433 worker.go:570] commit new work on block 4 with 0 txs & 0 uncles. Took 272.96µs
I0206 14:36:04.163001   74433 worker.go:349] 🔨  Mined block (#4 / 9c7039cc). Wait 5 blocks for confirmation
I0206 14:36:04.163449   74433 worker.go:570] commit new work on block 5 with 0 txs & 0 uncles. Took 409.366µs
I0206 14:36:04.163826   74433 worker.go:570] commit new work on block 5 with 0 txs & 0 uncles. Took 309.362µs

And when I and the option --mine, it workable.

$ geth --dev --mine --genesis genesis_block.json --datadir ./data  console 2>> out.log.geth 
instance: Geth/v1.3.2/darwin/go1.5.1
 datadir: data
coinbase: 0xd2bfd41dfd7932d5daa46d26770b8685f3f6a556
at block: 0 (Thu, 01 Jan 1970 08:00:00 CST)
modules: admin:1.0 db:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 shh:1.0 txpool:1.0 web3:1.0
> loadScript("deploy.js")
unlocking
setting service provider and daoCreator
null [object Object]
mining contract plz wait
true
> null [object Object]
Contract mined! address: 0x9e242f8a144bfaa8aa90379b14f5fbbc1d84e657 transactionHash: 0xca75a2f4fc5921d535a0f7bc7c7d5f09307decbd41f7fb9001ac422f6507ef5e

The log

I0206 14:42:07.933767    4167 ethash.go:252] Generating DAG: 99%
I0206 14:42:07.933818    4167 ethash.go:252] Generating DAG: 100%
I0206 14:42:07.933878    4167 ethash.go:237] Done generating DAG for epoch 0, it took 6.472034ms
I0206 14:42:09.022992    4167 worker.go:349] 🔨  Mined block (#1 / f7905ca7). Wait 5 blocks for confirmation
I0206 14:42:09.023346    4167 worker.go:570] commit new work on block 2 with 0 txs & 0 uncles. Took 319.118µs
I0206 14:42:09.023649    4167 worker.go:570] commit new work on block 2 with 0 txs & 0 uncles. Took 258.429µs
I0206 14:42:12.481289    4167 worker.go:349] 🔨  Mined block (#2 / 2cf4687f). Wait 5 blocks for confirmation
I0206 14:42:12.481751    4167 worker.go:570] commit new work on block 3 with 0 txs & 0 uncles. Took 416.535µs
I0206 14:42:12.482535    4167 worker.go:570] commit new work on block 3 with 0 txs & 0 uncles. Took 678.477µs
I0206 14:42:14.972145    4167 worker.go:349] 🔨  Mined block (#3 / ff60ee82). Wait 5 blocks for confirmation
I0206 14:42:14.972537    4167 worker.go:570] commit new work on block 4 with 0 txs & 0 uncles. Took 356.268µs
I0206 14:42:14.972887    4167 worker.go:570] commit new work on block 4 with 0 txs & 0 uncles. Took 299.575µs
I0206 14:42:15.505646    4167 worker.go:349] 🔨  Mined block (#4 / dcac85c2). Wait 5 blocks for confirmation
I0206 14:42:15.506052    4167 worker.go:570] commit new work on block 5 with 0 txs & 0 uncles. Took 367.984µs
I0206 14:42:15.506491    4167 worker.go:570] commit new work on block 5 with 0 txs & 0 uncles. Took 381.997µs
I0206 14:42:20.073099    4167 worker.go:349] 🔨  Mined block (#5 / 0cf99bb8). Wait 5 blocks for confirmation
I0206 14:42:20.073965    4167 worker.go:570] commit new work on block 6 with 0 txs & 0 uncles. Took 576.016µs
I0206 14:42:20.074414    4167 worker.go:570] commit new work on block 6 with 0 txs & 0 uncles. Took 342.535µs
I0206 14:42:25.022654    4167 worker.go:349] 🔨  Mined block (#6 / ca6a6740). Wait 5 blocks for confirmation
I0206 14:42:25.023038    4167 worker.go:570] commit new work on block 7 with 0 txs & 0 uncles. Took 348.329µs
I0206 14:42:25.023107    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #1
I0206 14:42:25.023648    4167 worker.go:570] commit new work on block 7 with 0 txs & 0 uncles. Took 482.551µs
I0206 14:42:25.156646    4167 worker.go:349] 🔨  Mined block (#7 / df0ca54c). Wait 5 blocks for confirmation
I0206 14:42:25.156976    4167 worker.go:570] commit new work on block 8 with 0 txs & 0 uncles. Took 295.927µs
I0206 14:42:25.157010    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #2
I0206 14:42:25.157298    4167 worker.go:570] commit new work on block 8 with 0 txs & 0 uncles. Took 252.097µs
I0206 14:42:26.744003    4167 worker.go:349] 🔨  Mined block (#8 / 2f5d7c24). Wait 5 blocks for confirmation
I0206 14:42:26.744369    4167 worker.go:570] commit new work on block 9 with 0 txs & 0 uncles. Took 335.148µs
I0206 14:42:26.744403    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #3
I0206 14:42:26.744758    4167 worker.go:570] commit new work on block 9 with 0 txs & 0 uncles. Took 310.127µs
I0206 14:42:26.836647    4167 worker.go:349] 🔨  Mined block (#9 / 7dcb7fa7). Wait 5 blocks for confirmation
I0206 14:42:26.836973    4167 worker.go:570] commit new work on block 10 with 0 txs & 0 uncles. Took 285.319µs
I0206 14:42:26.837002    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #4
I0206 14:42:26.837261    4167 worker.go:570] commit new work on block 10 with 0 txs & 0 uncles. Took 220.275µs
I0206 14:42:27.985755    4167 worker.go:349] 🔨  Mined block (#10 / ec62458e). Wait 5 blocks for confirmation
I0206 14:42:27.986249    4167 worker.go:570] commit new work on block 11 with 0 txs & 0 uncles. Took 344.557µs
I0206 14:42:27.987190    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #5
I0206 14:42:27.988098    4167 worker.go:570] commit new work on block 11 with 0 txs & 0 uncles. Took 757.475µs
I0206 14:42:31.651403    4167 worker.go:349] 🔨  Mined block (#11 / 320c9f01). Wait 5 blocks for confirmation
I0206 14:42:31.651824    4167 worker.go:570] commit new work on block 12 with 0 txs & 0 uncles. Took 384.698µs
I0206 14:42:31.651858    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #6
I0206 14:42:31.652484    4167 worker.go:570] commit new work on block 12 with 0 txs & 0 uncles. Took 592.537µs
I0206 14:42:33.426717    4167 worker.go:349] 🔨  Mined block (#12 / 8f16520e). Wait 5 blocks for confirmation
I0206 14:42:33.427727    4167 worker.go:570] commit new work on block 13 with 0 txs & 0 uncles. Took 957.668µs
I0206 14:42:33.427933    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #7
I0206 14:42:33.428676    4167 worker.go:570] commit new work on block 13 with 0 txs & 0 uncles. Took 574.663µs
I0206 14:42:33.784812    4167 worker.go:349] 🔨  Mined block (#13 / 6cefb476). Wait 5 blocks for confirmation
I0206 14:42:33.785207    4167 worker.go:570] commit new work on block 14 with 0 txs & 0 uncles. Took 356.162µs
I0206 14:42:33.785239    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #8
I0206 14:42:33.785575    4167 worker.go:570] commit new work on block 14 with 0 txs & 0 uncles. Took 268.075µs
I0206 14:42:35.119242    4167 worker.go:349] 🔨  Mined block (#14 / d42387bd). Wait 5 blocks for confirmation
I0206 14:42:35.119686    4167 worker.go:570] commit new work on block 15 with 0 txs & 0 uncles. Took 403.363µs
I0206 14:42:35.119742    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #9
I0206 14:42:35.120286    4167 worker.go:570] commit new work on block 15 with 0 txs & 0 uncles. Took 423.455µs
I0206 14:42:35.212191    4167 worker.go:349] 🔨  Mined block (#15 / c6b1ccc7). Wait 5 blocks for confirmation
I0206 14:42:35.212514    4167 worker.go:570] commit new work on block 16 with 0 txs & 0 uncles. Took 287.678µs
I0206 14:42:35.212564    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #10
I0206 14:42:35.212872    4167 worker.go:570] commit new work on block 16 with 0 txs & 0 uncles. Took 260.222µs
I0206 14:42:39.920016    4167 worker.go:349] 🔨  Mined block (#16 / 571a6aa4). Wait 5 blocks for confirmation
I0206 14:42:39.920547    4167 worker.go:570] commit new work on block 17 with 0 txs & 0 uncles. Took 491.559µs
I0206 14:42:39.920600    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #11
I0206 14:42:39.921044    4167 worker.go:570] commit new work on block 17 with 0 txs & 0 uncles. Took 402.659µs
I0206 14:42:41.299919    4167 worker.go:349] 🔨  Mined block (#17 / abbccf69). Wait 5 blocks for confirmation
I0206 14:42:41.300531    4167 worker.go:570] commit new work on block 18 with 0 txs & 0 uncles. Took 576.302µs
I0206 14:42:41.300569    4167 worker.go:448] 🔨 🔗  Mined 5 blocks back: block #12
I0206 14:42:41.300835    4167 worker.go:570] commit new work on block 18 with 0 txs & 0 uncles. Took 229.42µs
I0206 14:42:41.507382    4167 xeth.go:1026] Tx(0xca75a2f4fc5921d535a0f7bc7c7d5f09307decbd41f7fb9001ac422f6507ef5e) created: 0x9e242f8a144bfaa8aa90379b14f5fbbc1d84e657
I0206 14:42:41.511087    4167 miner.go:119] Starting mining operation (CPU=1 TOT=6)

VM STAT 114 OPs
PC 00000000: PUSH1 GAS: 2303605 COST: 3
STACK = 0
MEM = 0
STORAGE = 0

PC 00000002: PUSH1 GAS: 2303602 COST: 3
STACK = 1
0000: 0000000000000000000000000000000000000000000000000000000000000060
MEM = 0
STORAGE = 0

......

I0206 14:42:41.584774    4167 worker.go:570] commit new work on block 18 with 1 txs & 0 uncles. Took 73.592183ms
I0206 14:42:44.503128    4167 worker.go:349] 🔨  Mined block (#18 / a236010e). Wait 5 blocks for confirmation

So , should I always add the option --mine? #19

potential bug in the slockdao contract

wouldn't the following line of code in slockdao.sol result in slockit receiving nothing?
basically totalWeiRecieved would be set to 0 the first time the function containing this line is called.
resulting in msg.sender receiving nothing. I am confused about the if statement. I assume that it would return true. either way msg.sender.send() is executed before totalWeiRecieved is set.
after which totalweirecieved is set to the balance of the contract.

the result being that slock doesn't receive the crowdfunded money.

Is my reasoning correct?

function finalize() external
{
if (now > closingTime && msg.sender == 0x510c && totalWeiReceived == 0 && this.balance >= minValue)
{
if (msg.sender.send(totalWeiReceived)) totalWeiReceived = this.balance;
}
}

Sec Issue Utlize token transfer to allow infinite voteing.

I believe that a malicious user could utilize the transfer functionality in line 100 of Token.sol to transfer their tokens to another account after they have voted once.

Since function vote line 201 or DAO.sol prevents a double vote by checking a list of voters for msg.sender the new owner with a different address could vote again.

This could allow a malicious user to have potentially infinite votes on any proposal.

add calender

allowing a user to rent the slock for a fixed time period

  • rent(uint startTime, uint length)
  • checkAvailibility(uint startTime, uint length)

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.