Compare commits

...

738 Commits

Author SHA1 Message Date
0541347034 v1.6.0 2018-01-23 17:48:04 -03:00
c5d66183ab Move ERC20 contracts to ERC20 custom folder (#701)
* Move ERC20 contracts to ERC20 custom folder

* Fix linter warnings for ERC20 contracts
2018-01-23 17:46:41 -03:00
1eea95f9ac Move ERC721 files to custom folder (#700) 2018-01-23 17:03:05 -03:00
e16c4042c1 Merge pull request #627 from facuspagnuolo/feature/implement_erc721_standard
Implement ERC721 standard
2018-01-23 10:47:28 -03:00
e1d32acae8 Merge branch 'master' into feature/implement_erc721_standard 2018-01-23 10:29:55 -03:00
3b499a9cc3 Merge pull request #687 from sot528/fix/reference-of-rbac-usage
fix reference of RBAC usage.
2018-01-22 19:05:01 -08:00
4e77aaa0c3 Merge branch 'master' into fix/reference-of-rbac-usage 2018-01-22 17:46:47 -08:00
4be30dc3ae Merge branch 'master' into feature/implement_erc721_standard 2018-01-19 17:43:03 -03:00
370e6a882a ERC20 totalSupply changed from public property to a function (#666)
Fixes OpenZeppelin/zeppelin-solidity#434
2018-01-19 17:15:27 -03:00
9cc55ef2a5 use short circuit (#654) 2018-01-19 15:45:48 -03:00
48594890cf Merge branch 'master' into feature/implement_erc721_standard 2018-01-19 15:36:52 -03:00
6979e3c83a Merge pull request #693 from fulldecent/patch-1
Fix test name
2018-01-19 15:28:27 -03:00
96e0d35f11 Merge branch 'master' into fix/reference-of-rbac-usage 2018-01-19 15:17:23 -03:00
66402e9fec Merge branch 'master' into patch-1 2018-01-19 15:15:29 -03:00
5b40202dd3 Merge pull request #691 from frangio/fix-643
Add note about not following semver
2018-01-19 12:53:54 -03:00
da95df6be5 Fix test name 2018-01-18 23:47:02 -05:00
250572f48d add note about not following semver 2018-01-18 18:18:10 -03:00
ff9e9c4d85 Merge pull request #680 from ajsantander/azavalla-feature/inheritable-contract
Azavalla feature/inheritable contract
2018-01-18 17:41:44 -03:00
c8c0f21a3f Merge branch 'master' into azavalla-feature/inheritable-contract 2018-01-18 17:29:48 -03:00
3a9a2c8888 Merge pull request #684 from ajsantander/refactor/info-md-updates
Updates to markdown documentation
2018-01-18 17:27:37 -03:00
a5ea0af65c Merge branch 'master' into azavalla-feature/inheritable-contract 2018-01-18 17:20:07 -03:00
42553ec0c0 Merge branch 'master' into refactor/info-md-updates 2018-01-18 17:14:14 -03:00
c01203b0b7 Index addreses in events and explicit uint size 2018-01-18 16:58:45 -03:00
9d005b492d Explicit uint size 2018-01-18 16:42:19 -03:00
22c1403e5b Fix solidity style issue 2018-01-18 16:42:19 -03:00
3009553925 Update test names and js style 2018-01-18 16:42:19 -03:00
5ea9bd44a1 [Heritable] added HeirOwnershipClaimed event 2018-01-18 16:42:19 -03:00
51c2c50437 [Heritable] ownerLives(): constant --> view 2018-01-18 16:42:19 -03:00
52b6181d78 renamed Inheritable --> Heritable 2018-01-18 16:42:19 -03:00
fe712c678a [SimpleSavingsWallet.js] replace assertJump for expectThrow 2018-01-18 16:42:19 -03:00
c70ee937e6 [Inheritable.js] replace assertJump for expectThrow 2018-01-18 16:42:19 -03:00
46736da489 added test for SimpleSavingsWallet 2018-01-18 16:42:19 -03:00
82c85121bb changed Inherited event for OwnershipTransfered 2018-01-18 16:42:19 -03:00
e5960465a7 owner can't be set as heir 2018-01-18 16:42:19 -03:00
5716492ebd setHeartbeatTimeout: public --> internal 2018-01-18 16:42:19 -03:00
c7807c5b58 changed view for constant 2018-01-18 16:42:19 -03:00
433213537f changed events names on inheritable test 2018-01-18 16:42:19 -03:00
560a855dc7 further example documentation 2018-01-18 16:42:19 -03:00
80ae074c57 marked ownerLives as view 2018-01-18 16:42:19 -03:00
d808e49b51 changed 'pronounce' for 'proclaim' 2018-01-18 16:42:19 -03:00
a8afb20c20 Use Inherited event instead of OwnershipTransfered 2018-01-18 16:42:19 -03:00
a613cd03c9 added example use-case for Inheritable.sol 2018-01-18 16:42:19 -03:00
b709206f9f fixes 2018-01-18 16:42:19 -03:00
2a560ad82f name fix 2018-01-18 16:42:19 -03:00
4fe2157e36 Inheritable contract 2018-01-18 16:42:19 -03:00
5a42a450ac Merge pull request #678 from ernestas2k/fix/rename-erc23-occurrences-to-erc223Mock#675
Rename ERC23 occurrences to ERC223
2018-01-18 11:31:18 -08:00
49adfea68b Merge branch 'master' into fix/rename-erc23-occurrences-to-erc223Mock#675 2018-01-18 11:12:07 -08:00
a29fce9cbd Merge pull request #689 from joejordan/patch-1
Update README.md
2018-01-18 12:48:37 -03:00
7f591a9181 Update README.md
I clarified where the "npm install zeppelin-solidity" command should happen. I got hung up on it initially and I know others have as well.
2018-01-18 10:41:28 -05:00
23afc74b59 Address feedback comments for ERC721 2018-01-18 10:15:59 -03:00
dcf1f8d22d Rename ERC23 occurrences to ERC223 2018-01-18 11:03:43 +02:00
c7f2138da1 Merge pull request #688 from AugustoL/refactor/reorganize-tests
Reorganize tests and add library folder
2018-01-17 18:31:13 -03:00
b67856c69d Separate ERC20 and ERC827 form tokens implementations in contracts and test folders 2018-01-17 16:24:29 -03:00
4fbd44fd40 Reorganize tests and add library folder 2018-01-17 15:59:15 -03:00
2887393712 Merge branch 'master' into fix/reference-of-rbac-usage 2018-01-17 15:31:50 -03:00
af337047a4 Fix solint errors 2018-01-17 12:00:15 -03:00
b0522b9c58 Merge pull request #518 from AugustoL/add-smart-token
Add ERC827 Token
2018-01-17 11:58:57 -03:00
969466b8fd Add ethjs-abi dependency needed in ERC827 tests 2018-01-17 11:22:09 -03:00
2b008f4cb6 Fix solidity linter errors 2018-01-17 11:21:25 -03:00
d060d29912 Merge remote-tracking branch 'upstream/master' into add-smart-token 2018-01-17 11:01:05 -03:00
75439c1dd3 fix reference of RBAC usage. 2018-01-17 21:45:30 +09:00
c8878adcbd Merge branch 'master' into refactor/info-md-updates 2018-01-16 21:57:35 -03:00
d95c3ade8f Minor changes as per feedback from @frangio 2018-01-16 19:52:38 -03:00
7811370000 Remove branching section and remove negative comment 2018-01-16 19:26:10 -03:00
b1e1aadba1 Simplified and updated CONTRIBUTING.md, small update to README.md 2018-01-16 19:11:30 -03:00
7ddd66fb74 fix increaseApproval in ERC827Token with tests 2018-01-16 18:43:50 -03:00
0cdc5e13ce Update ISSUE_TEMPLATE.md 2018-01-16 17:07:39 -03:00
5b50e99a0d ERC721 required functionality tests 2018-01-16 16:05:01 -03:00
b09d7aada4 Implement ERC721 required functionality 2018-01-16 16:04:26 -03:00
5fc5ded661 Provide ERC721 required functionality interface 2018-01-16 16:04:26 -03:00
146a22cd96 Merge pull request #661 from facuspagnuolo/enhancement/organize_test_files
Organize test files following contracts folders structure
2018-01-16 14:52:46 -03:00
b925b2dae6 Organize test files following contracts folders structure 2018-01-16 13:03:35 -03:00
87f5916341 Separate ERC827 interface in another contract 2018-01-15 21:17:32 -03:00
8854966847 change throw for require in MessageHelper contract@ 2018-01-15 21:15:21 -03:00
685d2087ca Add increase and decrease approval functions to ERC827 with tests 2018-01-15 20:56:25 -03:00
7532dab17d Merge pull request #677 from ernestas2k/fix/error-testing-in-delayed-claimable#672
Fix error testing in DelayClaimable tests
2018-01-15 18:48:43 -03:00
73a8be1449 Merge pull request #676 from Shrugs/feat/solidity-highlighting-#671
feat: add solidity syntax highlighting directive, fixes #671
2018-01-15 18:42:00 -03:00
c9fff647f4 Merge branch 'master' into fix/error-testing-in-delayed-claimable#672 2018-01-15 23:35:26 +02:00
ec2f7ba8d1 Merge pull request #673 from Shrugs/feat/solium
Solium Integration, Linting Refactor
2018-01-15 18:34:55 -03:00
a4029e7472 Fix error testing in DelayClaimable tests 2018-01-15 23:28:31 +02:00
ad5edd329f feat: add solidity syntax highlighting directive, fixes #671 2018-01-15 16:24:18 -05:00
955517dc2e fix: add ignore directives to SampleCrowdsale and SimpleToken 2018-01-15 16:11:45 -05:00
3b48a671fd fix: solium errors - whitespace related 2018-01-15 16:11:45 -05:00
bd2f1773cd fix: solium errors - function-order only 2018-01-15 16:11:45 -05:00
e60aee61f2 fix: solium errors - blank-line only 2018-01-15 16:11:45 -05:00
b2e2d9ab1c fix: solium errors - indentation only 2018-01-15 16:11:45 -05:00
4d263b7fc3 fix: the result of 'npm run lint:sol:fix' 2018-01-15 16:11:45 -05:00
e0f3fea97f feat: add solium linting to travis, npm script 2018-01-15 16:07:34 -05:00
d4dc4b25c8 fix: remove warning on timestamp usage 2018-01-15 16:07:34 -05:00
c1244d6297 updated soliumrc - Solium v1 compatible 2018-01-15 16:07:34 -05:00
462c52bcbf Merge pull request #601 from elopio/test/math
test: add tests for max64 and min64 from Math
2018-01-15 18:05:19 -03:00
9f68c00855 Merge pull request #667 from spalladino/feature/655-safemath_docs
Add documentation to safemath functions
2018-01-15 18:03:09 -03:00
4dcf8f5bd0 Merge pull request #674 from frangio/add-missing-awaits
Add missing awaits in tests
2018-01-15 17:38:05 -03:00
ea1cb5c54e add missing awaits in tests 2018-01-15 17:27:45 -03:00
49b42e8696 Minor change in SafeMath sub documentation 2018-01-15 15:44:06 -03:00
beea818f4e Merge pull request #638 from LimelabsTech/master
BuyTokens getting the token amount from a function instead of just multiplication. Useful for making Crowdsales with bonus periods
2018-01-15 15:42:49 -03:00
13b75bd5af Merge branch 'master' into master 2018-01-15 15:32:39 -03:00
e911b4d556 Add findMethod function in ERC827Token test 2018-01-12 13:08:55 -03:00
7bd95b1e31 Overload ERC20 funcitons with new _data argument 2018-01-11 16:35:21 -03:00
4ecdf312df Change order of ERC20 methods and call in transferData and transferDataFrom 2018-01-11 13:56:52 -03:00
f36f8e96dc Delete SmartToken old docs 2018-01-11 13:53:21 -03:00
e57f4be1fb Rename SmartToken to ERC827 2018-01-11 13:52:36 -03:00
a806520d6f change SmartToken test to work with new linter rules 2018-01-11 12:57:30 -03:00
a4b1cd6e31 Add SmartToken contract with tests and documentation
add missing public identifier in approveData in SmartToken contract

remove constact from showMessage function in message helper contract

move Message helper contract to mocks folder

move SmartTokenMock contract to mocks folder
2018-01-11 12:57:30 -03:00
21297e2b2c Add documentation to safemath functions
Fixes #655
2018-01-11 11:12:13 -03:00
94697726f5 Merge pull request #664 from Shrugs/fix/pr-template-syntax
fixup: issue template mdown syntax
2018-01-11 00:57:22 -05:00
a58e3e151a fixup: pr template mdown syntax 2018-01-10 15:08:23 -05:00
790b3b20c2 Merge pull request #646 from Shrugs/feat/npm-lint-fix-#642
feat: add 'npm run lint:fix' script
2018-01-09 18:52:55 -03:00
ed6e51494e Merge pull request #660 from facuspagnuolo/bugfix/659_add_transfer_event_to_simple_token
Emit Transfer event on SimpleToken creation
2018-01-09 15:53:10 -03:00
17884e91a1 Emit Trasnfer event on SimpleToken creation 2018-01-09 15:34:05 -03:00
59cd714b84 Merge pull request #641 from Shrugs/feat/issue-templates-#639
feat: implement issue and pr templates
2018-01-08 15:17:25 -03:00
a24031854b Merge branch 'master' into master 2018-01-07 22:27:03 +02:00
6cd84ffceb feat: add 'npm run lint:fix' script 2018-01-05 11:01:18 -06:00
29edd4e15e feat: implement issue and pr templates 2018-01-05 11:00:37 -06:00
6af6efc198 Merge pull request #635 from AugustoL/test/ECRecoveryMock
Add ECRecoveryMock contract
2018-01-05 13:55:55 -03:00
586c88802d Changed constant to view and more expressive comment 2018-01-05 17:30:10 +02:00
edbc64f337 Add missing semicolon in ECRecovery test 2018-01-04 16:39:41 -03:00
c73861d8b3 Use test message in ECRecovery tests and fix typos 2018-01-04 15:51:55 -03:00
d78bcbbae5 change web3.eth.accounts for accounts in ECRecovery test 2018-01-04 15:51:55 -03:00
326df13bf3 Add ECRecoveryMock contract 2018-01-04 15:51:55 -03:00
7852583fde reverted package.json file 2018-01-04 15:49:59 +02:00
5993f5b371 reverted back the version 2018-01-04 11:44:07 +02:00
04946211a5 Using the new overridable function 2018-01-03 11:14:02 +02:00
2f2ef68652 Increased Minor Version 2018-01-03 10:59:53 +02:00
ebdba08218 Added overridable getTokenAmount function 2018-01-03 10:54:30 +02:00
a74b7bd4b1 Merge pull request #613 from federicobond/remove-duplicate-constructor
Remove duplicated constructor call in FinalizableCrowdsaleImpl
2018-01-02 16:48:06 -03:00
090e2fca16 Remove duplicated constructor call in FinalizableCrowdsaleImpl 2018-01-02 16:26:02 -03:00
dbe8898d00 Merge pull request #636 from OpenZeppelin/release/v1.5.0
v1.5.0
2018-01-02 15:25:34 -03:00
52b2a619c7 Merge pull request #603 from elopio/patch-1
fix typo: that -> than
2018-01-02 13:14:04 -03:00
58ecbd6104 fix typo: that -> than 2018-01-02 15:58:35 +00:00
9aa61ad273 Merge pull request #634 from Shrugs/fix/destructible-typo
fix: TokenDestructible typo fron->from
2018-01-02 11:07:09 -03:00
7aa6f21147 fix: TokenDestructible typo fron->from 2017-12-31 19:06:38 +04:00
323d1fa941 Refactor assert revert helper to encapsulate promises (#628) 2017-12-28 00:39:55 -03:00
4073cf6585 v1.5.0 2017-12-22 19:50:42 -03:00
4ce0e211c5 Merge pull request #604 from elopio/tests/fix-ReentrancyGuard
test: fix the mocks path in ReentrancyGuard test
2017-12-22 18:41:58 -03:00
9af6ad5ddf Merge pull request #610 from TalAter/master
Documented increaseApproval() and decreaseApproval()
2017-12-22 18:32:38 -03:00
2f336f7aaf Merge pull request #614 from him2him2/master
Update HTTP -> HTTPS
2017-12-22 18:02:15 -03:00
5751eac444 Merge pull request #617 from spalladino/feature/reenable-coverage
Re-enable solidity coverage
2017-12-22 17:27:19 -03:00
cda518d353 Merge pull request #624 from AugustoL/change-uint-tokentimelock
Use uint256 in TokenTimeLock contract
2017-12-22 12:32:19 -03:00
f446f5c5cd Use uint256 in TokenTimeLock contract 2017-12-22 10:34:29 -03:00
1455a5a942 Re-enable solidity coverage
- Upgrade version
- Re-enable in travis.yml
- Move mocks to contracts folder for instrumentation
2017-12-20 18:28:22 -03:00
207b92f63c Merge pull request #602 from nemild/patch-1
Consistent spellings of reentrant
2017-12-20 15:40:27 -03:00
b217ef6314 Update HTTP -> HTTPS
URLs were updated to use HTTPS protocol
2017-12-19 15:32:38 -08:00
687dc19a4a Documented increaseApproval() and decreaseApproval() 2017-12-14 20:14:58 +02:00
161f25fc12 Made spelling for 'reentrant' consistent in comment 2017-12-07 22:48:55 -08:00
4bb26c32b6 test: fix the mocks path in ReentrancyGuard test 2017-12-08 02:57:29 +00:00
d91f4d4bc1 Consistent spellings of reentrant
Changed `rentrancy_lock` variable to `reentrancy_lock`
2017-12-06 16:03:55 -08:00
ddcae6254e Merge pull request #600 from izetex/fix/burnable-token-inheritance
Burnable Token should be inherited from Basic Token issue#596
2017-12-06 12:25:35 -03:00
fdfd90e6a4 fix the eslint static check 2017-12-06 14:57:41 +00:00
f162638cde test: add tests for max64 and min64 from Math 2017-12-06 06:37:45 +00:00
8375b6085f Burnable Token should be inherited from Basic Token issue#596 2017-12-06 08:08:42 +03:00
83b941c76c Merge pull request #580 from Shrugs/feat/rbac
feat: RBAC authentication contract and role library
2017-12-04 12:30:38 -03:00
63c8751e06 fix: linter errors 2017-12-04 17:08:28 +02:00
306132f823 Merge pull request #597 from JesseBusman/master
There's no need to throw when burning 0 tokens
2017-12-04 11:15:30 -03:00
677d05743c feat: update event names for OZ standards and test them 2017-12-04 13:42:55 +02:00
aef0f63aee There's no need to throw when burning 0 tokens
Throwing when trying to burn 0 tokens is an unnecessary special case.
If another contract wants to burn() a variable amount, it should not be forced to deal with this special case of burning 0.
2017-12-03 12:08:53 +01:00
5e55569db6 fix: make roles private 2017-12-01 18:15:44 +02:00
9bb2c958ec feat: add adminAddRole, adminRemoveRole, and make hasRole/checkRole public 2017-12-01 18:15:44 +02:00
e931c1cbfc feat: RBAC authentication contract and role library 2017-12-01 18:15:44 +02:00
dd1fd0002a Merge pull request #581 from Shrugs/feat/minor-additions
Minor standards and cleanup additions.
2017-12-01 12:22:01 -03:00
ac3808885a fix: default to empty string for mnemonic 2017-12-01 13:43:25 +02:00
258c001f7f feat: add linting to travis script 2017-12-01 13:40:11 +02:00
d07bdccc0c feat: manually fix linting errors across tests 2017-12-01 13:40:09 +02:00
227a335399 feat: move mock solidity contracts to mocks/ folder 2017-12-01 13:39:13 +02:00
58abd66969 feat: rename all test files to include .test.js postfix 2017-12-01 13:37:12 +02:00
8662846838 feat: apply eslint --fix across project 2017-12-01 13:37:09 +02:00
6ea0577bfe feat: enable eslint 2017-12-01 11:44:41 +02:00
b9b26e1d8a feat: allow configuration of ropsten and ganache with env variables 2017-12-01 11:43:49 +02:00
887c1bb925 feat: more comprehensive gitignore 2017-12-01 11:43:49 +02:00
cc5e898250 Merge pull request #588 from BrandonGilchrist/feature/delayed-crowdsale-docs
Add docs for DelayedClaimable
2017-11-29 18:36:33 -03:00
1cef36b5c0 Merge pull request #585 from Shrugs/feat/only-npm
feat: remove yarn in favor of npm
2017-11-29 11:59:28 -03:00
c95be493c3 fix: remove engines 2017-11-29 14:11:04 +02:00
bddc8755c1 Add docs for DelayedClaimable 2017-11-28 15:04:42 -08:00
3ad555bb01 fix: remove duplicate npm ls 2017-11-28 13:21:22 +02:00
846b0714ad feat: remove yarn in favor of npm 2017-11-27 20:44:59 +02:00
f79f7b00e3 Merge pull request #582 from Shrugs/fix/split-payment-payable
fix: make SplitPayment payable by default
2017-11-27 12:54:12 -03:00
47585b1117 fix: make SplitPayment payable by default 2017-11-24 17:02:53 +02:00
b7e7c765e0 v1.4.0 2017-11-23 13:30:54 -03:00
9e1da49f23 sync yarn.lock with package-lock.json 2017-11-23 13:21:05 -03:00
c29dd086d3 Update to testrpc 6.0.1 and test fixes for revert opcode. 2017-11-23 13:06:05 -03:00
b9cbea1c9c Merge pull request #576 from ajsantander/master
Address new compiler warnings
2017-11-23 12:54:44 -03:00
b254b74b87 Merge pull request #577 from redsquirrel/patch-1
Minor formatting change
2017-11-23 12:47:51 -03:00
bb1736e376 Change visibility of fallbacks to external 2017-11-23 12:28:46 -03:00
11349835e9 Minor formatting change 2017-11-23 08:22:59 -06:00
c6e0edb268 Remove solidity warnings in tests 2017-11-23 10:57:36 -03:00
b50391862c Changes to remove warnings 2017-11-23 10:41:18 -03:00
0bcf0a2001 Merge pull request #573 from ajsantander/master
Update to truffle 4.0.0 and solc 0.4.18
2017-11-22 19:26:38 -03:00
0eaa5f50ac Disable solidity-coverage
This is required to update to truffle 4 and solc 0.4.18, see PR #573
2017-11-22 19:08:31 -03:00
ce86029f6a Update solidity version on test helpers 2017-11-22 19:00:13 -03:00
815d9e1f45 Replace constant with view/pure 2017-11-22 18:59:54 -03:00
e6213767fa Update all solidity versions to 0.4.18 2017-11-22 18:52:52 -03:00
f28c245a3c Update to truffle 4.0.0
had to up the gasLimit in test.sh to avoid an out of gas error when deploying the scripts
2017-11-22 18:52:52 -03:00
12303ceaf5 fix treatment of bignumber in CappedToken test 2017-11-22 15:27:52 -03:00
9001ce9d3a Merge pull request #515 from cwhinfrey/master
Create CappedToken, a capped MintableToken
2017-11-22 15:25:12 -03:00
492ef4a419 Merge pull request #571 from quantum13/patch-1
Small code style change
2017-11-22 14:33:01 -03:00
5f67dd7868 Merge pull request #574 from gakonst/master
Fix unused variable warning in `Standard Token.sol`
2017-11-22 14:32:19 -03:00
3c5a268da4 fixes #572 2017-11-22 12:55:11 +00:00
db5a12cfdd Merge pull request #506 from TalAter/fix/deprecated-throw-in-tests
Replace deprecated throw with assert in Solidity tests
2017-11-21 14:41:31 -03:00
03ad0efd29 Small code style change
http://solidity.readthedocs.io/en/develop/style-guide.html#other-recommendations
The visibility modifiers for a function should come before any custom modifiers.
2017-11-20 23:13:32 +03:00
5fc53b6f2f Replaced assert with require 2017-11-19 01:34:24 +02:00
99f3e26f83 Merge pull request #568 from frangio/readme-npm-init
Add npm init in README
2017-11-17 17:50:55 -03:00
151371cc86 add npm init in README 2017-11-17 17:34:36 -03:00
376208bd96 Merge pull request #566 from onbjerg/patch-1
Make coverage badge flat
2017-11-17 16:59:15 -03:00
11b63d4fc1 Revert alt text for coverage badge 2017-11-17 20:49:41 +01:00
39ae5b4cca Make coverage badge flat 2017-11-17 13:16:00 +01:00
670b843b63 Merge pull request #553 from limexp/fix/534-ci-versions-info
added versions output to Travis CI log #534
2017-11-16 15:16:09 -03:00
070d25dc9e Merge pull request #564 from spalladino/fix/travis-no-prs-notifications
Do not notify via Slack about PR build failures
2017-11-16 12:29:38 -03:00
9684ce76c5 Do not notify via Slack on PRs 2017-11-16 10:20:34 -03:00
d919f0dde2 Merge pull request #487 from limexp/fix/docs
fix docs issue #459 and align with README.md
2017-11-15 18:27:10 -03:00
689e18aab5 Merge branch 'master' into fix/docs 2017-11-15 18:19:12 -03:00
8765e2a53f Use instead of directly calling on 2017-11-15 16:14:28 -05:00
7a19bcf6d9 Merge pull request #505 from ZumZoom/patch-1
Finish minting should be called only once
2017-11-15 11:59:05 -03:00
088897150e Merge pull request #526 from amazingandyyy/patch-1
Update RefundVault.sol
2017-11-15 11:56:03 -03:00
34be16d939 Merge pull request #522 from emn178/feature/improve_mul
improve mul performance and reduce gas cost
2017-11-14 17:49:09 -03:00
14ae881e26 Merge pull request #544 from maraoz/timer-improvement
remove timer test helper
2017-11-14 17:24:42 -03:00
666a3a73e0 remove unused 'day' test variable 2017-11-14 12:50:43 -05:00
84bffb854a Merge pull request #477 from facuspagnuolo/feaure/create_detailed_erc20_interface
Create detailed ERC20 interface
2017-11-13 15:42:09 -03:00
365c875ced Create detailed ERC20 interface 2017-11-13 15:36:02 -03:00
7dd0ee6212 remove timer 2017-11-12 15:10:46 -05:00
7123faff9f added versions output to Travis CI log #534 2017-11-11 16:32:38 +03:00
61b5921ab2 Fix typo 2017-11-10 20:20:44 -05:00
e72c7ce91b Merge pull request #417 from abarmat/feature-splitpayment-contract
Feature SplitPayment contract
2017-11-10 18:45:56 -03:00
c4ca7f03e3 improve timer test helper 2017-11-10 13:29:58 -08:00
9be77ddd54 Merge pull request #469 from nedodn/patch-2
Update TokenTimelock.sol: Issue #464
2017-11-10 17:44:20 -03:00
70a17d0b96 Merge pull request #475 from et/patch-2
Add `npm init`
2017-11-10 17:31:58 -03:00
ad2282456e Merge pull request #478 from rudygodoy/patch-2
Fixes typos in documentation
2017-11-10 17:26:00 -03:00
fe3e360483 Merge pull request #482 from sohkai/patch-1
Small typo fixes for bounty docs
2017-11-10 17:24:26 -03:00
5a857fc1a7 Merge pull request #490 from Nedudi/master
Update SimpleToken.sol
2017-11-10 17:15:52 -03:00
c5cd35b2ea Merge pull request #504 from FloorLamp/patch-1
Update ecrecovery.rst
2017-11-10 17:07:16 -03:00
a808b0b03f Merge pull request #523 from thesved/patch-1
Math.sol is not used, not needed
2017-11-10 16:19:01 -03:00
4e8f422a81 Merge pull request #542 from spalladino/feature/travis-notifications
Add Slack notifications
2017-11-10 15:27:03 -03:00
070226d624 Add Slack notifications 2017-11-10 13:18:20 -03:00
2413f83504 Include 'revert' in expectThrow() helper 2017-11-10 11:41:17 -03:00
be692e59eb Update RefundVault.sol 2017-10-31 00:13:27 -07:00
e74652415f Math.sol is not used, not needed
Small thing, but the Math.sol is not really needed, since it is not used.
2017-10-30 11:07:26 +01:00
5ad07e1892 improve mum performance and reduce gas cost 2017-10-30 09:58:52 +08:00
575372f660 Add Capped Token tests 2017-10-25 23:58:36 -04:00
7a26a0ecf1 Add capped token contract 2017-10-25 23:57:21 -04:00
8e01dd14f9 Merge pull request #510 from doraemondrian/master
Use address(0) instead of 0x0
2017-10-24 16:46:05 -03:00
5088c64140 Merge pull request #503 from martriay/fix-missing-safemath
[TokenVesting] Add missing safemath ops
2017-10-23 12:53:25 -03:00
ac4a19dd7d Use address type 2017-10-23 03:11:14 -07:00
09b1926c41 Use address type 2017-10-23 03:10:40 -07:00
d7b67eca52 Use address type 2017-10-23 03:10:00 -07:00
e4427befbb Use address type 2017-10-23 03:08:30 -07:00
ca1babe1f7 Use address type 2017-10-23 03:06:51 -07:00
1d54b86a7c Replace deprecated throw with assert in Solidity tests 2017-10-17 21:02:47 +03:00
2d83c557b1 Finish minting should me called only once
Multiple calls to `finishMinting` will emit multiple `MintFinished` events which may be surprising if one rely on `MintFinished` event.
2017-10-17 16:24:16 +03:00
dfb9ebd647 Update ecrecovery.rst
Fix typo
2017-10-16 17:50:25 -04:00
b60e434e0b [TokenVesting] Add missing safemath ops 2017-10-16 03:48:32 -03:00
39d6c92069 Merge pull request #497 from martriay/token-vesting-fix
[TokenVesting] vestedAmount should return the historical vested amount
2017-10-13 16:46:37 -03:00
eb9f88bafc [TokenVesting] Remove unused variable 2017-10-13 16:20:24 -03:00
aa431dfb20 [TokenVesting] Increase released amount before transfer 2017-10-13 16:13:54 -03:00
fff8e040b7 [TokenVesting] vestedAmount returns the historical vested amount 2017-10-13 15:32:44 -03:00
74636b7333 [TokenVesting] Use SafeMath 2017-10-12 00:34:03 -03:00
647fc13963 Merge pull request #492 from frangio/fix-vesting-revoke
TokenVesting bugfix
2017-10-11 16:58:21 -03:00
d5e0714faf use safeTransfer 2017-10-11 16:31:31 -03:00
a184013d1e explicitly mark functions public 2017-10-09 19:08:32 -03:00
7d08c4da7f make TokenVesting variables public 2017-10-09 19:02:57 -03:00
01b92d1d56 fix a problem when revoke is called twice 2017-10-09 19:01:04 -03:00
790833e5d4 Update SimpleToken.sol 2017-10-08 04:26:21 +03:00
2cb2799a51 align docs developer-resources.rst with README.md 2017-10-07 23:44:43 +03:00
9dcf37dd19 align docs getting-started.rst with README.md 2017-10-07 23:37:37 +03:00
0d89e99ceb Fix contracts path issue 2017-10-07 23:24:23 +03:00
a5a1be7219 Fixing docs issue #459 2017-10-07 23:21:58 +03:00
5aba967db9 Merge pull request #476 from martriay/add-token-vesting
Add token vesting
2017-10-05 18:44:39 -03:00
ffd1090718 [TokenVesting] Remove VestedTokenMock 2017-10-04 18:08:36 -03:00
22b9263674 [TokenVesting] Remove VestedToken and LimitedTranferToken 2017-10-04 14:52:55 -03:00
d21d35ca6f [TokenVesting] Fix test. 2017-10-04 14:52:31 -03:00
4e39f50aec [TokenVesting] Remove unnecessary instatiation on test. 2017-10-04 14:52:31 -03:00
9e0e80e820 [TokenVesting] Allow instantiation of already started vesting contracts. Improve comments' wording. 2017-10-04 14:52:31 -03:00
562fb6945f [TokenVesting] Rename events according to convention 2017-10-04 14:52:31 -03:00
822de45bfc [TokenVesting] Add a start parameter to constructor to defer vesting 2017-10-04 14:52:30 -03:00
bd56163900 [TokenVesting] Fix vestedAmount calculation. Linearity test watches beneficiary balance over vestedAmount 2017-10-04 14:52:30 -03:00
696615d392 [TokenVesting] Add linear release test 2017-10-04 14:52:30 -03:00
645edfc936 [TokenVesting] Fix should-revoke test 2017-10-04 14:52:30 -03:00
a227b212f5 [TokenVesting] Add tests 2017-10-04 14:52:30 -03:00
c11265e694 [TokenVesting] Add events 2017-10-04 14:52:30 -03:00
6344a76f83 add pending tests 2017-10-04 14:52:30 -03:00
3da7c31484 add revocable flag 2017-10-04 14:52:30 -03:00
998c72ab5b add preconditions to constructor 2017-10-04 14:52:30 -03:00
00f323d132 add shortcut for vestedAmount after vesting end 2017-10-04 14:52:30 -03:00
80e591f487 add TokenVesting contract 2017-10-04 14:52:30 -03:00
1333f45cdc Add missing code blocks to bounty docs 2017-10-01 22:34:58 -04:00
2ad88b59f6 Small indenting fix for bounty docs 2017-10-01 22:27:42 -04:00
a9055f5ce2 Fixes typos 2017-09-29 14:55:18 -05:00
9b0e89c4bf Add npm init
If you don't do this, you'll receive this error:

```
❯ zeppelin npm install zeppelin-solidity
npm WARN saveError ENOENT: no such file or directory, open '/Users/et/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/et/package.json'
npm WARN et No description
npm WARN et No repository field.
npm WARN et No README data
npm WARN et No license field.

+ zeppelin-solidity@1.3.0
updated 1 package in 0.677s
```
2017-09-28 17:18:47 -06:00
27f8609ac9 Update TokenTimelock.sol: Issue #464
Removed deprecated function claim() as per Issue #464.
2017-09-27 14:07:08 -05:00
5cf503673f Merge pull request #466 from phiferd/master
Using require for Token preconditions
2017-09-25 11:53:50 -03:00
3837319141 Adding some additional tests 2017-09-23 17:06:14 +08:00
e70dd18734 Moving business logic preconditions to the beginning of the function. 2017-09-23 11:57:29 +08:00
158a7a881d Merge pull request #460 from dmx374/patch-3
Add explicit visibility
2017-09-22 17:32:39 +02:00
725ed40a57 v1.3.0 2017-09-21 14:18:08 -03:00
3733c069c9 Add explicit visibility 2017-09-19 08:29:03 +02:00
1df75a951f Merge pull request #446 from jakub-wojciechowski/master
Make approve method compliant with ERC20
2017-09-18 18:38:37 -03:00
adfd8fb6a9 Warning in approve method documentation. 2017-09-18 18:38:05 -03:00
98f672b534 Make approve method compliant with ERC20 2017-09-18 18:38:05 -03:00
e9068859b6 Merge pull request #448 from SylTi/fix/small-fixes
A bunch of small fixes
2017-09-18 18:18:55 -03:00
1203a2473d add whenNotPaused modifier to all of PausableToken functions that modify it's state. Fix #401 2017-09-18 22:49:22 +02:00
4a1ff913ab replace var by uint256 in StandardToken. Fix #432 2017-09-18 22:46:52 +02:00
83918cad4b change approve() to conform to ERC20. Fix #438 2017-09-18 22:46:52 +02:00
d3c5ce268f Merge pull request #260 from yondonfu/feature/merkleproof
Merkle proof library with tests and docs
2017-09-18 16:47:17 -03:00
f60c5ad88a Merge pull request #445 from frangio/fix-leftover-testrpc
Properly kill background testrpc instance
2017-09-18 15:54:42 -03:00
bcda5bfe9b Merge branch 'master' into feature/merkleproof 2017-09-18 14:01:10 -04:00
33eb8b1da5 Merge pull request #457 from sot528/fix-typo
Just fix typo.
2017-09-18 14:26:21 -03:00
b069827bad fix typo. 2017-09-19 01:57:50 +09:00
74e416f04f Merge pull request #450 from dmx374/master
Explicit public visibility on methods
2017-09-18 12:58:34 -03:00
b395b06b65 Explicit public visibility on methods 2017-09-18 12:57:46 -03:00
bd84db735d Merge pull request #450 from aupiff/master
removing trailing whitespace
2017-09-18 12:01:22 -03:00
bd99b207c9 Merge pull request #454 from economicnetwork/master
comments on vesting
2017-09-18 11:46:48 -03:00
2438557255 explain cliff 2017-09-18 12:41:54 +07:00
9f1826d83e vesting: more corrections on comments 2017-09-18 12:22:23 +07:00
676f5f6931 comments on vesting 2017-09-18 12:18:10 +07:00
6d8bb497c8 removing trailing whitespace 2017-09-16 10:20:06 -04:00
5fd8684a5a properly kill background testrpc instance 2017-09-14 15:40:14 -03:00
1737555b0d Merge pull request #439 from frangio/fix-436
Remove indexed declaration of value in Burn event
2017-09-11 12:28:30 -03:00
eda63c75c4 Merge pull request #440 from spalladino/fix/simple_token_initial_supply
Fix INITIAL_SUPPLY in SimpleToken example
2017-09-11 12:27:35 -03:00
61f62eb3c7 Fix INITIAL_SUPPLY in SimpleToken example
Use token decimals
2017-09-11 12:13:19 -03:00
f96ebfca31 cosmetic changes to BurnableToken 2017-09-11 12:11:00 -03:00
fac580d1a9 remove indexed declaration of uint event parameter 2017-09-11 12:08:23 -03:00
dc1017c929 Simplify implementation using similar interface as PullPayment contract 2017-09-09 12:04:31 -03:00
07b688a0e6 Merge pull request #430 from frangio/fix-unchecked-transfer
Use SafeERC20 to transfer tokens safely
2017-09-07 20:33:43 -03:00
20187f2970 use SafeERC20#safeTransfer 2017-09-07 20:04:48 -03:00
84be318ca9 Merge pull request #424 from eugene-babichenko/transfer-ownership-event
Add OwnershipTransferred event to Ownable contract and its derivatives
2017-09-07 11:59:29 -03:00
5035718e4b fixed wrong call order in Ownable.transferOwnership 2017-09-07 11:59:36 +03:00
fdc8fbaa45 Merge pull request #428 from frangio/fix-425-pausable-docs
Fix Pausable documentation
2017-09-06 16:25:37 -03:00
99887da49a fix Pausable documentation 2017-09-06 15:07:12 -03:00
7a36a6c92a fix calls to OwnershipTransferred 2017-09-06 10:31:23 +03:00
6beac0f215 add previousOwner field to OwnershipTransferred event 2017-09-06 10:29:25 +03:00
b59469c151 fire OwnershipTransferred event when the owner of an Ownable contract instance actually changed 2017-09-05 18:32:07 +03:00
b07466a477 Merge pull request #420 from sh4ka/patch-1
Fix docblock syntax
2017-09-01 11:25:50 -03:00
0bd22e78d3 Fix docblock syntax 2017-09-01 14:03:31 +01:00
69e83e5086 Add a SplitPullPayment contract that combines distribution of funds and delayed withdrawal from each party 2017-08-29 12:06:24 -03:00
8336785a9b Add a SplitPayment contract to distribute funds among multiple beneficiaries 2017-08-29 12:06:23 -03:00
f073352632 Merge pull request #416 from frangio/add-comment-basictoken-throw
Add comment making explicit that transfer throws without enough balance
2017-08-29 12:05:14 -03:00
aad25205cd add comment making explicit that SafeMath.sub can throw 2017-08-29 11:51:41 -03:00
dcdc453a55 Merge pull request #413 from frangio/add-safe-erc20
Add SafeERC20 helpers
2017-08-28 19:43:32 -03:00
5636575327 Merge pull request #415 from frangio/merge-411-manually
Check that destination of token transfers is not 0x0
2017-08-28 19:41:29 -03:00
00f80c726a fix reference to mock contract 2017-08-28 19:31:19 -03:00
74db6c2b3b add missing test for error when doing transferFrom to 0x0 2017-08-28 19:31:19 -03:00
d095ba84bf Add tests to check transfers to 0x0 fail 2017-08-28 19:31:19 -03:00
209e2de93b Fix for #400: Check that destination of token transfers is not 0x 2017-08-28 19:31:07 -03:00
c37c233d22 add SafeERC20 tests for succeeding operations 2017-08-28 19:27:56 -03:00
7b463769a5 explain how to use SafeERC20 2017-08-28 17:34:25 -03:00
c7636bdc4c add safe ERC20 helpers 2017-08-28 17:32:18 -03:00
307d34e05a Merge pull request #407 from frangio/rename-truffle-config
Rename Truffle config file
2017-08-25 20:47:43 -03:00
69e21dacb8 rename truffle.js to truffle-config.js 2017-08-25 20:08:54 -03:00
f27a1ac040 update solidity-coverage to 0.2.2 2017-08-25 20:08:54 -03:00
af6fdae3dd Merge pull request #348 from SylTi/refactor/HasNoToken
refactor HasNoTokens.sol to extract reclaimToken
2017-08-24 20:24:34 -03:00
6ae22e084a Merge pull request #406 from frangio/update-testrpc-4.1.1
Update testrpc to 4.1.1
2017-08-24 19:41:31 -03:00
d463b26709 bump testrpc to 4.1.1 2017-08-24 18:36:03 -03:00
271e6192e8 remove moment.js from package-lock 2017-08-24 18:36:03 -03:00
51906bae6c refactor 2017-08-24 21:42:31 +02:00
406004a99a refactor HasNoTokens.sol 2017-08-24 21:42:31 +02:00
b50894aabe Merge pull request #405 from androolloyd/fix/396-make-decimals-uint8-in-token-example
changed decimal to be uint8 so that it matches the ERC20 specification.
2017-08-24 11:12:29 -03:00
d6f07267ee Merge pull request #403 from rstormsf/patch-2
Remove confusing comment left from FinalizableCrowdsale
2017-08-24 11:07:51 -03:00
1827cbfd2a changed decimal to be uint8 so that it matches the ERC20 specification. 2017-08-24 10:41:41 -03:00
a0c0cb66c5 Remove confusing comment left from FinalizableCrowdsale
AFter this PR 
https://github.com/OpenZeppelin/zeppelin-solidity/pull/364
the comment was left.
2017-08-23 18:57:22 -07:00
47aa4bbf8f Merge pull request #394 from sot528/fix/remove-coverall-script
Removed coveralls script from package.json
2017-08-22 20:48:37 -03:00
33de70158c remove coveralls script from package.json 2017-08-22 10:15:21 +09:00
f45a4e8243 Merge pull request #392 from OpenZeppelin/revert-376-bugfix/windowsIncompatibilty
Revert Truffle config renaming
2017-08-21 16:30:02 -03:00
ac75f4e2ed Revert "[bugfix] windows incompatibilty" 2017-08-21 16:04:30 -03:00
631748480e Merge pull request #391 from rudygodoy/pr-224-tests
Added tests for PR #224
2017-08-21 15:47:02 -03:00
3d5c759d62 Merge pull request #388 from duckranger/patch-1
Update limitbalance.rst
2017-08-21 15:36:51 -03:00
2e0440e549 Merge pull request #389 from duckranger/patch-2
Update pullpayment.rst
2017-08-21 15:36:31 -03:00
86beb5b730 Merge pull request #376 from SylTi/bugfix/windowsIncompatibilty
[bugfix] windows incompatibilty
2017-08-21 15:34:40 -03:00
289fd87ef8 Tests increase and decrease allowance for spender
- Spender starts with 0 tokens allowed to spend
- Spender is granted 50, then decreased it's allowance by 10

Refs PR #224
2017-08-20 23:20:09 -05:00
8b11035b39 Indentation refactoring. 2017-08-20 23:13:39 -05:00
21f251eafb Removed onlyPayloadSize modifier 2017-08-20 23:11:23 -05:00
e7b1c33955 Update StandardToken.sol
Added increaseApproval and decreaseApproval to increase / decrease the approval in 1 transaction.
2017-08-20 23:10:28 -05:00
1da0467820 Update pullpayment.rst
Fixed typo
2017-08-20 22:00:42 +12:00
05609de044 Update limitbalance.rst
Fixed typo
2017-08-20 21:58:27 +12:00
02fb43ff52 Merge pull request #386 from frangio/remove-packagejson-main
Remove main field from package.json
2017-08-19 18:35:14 -03:00
1626c0095f Merge pull request #369 from frangio/parallelize-travis
Make Travis run tests and coverage in parallel
2017-08-19 18:34:09 -03:00
341ce621a9 remove main field from package.json 2017-08-19 18:22:42 -03:00
52efe2412c Merge pull request #384 from frangio/fix-pausabletoken-documentation
Fix PausableToken documentation
2017-08-19 16:40:13 -03:00
84e3e76bb8 fix PausableToken documentation 2017-08-19 16:35:46 -03:00
1d162e95c5 Merge pull request #377 from yaronvel/master
fix for issue 375: transferFrom allows sending to self more than self balance
2017-08-19 16:26:46 -03:00
060843d912 Merge pull request #380 from skywinder/typo-fix
Fixed typos in documentation
2017-08-19 16:24:31 -03:00
d3bc0a4ef7 Merge pull request #379 from skywinder/patch-1
Fixed typo in documentation
2017-08-19 16:22:58 -03:00
d1a82dde63 Merge pull request #373 from Neurone/patch-1
Fix mispelled words (#371)
2017-08-19 16:06:57 -03:00
99efe80c61 fixed typos in standart token doc 2017-08-18 15:35:13 +03:00
b12db57f34 Fixed typo
recieve -> receive
2017-08-18 15:25:15 +03:00
9333fec5f1 fix to issue 375 2017-08-17 21:56:11 +03:00
6f94af9264 fix windows incompatibilty 2017-08-17 12:34:43 +02:00
0ed98ea9b9 Merge pull request #368 from jakub-wojciechowski/master
Remove moment.js dependencies
2017-08-16 10:17:53 -03:00
0b66144942 Merge pull request #374 from rstormsf/patch-1
Remove beta tag from truffle
2017-08-16 01:12:51 -03:00
b91a3eded3 Remove beta tag from truffle
truffle@beta uses old solc 0.4.11
truffle main branch uses most up to date 0.4.15
2017-08-15 14:55:37 -07:00
7c9c0f6538 Fix for mispelled words (#371) 2017-08-15 23:08:41 +02:00
0d6846a882 Remove moment.js dependencies - updates after review 2017-08-15 12:31:49 +02:00
84a68e0c25 Merge pull request #364 from frangio/remove-crowdsale-finish-minting
Remove token.finishMinting() from default finalization
2017-08-14 14:57:22 -03:00
e82fa4eae0 parallelize tests and coverage in travis 2017-08-14 13:37:53 -03:00
c79c6d76d8 unify test and coverage scripts 2017-08-14 13:37:11 -03:00
36452136f1 add test for finishMinting 2017-08-13 22:41:25 -03:00
17cfb0fc78 Remove moment.js from package dependencies 2017-08-14 00:36:01 +02:00
e86ac90853 Refactor and remove moment.js usages 2017-08-14 00:27:09 +02:00
99e0f5b5cb Refactor time manipulation in TokenTimelock tests 2017-08-14 00:21:57 +02:00
4fc6bb7977 remove token.finishMinting() from default finalization 2017-08-12 22:02:44 -03:00
6e66ba321e Merge pull request #363 from frangio/sync-yarn-npm-locks
Sync yarn.lock file with package-lock.json
2017-08-12 19:26:58 -03:00
2c2067ecc1 sync yarn.lock file with package-lock.json
1. deleted node_modules
2. ran `npm install`
3. deleted yarn.lock
4. ran `yarn import`
2017-08-12 18:57:32 -03:00
e6a7a978d1 Merge pull request #362 from cgewecke/bump-solidity-coverage
Upgrade solidity coverage to ^0.2.1
2017-08-12 18:42:55 -03:00
3e02f45f67 Upgrade solidity coverage to ^0.2.1 2017-08-12 14:20:14 -07:00
b972f43513 Merge pull request #345 from SylTi/master
Add Transfer event when token is minted
2017-08-11 14:47:43 -03:00
30d02b1c78 Merge pull request #357 from frangio/fix-hdwallet-dependency
Move truffle-hdwallet-provider to devDependencies
2017-08-11 13:13:11 -03:00
479d01101d move truffle-hdwallet-provider to devDependencies 2017-08-11 11:30:44 -03:00
2b079136fb Merge pull request #353 from jakub-wojciechowski/master
Change crowdsales to use timestamps instead of block numbers #350
2017-08-10 12:42:55 -03:00
46c5759b88 Introduce increaseTimeTo helper method. 2017-08-10 16:23:52 +02:00
7c883b6368 Duration helper and eliminated hardcoded periods 2017-08-10 13:13:49 +02:00
69daed7746 Merge pull request #341 from lsaether/master
Added contracts/token/BurnableToken.sol
2017-08-09 17:22:58 -03:00
0b9afefa93 Merge pull request #339 from abarmat/typo-1
Fix typo in SafeMath doc
2017-08-07 17:25:36 -03:00
52490b92bf Merge pull request #340 from abarmat/style-1
Add missing parentheses in modifier
2017-08-07 17:25:01 -03:00
2261039d52 Simplify advanceBlock in tests 2017-08-07 18:29:09 +02:00
24323d3ce3 MerkleTree util class hashes elements 2017-08-07 11:23:52 -04:00
c6e055689b Change crowdsales to use timestamps instead of block numbers #350 update example 2017-08-06 16:42:16 +02:00
2b5192b9ce Change crowdsales to use timestamps instead of block numbers #350 update derived crowdsales 2017-08-06 16:41:43 +02:00
77dfcb6e23 Change crowdsales to use timestamps instead of block numbers #350 2017-08-06 16:40:19 +02:00
4fe837704b Add Transfer event when token is minted to be fully ERC20 compliant &
tests
2017-08-05 00:14:01 +02:00
cf58330936 added tests for BurnableToken 2017-07-31 17:23:23 -07:00
287b873add Merge pull request #338 from jeremygrenier/master
Remove return values of pause() and unpause() of Pausable
2017-07-31 11:58:56 -03:00
115e7afe0b Merge pull request #342 from jakub-wojciechowski/master
Add complex crowdsale example #331
2017-07-31 11:42:38 -03:00
a9e1fcd623 Add complex crowdsale example #331 requested changes 2017-07-29 09:00:54 +01:00
04e0b2e5c2 Add complex crowdsale example #331 tests 2017-07-29 00:29:59 +01:00
2403508e1b Add complex crowdsale example #331 2017-07-29 00:29:17 +01:00
b414545b6e fixed typos XP 2017-07-28 16:11:27 -07:00
3296471bda Added contracts/token/BurnableToken.sol 2017-07-28 16:07:04 -07:00
eb5b6252bc Add missing parentheses in modifier 2017-07-28 20:59:11 +02:00
e5da857d4f Fix typos in SafeMath doc 2017-07-28 20:53:55 +02:00
09a8da5d6a Remove return values of pause() and unpause() of Pausable 2017-07-28 17:35:27 +02:00
863ad48a81 Check proof length multiple of 32. Use keccak256 instead of sha3 2017-07-28 10:38:32 -04:00
de0e6ba222 Merge pull request #333 from frangio/examples
Move examples to separate directory
2017-07-26 20:22:20 -03:00
91e5a925d9 Merge pull request #334 from OpenZeppelin/upgrade/truffle-3.4.6
Upgrade truffle to 3.4.6
2017-07-26 19:33:01 -03:00
5e7c168b25 Fix missing storage keyword warnings 2017-07-26 17:23:20 -03:00
6fccd202fe Fix invalid number of args for solidity function errors in tests 2017-07-26 17:20:28 -03:00
18e98fbba8 Upgrade version of Truffle to 3.4.6 2017-07-26 16:36:13 -03:00
a799d218fd add constant qualifier 2017-07-26 16:12:05 -03:00
9f0cbd3303 move example contract 2017-07-26 16:12:05 -03:00
93fb8f35a8 Merge pull request #328 from frangio/remove-multisig
Remove MultisigWallet in favor of ConsenSys/MultiSigWallet
2017-07-24 19:13:23 -03:00
2303fd51a3 Merge pull request #329 from frangio/fix-test-script-cleanup
Fix test script cleanup and portability
2017-07-24 19:06:08 -03:00
910fc4915e Merge pull request #330 from frangio/coveralls-notification
Remove coveralls token
2017-07-24 18:00:27 -03:00
002acb984e remove coveralls token from repository 2017-07-24 17:23:24 -03:00
bebe704688 use portable shebang line 2017-07-24 13:57:42 -03:00
9a006f3a68 add check to see if process is running
because when we interrupt the tests via ^C, the signal also kills the
background process
2017-07-24 13:57:34 -03:00
58e2e4d742 remove MultisigWallet in favor of ConsenSys/MultiSigWallet 2017-07-24 13:26:48 -03:00
60bc6a6da5 Merge pull request #327 from jakub-wojciechowski/master
fix testing error throwing
2017-07-22 22:17:32 -03:00
b3f60b9320 refactor testing error throwing 2017-07-22 21:40:01 +01:00
e9cf6dfb60 Merge pull request #323 from pooleja/fix/ownable_error
Fix/ownable error - Silent transferOwnership Failure
2017-07-22 15:57:45 -03:00
5e7847537a fix testing error throwing 2017-07-22 11:46:49 +01:00
64787b1ac5 Add semicolon to match coding standards 2017-07-21 23:07:50 -07:00
58fdb956b5 Add assert to prevent regression 2017-07-21 23:04:50 -07:00
4d91118dd9 Merge pull request #320 from cgewecke/coverage-badge
Minor coverage maintenance
2017-07-21 16:06:23 -03:00
ed872ca0a1 Minor coverage maintenance 2017-07-21 11:25:53 -07:00
1bb1d41beb Merge pull request #281 from rudygodoy/master
Tests refactoring and typo fixes
2017-07-21 11:57:13 -03:00
1db46aa5d5 Merge pull request #292 from jakub-wojciechowski/test/pausable
Test if unpause prevents events allowed in paused state
2017-07-21 11:39:42 -03:00
c991eaf916 Merge pull request #325 from frangio/refactor/test-script
Refactor test script
2017-07-21 11:13:40 -03:00
86a69fd6d6 refactor test script
- fix status code (script exited with success even with failing tests)
- clean up and explain things
2017-07-20 18:58:31 -03:00
6735a3ccd6 Renamed tAMOUNT to much friendly amount 2017-07-20 16:01:41 -05:00
6d565ef841 Fix auto-formatting 2017-07-20 10:58:16 -07:00
b2e36314cb Add requirement for address to not be 0 and throw error 2017-07-20 10:51:57 -07:00
6904f12032 Merge with upstream/master 2017-07-20 07:01:58 -05:00
c3a30e9be3 Merge pull request #318 from BrianGuo/master
changed instances of uint to uint256
2017-07-19 15:54:53 -03:00
93b953fb48 changed instances of uint to uint256; fixes issue #226 2017-07-19 09:59:46 -04:00
e2fdf09e9b v1.2.0 2017-07-18 15:07:10 -03:00
4f44427966 Added function helper, few changes on ECRecover lib 2017-07-18 11:31:30 -03:00
f8c0fab5d8 Fixed tests and few changes on contract comments 2017-07-18 11:31:30 -03:00
478d1b1a93 Removed safeRecover, using ecrecover method instead, recovering signature from entire hash 2017-07-18 11:31:30 -03:00
a68eaa4e2d Added NatSpec documentation on ECRecovery contract 2017-07-18 11:31:30 -03:00
68c2bcb9dd Removed .only on ECRecovery tests 2017-07-18 11:31:30 -03:00
635c04378d Removed ECRecovery mock contract, ECRecovery funcions are public constants 2017-07-18 11:31:30 -03:00
227c7aae0f added check to ret boolean on ECRecovery 2017-07-18 11:31:30 -03:00
641b751385 Fix ECRecovery contract indentation
Fix ident on github

Fix ident github

Fix ident on github
2017-07-18 11:31:30 -03:00
4201d50dcf ECRecovery library added with test and docs 2017-07-18 11:31:30 -03:00
b05fb9c200 Update ownable.rst
Change the name of the function in the docs to the actual name in the contract source To prevent misunderstandings.
2017-07-17 21:37:59 -03:00
4f34d41523 Fixing typo. 2017-07-17 21:37:32 -03:00
91fc295a42 Updated reference to Ownable contract. 2017-07-17 21:37:32 -03:00
67d3a759a7 leave weiAmount after PR comments 2017-07-17 21:36:09 -03:00
950b6a5e56 sanity check for RefundableCrowdsale: goal > 0 2017-07-17 21:36:09 -03:00
db40fd314a sanity check for CappedCrowdsale: cap > 0 2017-07-17 21:36:09 -03:00
6035bd522b simplify crowdsale weiRaised update 2017-07-17 21:36:09 -03:00
b8884687df fix off by one error in VestedToken 2017-07-17 21:34:38 -03:00
18581f138f converted if() throw convention to require()/assert()/revert() 2017-07-17 15:35:09 -03:00
f3867f8477 Merge pull request #315 from joeykrug/patch-1
Added Constant to SafeMath functions as they don't modify storage
2017-07-15 15:52:36 -03:00
353285e5d9 Added Constant to SafeMath functions as they don't modify storage 2017-07-15 11:37:35 -07:00
a56bcbf8fd Correctly call super.transferableTokens
Fix #307
2017-07-14 18:17:09 -03:00
81297fac88 Merge pull request #308 from frangio/fix/erc20
Make ERC20 and token contracts conform to standard
2017-07-13 17:28:50 -03:00
6331dd125d fix ERC20 to conform to standard 2017-07-13 12:05:45 -03:00
f8790c1ed7 Merge pull request #304 from cgewecke/fix-coveralls
Fix coverage
2017-07-10 23:24:45 -03:00
5afbdf00db Fix coverage 2017-07-10 15:45:12 -07:00
322a9598ab Merge pull request #289 from ezynda3/master
update according to changes in #288
2017-07-06 11:07:13 -03:00
ba86e8e095 Merge pull request #296 from frangio/fix/293-tokentimelock-claim
Add TokenTimelock#release function that anyone can call
2017-07-05 11:47:15 -03:00
5e423bc353 add release function, deprecate claim 2017-07-05 11:24:59 -03:00
6eac859781 Test if unpause prevents events allowed in paused state 2017-07-03 17:06:47 +01:00
f2c2c01f8e Merge branch 'master' of github.com:OpenZeppelin/zeppelin-solidity 2017-07-02 15:50:40 -07:00
7434b3d6d2 v1.1.0 2017-07-02 18:53:32 -03:00
63b5fc5971 Merge pull request #290 from frangio/fix/safemath-references
Fix references to SafeMath in crowdsale contracts
2017-07-02 18:50:29 -03:00
f507a0ea29 fix references to SafeMath in crowdsale contracts 2017-07-02 18:39:51 -03:00
c254d8703d update according to changes in #288 2017-07-02 14:33:15 -07:00
981ec2dbdc v1.1.0 2017-07-02 18:27:18 -03:00
d5a75362ec Merge pull request #288 from frangio/refactor/math
Move SafeMath and create Math library for assorted operations
2017-07-02 18:13:47 -03:00
e748c3ea36 Merge pull request #283 from OpenZeppelin/crowdsale
Add Crowdsale contracts
2017-07-02 17:59:19 -03:00
421ed4f8ab fix references to max and min functions 2017-07-02 17:56:34 -03:00
0b1f08043b change Math to a library instead of a contract 2017-07-02 17:56:10 -03:00
759f8de81f fix import directories 2017-07-02 17:52:44 -03:00
96b550b722 Merge pull request #287 from jakub-wojciechowski/test/day-limit
Added new test for a day passed scenario to the DayLimit contract
2017-07-02 17:37:28 -03:00
b961eea89d fix claimRefund precondition 2017-07-02 17:10:11 -03:00
d2dd6e40b6 added new test for a day passed scenario to the DayLimit contract 2017-07-02 21:06:58 +01:00
070bcbcdbd rename purchaseValid to validPurchase 2017-07-02 17:05:06 -03:00
46fe7ee76d guard against beneficiary == 0x0 2017-07-02 16:51:26 -03:00
ba383a6d20 refactor max and min out of SafeMath 2017-07-02 13:01:55 -03:00
a66f5f8f03 format SafeMath documentation as NatSpec 2017-07-02 13:00:23 -03:00
262b7dd7dd Merge pull request #285 from frangio/feature/token-timelock
Add a TokenTimelock contract
2017-06-30 23:14:24 -03:00
5d847ed4d9 tweak TokenTimelock documentation 2017-06-30 21:28:45 -03:00
b3ca0c73b3 add a TokenTimelock contract 2017-06-30 21:25:59 -03:00
d6a45ef14e Merge pull request #282 from jasonbellamy/fix/standard-contract-docs-typo
fix(token): typo in documentation
2017-06-30 18:31:53 -03:00
54d74b1c26 rename canBuy to purchaseValid 2017-06-30 17:54:26 -03:00
657c56c650 remove unecessary whitespace 2017-06-30 17:54:07 -03:00
50a903a62d use npm test script for travis 2017-06-30 17:40:34 -03:00
0791e6639a add extra arguments to test command for development testing 2017-06-30 15:52:11 -03:00
59e9609926 remove CrowdsaleToken
it is superseded by the new crowdsale contracts
2017-06-30 15:50:47 -03:00
fadb2cf47e add tests for crowdsale contracts 2017-06-30 15:50:47 -03:00
4d55d8fa8e give more balance to testrpc accounts
includes fix to MultisigWallet test because bigger balances result in
floating point errors (see #204)
2017-06-30 15:50:47 -03:00
e31abffcb6 fix(token): typo in documentation
Implemantation -> Implementation
2017-06-30 14:40:15 -04:00
cd47fbe953 Improve Crowdsale#rate documentation 2017-06-30 11:23:28 -03:00
42c6392533 fix(token): typo in documentation 2017-06-30 00:41:12 -04:00
3c9638b62e Refactoring to not DRY.
The latest test case is not affected since the aproval is for
accounts[1], which does the transaction, and it is independent of
the amount of tokens that accounts[0] might have.
2017-06-29 13:18:54 -05:00
60ef284a9a Typo in variable, using global tAMOUNT for the latest test case. 2017-06-29 13:13:53 -05:00
b40a01e97b Small refactoring to not DRY 2017-06-29 13:12:58 -05:00
34e3ce4ab4 Typo fix: avaible -> available 2017-06-29 12:44:14 -05:00
4d6b48f39e Typo fix. standart -> standard 2017-06-29 12:40:26 -05:00
de99e7bf34 Prevent DRY 2017-06-29 12:31:32 -05:00
3430c7a289 Merge pull request #280 from rstormsf/fix/revert_inheritance_order
change inheritance order for StandardToken and PausableToken
2017-06-29 10:40:43 -03:00
daf1784be4 change inheritance order for StandardToken and PausableToken 2017-06-28 22:15:51 -07:00
de92a02127 Add Crowdsale contracts 2017-06-27 18:34:04 -03:00
549590d105 Refactored to prevent DRY with beforeEach().
Refs# 259
2017-06-26 17:32:34 -05:00
82ca385725 Merge pull request #277 from frangio/fix-261
Remove all checks for short address attack
2017-06-26 15:32:56 -03:00
e33d9bb41b remove all checks for short address attack (fixes #261) 2017-06-26 15:11:54 -03:00
79b3a1b1a2 Merge pull request #273 from jooray/patch-1
Fix typo in StandardToken allowance documentation
2017-06-22 13:15:28 -03:00
c6a3c29eb4 Merge pull request #272 from rstormsf/Removal-of-install-script
Removes install script
2017-06-22 10:34:07 -03:00
dd34d8df0f Fix typo in StandardToken allowance documentation 2017-06-22 15:33:34 +02:00
80d052d43f Fixes #253 2017-06-21 17:34:43 -07:00
710f77dfe1 Merge pull request #269 from rstormsf/uint256
change uint to uint256
2017-06-20 12:23:52 -03:00
b1e504d6c6 change uint to uint256 2017-06-19 18:55:09 -07:00
7deaee04c8 Merge pull request #263 from DaveAppleton/master
assert is now built in
2017-06-17 16:36:56 -03:00
2020d56ba4 assert is now built in 2017-06-17 11:10:30 +08:00
a49fe53fa1 Merge pull request #258 from mbrix/master
fixed typo
2017-06-15 13:52:34 -03:00
bc3db5d4c1 Fix weird indent issue for inline assembly 2017-06-15 11:13:37 -04:00
30e202313d Fix indentation in MerkleProof.sol and remove mock contract 2017-06-15 11:10:37 -04:00
2e0bd06da2 Add tests, docs and MerkleTree helper 2017-06-15 11:07:22 -04:00
3c4d0d0a77 MerkleProof library and initial stubbed out tests 2017-06-14 16:34:46 -04:00
403e7336a9 fixed typo 2017-06-14 16:31:12 -04:00
fea2a8383c Merge pull request #256 from DavidKnott/refactor-mintable-token
Refactor MintableToken Contract
2017-06-14 16:12:23 -03:00
ffe464a43e Refactors the Mintable Token contract 2017-06-14 10:38:32 -06:00
3fbcb1b282 Merge pull request #250 from jdkanani/yarn-setup
Add yarn support and use it for Travis CI
2017-06-12 12:11:14 -03:00
28b2a0c881 Move npm to yarn 2017-06-11 12:50:26 +05:30
7b9c1429d9 v1.0.7 2017-06-09 19:31:09 -03:00
d53ddd4a95 Merge pull request #242 from DavidKnott/upgrade-truffle-and-solidity
Upgrade to Truffle version 3.2.2 and Solidity version 0.4.11
2017-06-07 15:04:57 -03:00
6ede3d9001 Upgrade to Truffle version 3.2.2 and Solidity version 0.4.11 2017-06-06 21:41:54 -06:00
c3cb0dcf80 Merge pull request #238 from DaveAppleton/master
remove redundant return
2017-06-06 11:02:46 -03:00
f214dccab9 removed redundant returns 2017-06-06 17:10:55 +08:00
c0cce27703 remove redundant return 2017-06-02 00:27:16 +08:00
2eded7a337 Merge pull request #237 from maraoz/coveralls
Add coveralls
2017-05-31 20:30:50 -03:00
41a6f1cd84 add coveralls 2017-05-31 17:15:50 -03:00
e1eed257f1 v1.0.6 2017-05-29 18:29:48 -03:00
2bcb54b3cb Merge pull request #231 from maraoz/fix-vested-token
Implement VestedToken bug mitigation #3
2017-05-29 18:27:44 -03:00
7100e30bed Implement VestedToken bug mitigation #3 2017-05-29 17:52:19 -03:00
7f6921e787 Merge pull request #222 from aragon/refactor
[VestedToken] Add revokability and burnablity options and general refactor and optimizations
2017-05-29 17:17:54 -03:00
73ec224c93 Merge pull request #2 from maraoz/aragon-refactor
rebase to master
2017-05-29 22:05:05 +02:00
a62621eb59 merge @izqui PR with new docs changes 2017-05-29 16:19:03 -03:00
84843d42da Merge pull request #225 from DavidKnott/fix-natspec-typos
Edit natspec documentation typos
2017-05-25 18:44:01 -03:00
d08185fc3e Edit natspec documentation typos 2017-05-26 00:29:15 +03:00
efe09575e3 Merge pull request #210 from maurelian/master
Add natspec comments to contracts
2017-05-24 18:33:28 -03:00
c4796bb918 Fix comments again 2017-05-24 17:27:05 -04:00
111f13f0ce Add doc comments to multisig wallet 2017-05-24 16:51:05 -04:00
d357cf3a2e Minor changes to doc comments for token and other contracts 2017-05-24 16:51:01 -04:00
83f2849446 Minor edits to doc commenst in lifecycle, ownership, payment contracts. 2017-05-24 16:49:43 -04:00
d85be4a866 Add natspec to vestedToken.sol 2017-05-24 16:47:25 -04:00
f6f91298f0 Add natspec to all remaing contracts, except for vestedToken.sol 2017-05-24 16:47:21 -04:00
1547922b61 Added natspec to the remaining ownership contracts and payment contracts 2017-05-24 16:45:45 -04:00
602c18b394 Applied change regarding the styling 2017-05-24 16:45:41 -04:00
b5d4120adb Added natsec for all lifecycle contracts + bounty.sol, DayLimit.sol and LimitBalance.sol 2017-05-24 16:43:14 -04:00
e851938199 Add natspec comments to four ownership contracts 2017-05-24 16:35:09 -04:00
48a2e11dfe merge 2017-05-22 18:08:03 -04:00
22f60eace0 Use libraries syntax sugar for revoking grants logic 2017-05-22 18:06:57 -04:00
b788f33c6a Merge pull request #218 from cgewecke/coverage
Add coverage
2017-05-21 23:40:18 -03:00
592548715f Add solidity-coverage 2017-05-21 19:19:50 -07:00
0983f0065d Merge pull request #223 from aragon/safe-math-div
[SafeMath] Remove unnecessary checks from safeDiv
2017-05-21 23:06:42 -03:00
c4f78a5dd5 Remove unnecessary checks from safeDiv 2017-05-21 16:41:18 -04:00
e032b86231 Merge with Zeppelin master 2017-05-21 16:14:06 -04:00
a6a2ee2bf1 Merge with master 2017-05-21 16:08:47 -04:00
929367f0ab Reorg code 2017-05-21 12:10:04 +02:00
5a6340395f Fix grant id parameter in NewTokenGrant event 2017-05-21 11:22:30 +02:00
f812433706 Small refactor and documentation 2017-05-21 11:18:24 +02:00
713b472253 Add tests for non-revokable and revokable/burnable cases 2017-05-21 11:17:24 +02:00
a1d2b673c6 Fix tests for revokable/non burn vesting calendar 2017-05-21 10:44:03 +02:00
5b2f0aa93d Implement revokable and burnsOnRevoke options 2017-05-21 10:38:56 +02:00
ecbfcbb302 Merge pull request #221 from TokenMarketNet/feat/transfer-from-mitigation
Protect transferFrom() against short hand attack.
2017-05-18 12:43:51 -03:00
964185dec3 Protect transferFrom against short hand attack. 2017-05-18 00:38:41 +03:00
5c491987f3 Merge pull request #219 from TokenMarketNet/feat/approve-mitigation
approve() race condition mitigation
2017-05-17 13:26:19 -06:00
e1cf602487 Fix variable naming. 2017-05-17 01:41:43 +03:00
a3446507ec Add fix for the approve() mitigation. 2017-05-17 01:33:13 +03:00
ff61c7d92d Merge pull request #212 from misteraverin/feature/destructible
Add destroy function, allowing send funds to recepient.
2017-05-15 07:19:45 -06:00
726593c0a2 Merge pull request #216 from maraoz/ethpm-npm
Revert to usig npm as preferred installation method
2017-05-12 09:12:24 -06:00
7826fddba7 revert to usig npm as preferred installation method 2017-05-12 12:10:28 -03:00
38a450460d Merge pull request #214 from maraoz/audit-report
Add external audit report
2017-05-11 13:17:53 -03:00
de7751aae2 Add external audit 2017-05-11 13:08:23 -03:00
cf7bc06856 Switch function name to destroyAndSend 2017-05-09 23:20:44 +03:00
7ac697be2c v1.0.5 2017-05-09 15:13:45 -03:00
4de772f5ed add destroy function, allowing send funds to recepient 2017-05-08 22:50:43 +03:00
f7a7fc3b06 Merge pull request #206 from DavidKnott/create-pausable-token
Create and test PausableToken Contract
2017-05-03 15:32:33 -03:00
b4b6029f66 Create and test PausableToken Contract 2017-04-29 01:08:14 +01:00
071040f3eb Merge pull request #203 from ORBAT/fix/bounty-claim-fail-test
Await event handling result in Bounty test
2017-04-24 11:06:38 -03:00
cd78c20e0e await event handling result in Bounty test. Fixes #202 2017-04-21 20:08:17 +03:00
453a198250 Merge pull request #184 from maraoz/safemath
Make SafeMath a library
2017-04-20 12:40:15 -03:00
7592122e4d fix indentation 2017-04-19 18:34:53 -03:00
609869f087 change safe* to * 2017-04-19 16:19:22 -03:00
4fad1505c7 Make SafeMath a library 2017-04-19 15:36:49 -03:00
5881429952 Merge pull request #195 from OpenZeppelin/maraoz-patch-1
Update README with new slack url
2017-04-19 13:49:29 -03:00
526ed43d61 Update README with new slack url 2017-04-19 13:49:09 -03:00
ab9591ba80 Merge pull request #193 from AugustoL/master
Added totalPayments uint on PullPayments contract
2017-04-18 11:42:48 -03:00
a8bcb0fcfe Added totalPayments uint on PullPayments contract 2017-04-14 14:30:31 -03:00
b420316783 Merge pull request #192 from tatiesmars/patch-1
Add MintFinished event to MintableToken
2017-04-13 16:18:07 -03:00
37c6782f95 Add MintFinished event to MintableToken #191 2017-04-13 14:23:41 +08:00
70a4395a97 Merge pull request #190 from lastperson/patch-1
Remove excessive condition from SafeMath.safeAdd()
2017-04-12 19:11:55 -03:00
31c05c4c7d Remove excessive condition from SafeMath.safeAdd()
There is no situation when `c>=a` will be `true` while `c>=b` will be `false`.
2017-04-12 15:22:52 +08:00
22018fd374 Merge pull request #188 from jdetychey/patch-3
fix for short address attack
2017-04-11 17:02:24 -03:00
d1f63f5c7e Merge pull request #185 from DavidKnott/create-token-with-owner-contract
Create and test MintableToken contract
2017-04-11 13:01:01 -03:00
5d75264f0f Fix for bigger payloads
as suggested by izqui in case a function calls transfer under the hood
2017-04-11 17:25:03 +02:00
a605f66972 Create and test MintableToken contract 2017-04-07 14:51:33 -06:00
0328250554 Merge pull request #187 from DavidKnott/change-killable-contract-to-destructible
Change killable to destructible and kill to destroy
2017-04-07 15:16:06 -03:00
70b5ffd928 Change killable to destructible and kill to destroy 2017-04-07 11:34:35 -06:00
d9b9ed227b fix for short address attack
as suggested by /u/izqui9 here https://www.reddit.com/r/ethereum/comments/63s917/worrysome_bug_exploit_with_erc20_token/dfwmhc3/
Attack description: 
https://blog.golemproject.net/how-to-find-10m-by-just-reading-blockchain-6ae9d39fcd95
2017-04-07 11:30:18 +02:00
14274f8677 Merge pull request #169 from maraoz/audit
Follow security audit recommendations
2017-04-05 19:04:11 -03:00
af604379d3 rebase conflict fixes 2017-04-05 18:30:14 -03:00
7d83a08658 8.2.3 removed ownable 2017-04-05 18:27:34 -03:00
2ccbfea8c5 8.1.2 add comment clarifying Migrations 2017-04-05 18:27:34 -03:00
fad287007b 7.2 add preconditions to Shareable contructor 2017-04-05 18:27:34 -03:00
cd9f820b85 fix syntax error 2017-04-05 18:27:34 -03:00
582166d378 7.1 pull payment safe math 2017-04-05 18:27:34 -03:00
ab9eecb104 6.1 fix stuck Ether in Crowdsale contract 2017-04-05 18:27:34 -03:00
52120a8c42 5.3 always throw on error 2017-04-05 18:27:34 -03:00
a1aa74f96d 5.2 all contracts now solidity ^0.4.8 2017-04-05 18:25:14 -03:00
6ae7ac97f6 Merge pull request #181 from roderik/patch-1
Shareable is not used in this contract
2017-04-05 17:25:28 -03:00
ba6c036628 Merge pull request #183 from AragonOne/fix-vesting
Fix vesting calculation logic
2017-04-05 12:54:23 -03:00
7a2fda9076 Improve VestedToken tests 2017-04-05 13:20:18 +02:00
41d2fde952 Fix vesting calculation logic 2017-04-05 13:13:17 +02:00
f0e7396619 Shareable is not used in this contract 2017-04-05 08:33:30 +02:00
6139500e97 Merge pull request #180 from frangio/fix-179-rename-transferable
Rename `TransferableToken` to `LimitedTransferToken`
2017-04-03 23:28:09 -03:00
0b88944b38 fix a few typos 2017-04-03 22:06:41 -03:00
61e33197b2 rename TransferableToken to LimitedTransferToken
fixes #179
2017-04-03 22:04:07 -03:00
025e7db765 Merge pull request #178 from frangio/fix-solidity-renamed-methods
Change sha3 and suicide methods to keccak256 and selfdestruct respectively
2017-04-03 12:03:16 -03:00
6f311e72b3 change sha3 and suicide methods to keccak256 and selfdestruct
see ethereum/solidity#1476
2017-04-03 11:31:56 -03:00
a344d42a00 Merge pull request #170 from Recmo/feature/no-owner
Prevent contracts from owning Ether, Tokens and other contracts.
2017-03-31 16:51:18 -03:00
f2159be68d Merge pull request #176 from frangio/shareable-owners-type
Change type of `owners` from uint[] to address[]
2017-03-31 13:33:09 -03:00
7f7238378c change type of owners from uint[] to address[]
fixes #175
2017-03-31 13:14:59 -03:00
1d2b989e8e Fix typo in comment 2017-03-31 09:39:29 +01:00
bc0f9b0ea5 Merge pull request #174 from demibrener/readme
Add Wings to collaborating organizations
2017-03-29 18:15:13 -03:00
a885dabc81 added Wings 2017-03-29 18:04:13 -03:00
6673da46b1 Merge pull request #173 from demibrener/readme
Name consistency: OpenZeppelin
2017-03-29 18:01:23 -03:00
2e9587477c Merge pull request #171 from Recmo/feature/reentrancy-guard
Add ReentrancyGuard
2017-03-28 15:10:30 -03:00
967ee13565 OpenZeppelin 2017-03-27 17:21:29 -03:00
a2bd1bb7f6 Add ReentrancyGuard 2017-03-24 11:01:06 +00:00
ac3b3652c3 Add NoOwner 2017-03-23 15:48:22 +00:00
166a1070e5 Add HasNoContracts 2017-03-23 15:43:52 +00:00
94d3c447b7 Add HasNoTokens 2017-03-23 15:22:48 +00:00
9ff82aecef Remove non-compiling payable default 2017-03-23 12:54:42 +00:00
d1af3ef1b3 Add HasNoEther 2017-03-23 12:23:27 +00:00
ffce7e3b08 Merge pull request #166 from AragonOne/transaferable
Add comments for Transferable Token
2017-03-20 15:43:56 -03:00
f896790ca3 Merge pull request #167 from maraoz/fix-travis
Fix travis build
2017-03-20 15:25:59 -03:00
960500a078 try to fix travis 2 2017-03-20 15:19:14 -03:00
ce25e2db98 try to fix travis 1 2017-03-20 11:58:56 -03:00
463ae97117 Merge pull request #160 from Recmo/feature/token-killable
Add TokenKillable
2017-03-20 11:27:19 -03:00
350ab09855 Add comments for TransferableToken 2017-03-20 10:16:48 +01:00
312220fe63 Merge pull request #162 from AragonOne/transaferable
Decouple transferable logic from VestedToken
2017-03-15 16:09:13 -03:00
72029b6847 Decouple transferable logic from VestedToken 2017-03-14 20:22:18 +01:00
525a5522b0 Add TokenKillable 2017-03-14 14:09:59 +00:00
9c5975a706 Merge pull request #158 from maraoz/update-readme
update README on new code distribution strategy (ethpm)
2017-03-09 18:13:27 -03:00
9006f89f9f update README on new code distribution 2017-03-09 18:02:41 -03:00
15169b245b v1.0.4 2017-03-09 15:04:14 -03:00
cc222c02a9 Merge pull request #156 from maraoz/ethpm
Add ethpm support
2017-03-09 15:00:09 -03:00
29ab824e5c revert TokenGrant instantiation to old style 2017-03-09 14:37:02 -03:00
8d828bc789 fix ethpm.json 2017-03-07 16:57:51 -03:00
f038cdc9c9 fix ethpm.json 2017-03-07 16:57:12 -03:00
72d31c2471 attempt to publish to ethpm 2017-03-07 16:56:13 -03:00
b31c92c27c ethpm integration 2017-03-07 16:17:48 -03:00
eb2cb5dd06 v1.0.3 2017-03-06 11:14:18 -03:00
52d0df7961 Merge pull request #155 from AragonOne/vested-transfer-from
[VestedToken] Check if tokens can be transferred on transferFrom
2017-03-06 11:11:29 -03:00
12aadbed51 Move check to transferFrom and add tests 2017-03-06 11:09:01 +01:00
23703280ee Check if tokens are transaferable on approve 2017-03-06 11:02:57 +01:00
5e50090da0 Merge pull request #151 from AragonOne/clarity
Add clarifying comment to standard token transfer from function
2017-03-01 17:16:15 -03:00
b9257a1092 Add clarifying comment to standard token transfer from function 2017-02-27 16:32:42 +01:00
8cd58303f9 v1.0.2 2017-02-23 12:56:07 -03:00
b134645637 Merge pull request #150 from maraoz/solidty-version
solidity version 0.4.8
2017-02-23 09:12:54 -03:00
d41cc437b3 Merge pull request #149 from JGcarv/feature/contactable
Added a contactable contract
2017-02-22 18:21:39 -03:00
26335e669e Added a contactable contract and some tests for it 2017-02-22 16:28:01 -03:00
52b66c744f solidity version 0.4.8 2017-02-21 19:29:03 -03:00
65c9711754 Merge pull request #147 from fabioberger/refactor/modifiers
Update modifiers to throw and update corresponding tests
2017-02-21 16:58:06 -03:00
3d6988cf90 Update modifiers so that they fail "loudly" by throwing errors rather then silently no-oping. Updated tests to remain compatible with these changes 2017-02-21 00:05:59 +01:00
c10a2cf15c Merge pull request #146 from maraoz/refactor
Refactor in preparation for audit
2017-02-17 19:30:07 -03:00
44082c029f fix travis tests 4 2017-02-17 19:23:56 -03:00
8ba0f008df fix travis tests 3 2017-02-17 19:17:42 -03:00
fcabd9957e fix travis tests 2 2017-02-17 19:02:44 -03:00
9f12e870a9 fix travis tests 2017-02-17 18:47:56 -03:00
d24a2ed9a8 fix compiler error 2017-02-17 18:32:24 -03:00
b1cb7b5975 implement solium recommendations 2017-02-17 18:31:16 -03:00
9ab997d788 fix travis test runner 2017-02-17 18:04:56 -03:00
90654cb2c9 add .jshintrc 2017-02-17 18:04:02 -03:00
9bd51db2b2 refactor tests for truffle 3 2017-02-17 18:03:52 -03:00
7e7193ae61 truffle 2=>3 2017-02-15 12:14:50 -03:00
a69333e2b8 migrate to truffle 3 2017-02-14 17:57:37 -03:00
1f35727442 Merge pull request #144 from demibrener/readme
Aragon new collaborating organization
2017-02-14 12:37:45 -03:00
cbc18e6dcc Aragon new collaborating organization 2017-02-14 12:07:11 -03:00
60b48b0235 Solium 2017-02-13 13:26:56 -03:00
f4624837a3 Merge pull request #140 from AragonOne/vesting
Vested Token implementation (Standard Token with vesting calendar)
2017-02-13 12:43:54 -03:00
0a5af4b8ac Change operations order for rounding. Make tests use blocktime as reference time rather than date. 2017-02-13 11:35:32 +01:00
74dfd3511f Merge pull request #1 from maraoz/vesting
Vesting test fixing help
2017-02-13 10:08:43 +01:00
ee56abcc8a remove console.logs from timer 2017-02-10 18:35:05 -03:00
b67f60929c make VestedToken test deterministic 2017-02-10 18:32:58 -03:00
0b71dcded2 Rename GrantableToken to VestedToken 2017-02-10 16:20:23 +01:00
f305382ef4 Remove grantTokens without vesting function 2017-02-10 16:18:36 +01:00
917b129517 Add safeDiv and min/max functions to SafeMath 2017-02-10 16:17:02 +01:00
abc646a95c lastTokenIsTransferableDate rename 2017-02-10 16:04:58 +01:00
1697518da8 Make vested stock calculation more testable 2017-02-10 15:28:20 +01:00
93e7984c61 Transferrable is now transferrable 2017-02-10 14:59:19 +01:00
8d9e12eda3 Add GrantableToken tests 2017-02-09 13:23:12 +01:00
fb0a96332c GrantableTokenMock 2017-02-08 15:27:39 +01:00
ba7a0f7649 Merge branch 'master' of https://github.com/OpenZeppelin/zeppelin-solidity into vesting 2017-02-08 15:26:15 +01:00
a72de719c9 Merge pull request #139 from eordano/patch-1
BasicToken.sol: Remove useless check
2017-02-08 11:13:38 -03:00
ec6e728c0f Grantable Token first version 2017-02-08 12:31:20 +01:00
70fbc7fe27 BasicToken.sol: Remove useless check
The condition this commit removes is already implemented by the call to `safeSub`
2017-02-07 19:45:32 -05:00
ced4e2da3f Merge pull request #137 from JGcarv/chore/rename-to-pausable
Renamed files and replaced occurencies of 'Stoppable' to 'Pausable'
2017-02-06 16:34:54 -03:00
ae73f1a564 Renamed files and replaced occurencies of 'Stoppable' to 'Pausable' 2017-01-30 23:30:43 -02:00
26127ee36a Merge pull request #136 from AragonOne/master
Make test cases that use assertJump fail if they dont fail
2017-01-23 15:48:38 -03:00
2f0471fff2 Make test cases that use assertJump fail if they dont fail 2017-01-23 19:18:41 +01:00
ad833fb40d Merge pull request #132 from OpenZeppelin/refactor
Refactor folders in preparation for external audit
2017-01-17 13:02:16 -03:00
a544f1517c Merge pull request #133 from jtakalai/patch-1
Fix typos
2017-01-17 11:24:17 -03:00
67ad6abdaa Fix typos
On unrelated note, why on earth check like in safeAdd? Is it actually an overflow check?
2017-01-17 12:29:54 +02:00
0dfb27ff5f fix tests 2017-01-16 17:42:26 -03:00
ca8f2f2362 rearrange folders 2017-01-16 17:23:28 -03:00
2de7fec6dc Merge pull request #127 from OpenZeppelin/contributing
Add tag comment on CONTRIBUTING.md
2017-01-09 16:27:56 -03:00
342e7bf9ff Add tag comment on CONTRIBUTING.md
Fixes #116
2017-01-09 16:27:32 -03:00
231 changed files with 15744 additions and 2379 deletions

5
.env.example Normal file
View File

@ -0,0 +1,5 @@
# configure your infura api key (not technically required)
INFURA_API_KEY=
# change the mnemonic that your hd wallet is seeded with
MNEMONIC=

51
.eslintrc Normal file
View File

@ -0,0 +1,51 @@
{
"extends" : [
"standard",
"plugin:promise/recommended"
],
"plugins": [
"promise"
],
"env": {
"browser" : true,
"node" : true,
"mocha" : true,
"jest" : true
},
"globals" : {
"artifacts": false,
"contract": false,
"assert": false,
"web3": false
},
"rules": {
// Strict mode
"strict": [2, "global"],
// Code style
"indent": [2, 2],
"quotes": [2, "single"],
"semi": ["error", "always"],
"space-before-function-paren": ["error", "always"],
"no-use-before-define": 0,
"eqeqeq": [2, "smart"],
"dot-notation": [2, {"allowKeywords": true, "allowPattern": ""}],
"no-redeclare": [2, {"builtinGlobals": true}],
"no-trailing-spaces": [2, { "skipBlankLines": true }],
"eol-last": 1,
"comma-spacing": [2, {"before": false, "after": true}],
"camelcase": [2, {"properties": "always"}],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"comma-dangle": [1, "always-multiline"],
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-debugger": 0,
"no-undef": 2,
"object-curly-spacing": [2, "always"],
"max-len": [2, 120, 2],
"generator-star-spacing": ["error", "before"],
"promise/avoid-new": 0,
"promise/always-return": 0
}
}

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.sol linguist-language=Solidity

32
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,32 @@
- [ ] 🐛 This is a bug report.
- [ ] 📈 This is a feature request.
<!-- Please check one of the above by placing an x in the box. -->
Briefly describe the issue you are experiencing (or the feature you want to see added to OpenZeppelin). Tell us what you were trying to do and what happened instead. **Remember, this is _not_ a place to ask for help debugging code; for that, we welcome you in the [OpenZeppelin Slack Channel](https://slack.openzeppelin.org/).**
## 💻 Environment
First, we need to know what your environment looks like.
- Which version of OpenZeppelin are you using?
- What network are you deploying to? testrpc? Ganache? Ropsten?
- How are you deploying your OpenZeppelin-backed contracts? truffle? Remix? Let us know!
## 📝 Details
Describe the problem you have been experiencing in more detail. Include as much information as you think is relevant. Keep in mind that transactions can fail for many reasons; context is key here.
## 🔢 Code To Reproduce Issue [ Good To Have ]
Please remember that with sample code it's easier to reproduce the bug and it's much faster to fix it.
```
insert short code snippets here
```
<!-- If your code is larger, consider linking us to a repo illustrating your issue. -->
## 👍 Other Information
<!-- List any other information that is relevant to your issue. Error logs, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->

17
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,17 @@
<!-- 🎉 Thank you for submitting a PR! Before submitting, please review the following checklist: -->
- [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](/docs/CONTRIBUTING.md)
- [ ] ✅ I've added tests where applicable to test my new functionality.
- [ ] 📖 I've made sure that my contracts are well-documented.
- [ ] 🎨 I've run the JS/Solidity linters (`npm run lint:all:fix`) and fixed any issues.
<!-- **Does this close any open issues?** If so, list them here. -->
Fixes #
---
# 🚀 Description
<!-- Describe the changes introduced in this pull request -->
<!-- Include any context necessary for understanding the PR's purpose. -->

33
.gitignore vendored
View File

@ -1,5 +1,36 @@
*.swp
*.swo
node_modules/
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
allFiredEvents
scTopics
# Coverage directory used by tools like istanbul
coverage
coverage.json
coverageEnv
# node-waf configuration
.lock-wscript
# Dependency directory
node_modules
# Debug log from npm
npm-debug.log
# local env variables
.env
# truffle build directory
build/
# lol macs
.DS_Store/

48
.jshintrc Normal file
View File

@ -0,0 +1,48 @@
{
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"browser": true, // Standard browser globals e.g. `window`, `document`.
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": true, // Require {} for every new block or scope.
"devel": false, // Allow development statements e.g. `console.log();`.
"eqeqeq": true, // Require triple equals i.e. `===`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"freeze": true, // Forbid overwriting prototypes of native objects such as Array, Date and so on.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"indent": 2, // Specify indentation spacing
"latedef": true, // Prohibit variable use before definition.
"newcap": false, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"noempty": true, // Prohibit use of empty blocks.
"nonew": true, // Prohibits the use of constructor functions for side-effects
"quotmark": "single", // Define quotes to string values.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
"smarttabs": false, // Supress warnings about mixed tabs and spaces
"strict": true, // Require `use strict` pragma in every file.
"trailing": true, // Prohibit trailing whitespaces.
"undef": true, // Require all non-global variables be declared before they are used.
"unused": true, // Warn unused variables.
"maxparams": 4, // Maximum number of parameters for a function
"maxstatements": 15, // Maximum number of statements in a function
"maxcomplexity": 10, // Cyclomatic complexity (http://en.wikipedia.org/wiki/Cyclomatic_complexity)
"maxdepth": 4, // Maximum depth of nested control structures
"maxlen": 120, // Maximum number of cols in a line
"multistr": true, // Allow use of multiline EOL escaping
"experimental": ["asyncawait", "asyncreqawait"],
"predef": [ // Extra globals.
"after",
"afterEach",
"before",
"beforeEach",
"define",
"describe",
"exports",
"it",
"web3",
"artifacts",
"contract",
"assert"
]
}

1
.node-version Normal file
View File

@ -0,0 +1 @@
v8.9.1

9
.solcover.js Normal file
View File

@ -0,0 +1,9 @@
module.exports = {
norpc: true,
testCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage',
compileCommand: 'node --max-old-space-size=4096 ../node_modules/.bin/truffle compile --network coverage',
skipFiles: [
'lifecycle/Migrations.sol',
'mocks'
]
}

1
.soliumignore Normal file
View File

@ -0,0 +1 @@
node_modules

12
.soliumrc.json Normal file
View File

@ -0,0 +1,12 @@
{
"extends": "solium:all",
"plugins": ["security"],
"rules": {
"quotes": ["error", "double"],
"indentation": ["error", 2],
"arg-overflow": ["warning", 3],
"security/enforce-explicit-visibility": ["error"],
"security/no-block-members": ["warning"],
"security/no-inline-assembly": ["warning"]
}
}

View File

@ -1,12 +1,29 @@
dist: trusty
sudo: false
sudo: required
group: beta
language: node_js
node_js:
- "6"
before_install:
- npm i -g ethereumjs-testrpc
- npm i -g truffle
- "8"
cache:
directories:
- node_modules
env:
-
- SOLIDITY_COVERAGE=true
matrix:
fast_finish: true
allow_failures:
- env: SOLIDITY_COVERAGE=true
before_script:
- truffle version
script:
- testrpc&
- npm test
- npm run lint
- npm run lint:sol
- npm run test
notifications:
slack:
rooms:
- secure: uEhwUkuwJp5pBNh+VTEytPHz3FDKsnPrKO+8MTAKv5hKi4PCRoVhLv6pklr82HUpL6pvSvJbUPA0HVebOXA+MMSxdny/BHZTh2mtw5Y78l2Ad0svDTWuV2Lus2pmhYigRhT0Wo00/SRX9+pxm0kg4EIFJSTS+uR9G76x0l9NljpEGXrqxlDxjxoHBgk8Ciru2LHaLzX/utE3jlABts4Sb1F3wc2BwFkjd6BDCRTGAPhVJwwFk41ZfnmLVbgSNUyk46Cb38oG5oXHb0FI3d3jV/k1OUhRyFfmA2fLXRk0wavibW8TG1gGJJWZ7xTCKzw/Cvup6mpehSAeQef8eekMdjpWEhF9hYRq1BvOs0384UU8NQ0O+BtdXU+X3Nyr84TMJN/iIfgN7gYX7AsvXH3jC0JfNUcIkWlJvyXdE6l2GV1hMmhL09GFEBbSpuSXRIWlOXTcYBlp5NbvE8xO8PUW+T6N5RG2XXjv1g8wCpr6Wwk1+LmRkX5trv8MFBZ2pM8p4H5da5++Ov8egLonNGK2jbx6aBLBX3tPf+g70LZEkiQ4eBfZw8VIgXIvKreisicppNuCD27gNmSEPNt0NkwiEBcTCJ9GSVAO0CU2g4ggvHDX2A+RW5XPET9bGkBXKLfFyV7Qe+MSQjXkCnW3bIRh7Wo1V31XiUiYOLuZPIiH3EQ=
on_success: change
on_failure: always
on_pull_requests: false

View File

@ -1,105 +1,59 @@
Contributing to Zeppelin
Contributing to OpenZeppelin
=======
## Design Guidelines
We really appreciate and value contributions to OpenZeppelin. Please take 5' to review the items listed below to make sure that your contributions are merged as soon as possible.
These are some global design goals in Zeppelin.
## Contribution guidelines
### D0 - Security in Depth
We strive to provide secure, tested, audited code. To achieve this, we need to match intention with function. Thus, documentation, code clarity, community review and security discussions are fundamental.
Smart contracts manage value and are highly vulnerable to errors and attacks. We have very strict guidelines, please make sure to review them: ["Contribution guidelines wiki entry"](https://github.com/OpenZeppelin/zeppelin-solidity/wiki/Contrbuting-guidelines).
### D1 - Simple and Modular
Simpler code means easier audits, and better understanding of what each component does. We look for small files, small contracts, and small functions. If you can separate a contract into two independent functionalities you should probably do it.
## Creating Pull Requests (PRs)
### D2 - Naming Matters
As a contributor, you are expected to fork this repository, work on your own fork and then submit pull requests. The pull requests will be reviewed and eventually merged into the main repo. See ["Fork-a-Repo"](https://help.github.com/articles/fork-a-repo/) for how this works.
We take our time with picking names. Code is going to be written once, and read hundreds of times. Renaming for clarity is encouraged.
*IMPORTANT*
* Please use `rebase` instead of `merge` when updating your fork.
* Please see ["Git flow wiki entry"](https://github.com/OpenZeppelin/zeppelin-solidity/wiki/Git-flow) for understanding how to use branches in this repository.
### D3 - Tests
## A typical workflow
Write tests for all your code. We encourage Test Driven Development so we know when our code is right. Even though not all code in the repository is tested at the moment, we aim to test every line of code in the future.
1) Make sure your fork is up to date with the main repository:
### D4 - Check preconditions and post-conditions
```
cd zeppelin-solidity
git fetch upstream
git checkout development
git pull --rebase upstream development
```
NOTE: The directory `zeppelin-solidity` represents your fork's local copy.
A very important way to prevent vulnerabilities is to catch a contracts inconsistent state as early as possible. This is why we want functions to check pre- and post-conditions for executing its logic. When writing code, ask yourself what you are expecting to be true before and after the function runs, and express it in code.
### D5 - Code Consistency
Consistency on the way classes are used is paramount to an easier understanding of the library. The codebase should be as unified as possible. Read existing code and get inspired before you write your own. Follow the style guidelines. Dont hesitate to ask for help on how to best write a specific piece of code.
### D6 - Regular Audits
Following good programming practices is a way to reduce the risk of vulnerabilities, but professional code audits are still needed. We will perform regular code audits on major releases, and hire security professionals to provide independent review.
## Style Guidelines
The design guidelines have quite a high abstraction level. These style guidelines are more concrete and easier to apply, and also more opinionated.
### General
#### G0 - Default to Solidity's official style guide.
Follow the official Solidity style guide: http://solidity.readthedocs.io/en/latest/style-guide.html
#### G1 - No Magic Constants
Avoid constants in the code as much as possible. Magic strings are also magic constants.
#### G2 - Code that Fails Early
We ask our code to fail as soon as possible when an unexpected input was provided or unexpected state was found.
#### G3 - Internal Amounts Must be Signed Integers and Represent the Smallest Units.
Avoid representation errors by always dealing with weis when handling ether. GUIs can convert to more human-friendly representations. Use Signed Integers (int) to prevent underflow problems.
### Testing
#### T1 - Tests Must be Written Elegantly
Style guidelines are not relaxed for tests. Tests are a good way to show how to use the library, and maintaining them is extremely necessary.
Don't write long tests, write helper functions to make them be as short and concise as possible (they should take just a few lines each), and use good variable names.
#### T2 - Tests Must not be Random
Inputs for tests should not be generated randomly. Accounts used to create test contracts are an exception, those can be random. Also, the type and structure of outputs should be checked.
### Documentation
TODO
## Pull Request Workflow
Our workflow is based on GitHub's pull requests. We use feature branches, prepended with: `test`, `feature`, `fix`, `refactor`, or `remove` according to the change the branch introduces. Some examples for such branches are:
```sh
git checkout -b test/some-module
git checkout -b feature/some-new-stuff
git checkout -b fix/some-bug
git checkout -b remove/some-file
2) Branch out from `development` into `fix/some-bug-#123`:
(Postfixing #123 will associate your PR with the issue #123 and make everyone's life easier =D)
```
git checkout -b fix/some-bug-#123
```
We expect pull requests to be rebased to the master branch before merging:
```sh
git remote add zep git@github.com:OpenZeppelin/zeppelin-solidity.git
git pull --rebase zep master
3) Make your changes, add your files, commit and push to your fork.
```
git add SomeFile.js
git commit "Fix some bug #123"
git push origin fix/some-bug-#123
```
Note that we require rebasing your branch instead of merging it, for commit readability reasons.
4) Go to [github.com/OpenZeppelin/zeppelin-solidity](https://github.com/OpenZeppelin/zeppelin-solidity) in your web browser and issue a new pull request.
After that, you can push the changes to your fork, by doing:
```sh
git push origin your_branch_name
git push origin feature/some-new-stuff
git push origin fix/some-bug
```
*IMPORTANT* Read the PR template very carefully and make sure to follow all the instructions. These instructions
refer to some very important conditions that your PR must meet in order to be accepted, such as making sure that all tests pass, JS linting tests pass, solidity linting tests pass, etc.
Finally go to [github.com/OpenZeppelin/zeppelin-solidity](https://github.com/OpenZeppelin/zeppelin-solidity) in your web browser and issue a new pull request.
5) Maintainers will review your code and possibly ask for changes before your code is pulled in to the main repository. We'll check that all tests pass, review the coding style, and check for general code correctness. If everything is OK, we'll merge your pull request and your code will be part of OpenZeppelin.
Main contributors will review your code and possibly ask for changes before your code is pulled in to the main repository. We'll check that all tests pass, review the coding style, and check for general code correctness. If everything is OK, we'll merge your pull request and your code will be part of Zeppelin.
*IMPORTANT* Please pay attention to the maintainer's feedback, since its a necessary step to keep up with the standards OpenZeppelin attains to.
If you have any questions feel free to post them to
[github.com/OpenZeppelin/zeppelin-solidity/issues](https://github.com/OpenZeppelin/zeppelin-solidity/issues).
## All set!
If you have any questions feel free to post them to github.com/OpenZeppelin/zeppelin-solidity/issues.
Finally, if you're looking to collaborate and want to find easy tasks to start, look at the issues we marked as ["Good first issue"](https://github.com/OpenZeppelin/zeppelin-solidity/labels/good%20first%20issue).
Thanks for your time and code!

16
LICENSE
View File

@ -5,18 +5,18 @@ Copyright (c) 2016 Smart Contract Solutions, Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,86 +1,79 @@
# Zeppelin Solidity
[![NPM Package](https://img.shields.io/npm/v/zeppelin-solidity.svg?style=flat-square)](https://www.npmjs.org/package/zeppelin-solidity)
[![Build Status](https://img.shields.io/travis/OpenZeppelin/zeppelin-solidity.svg?branch=master&style=flat-square)](https://travis-ci.org/OpenZeppelin/zeppelin-solidity)
[![Coverage Status](https://img.shields.io/coveralls/github/OpenZeppelin/zeppelin-solidity/master.svg?style=flat-square)](https://coveralls.io/github/OpenZeppelin/zeppelin-solidity?branch=master)
Zeppelin is a library for writing secure [Smart Contracts](https://en.wikipedia.org/wiki/Smart_contract) on Ethereum.
OpenZeppelin is a library for writing secure [Smart Contracts](https://en.wikipedia.org/wiki/Smart_contract) on Ethereum.
With Zeppelin, you can build distributed applications, protocols and organizations:
With OpenZeppelin, you can build distributed applications, protocols and organizations:
- using common contract security patterns (See [Onward with Ethereum Smart Contract Security](https://medium.com/bitcorps-blog/onward-with-ethereum-smart-contract-security-97a827e47702#.y3kvdetbz))
- in the [Solidity language](http://solidity.readthedocs.io/en/develop/).
- in the [Solidity language](https://solidity.readthedocs.io/en/develop/).
> NOTE: New to smart contract development? Check our [introductory guide](https://medium.com/zeppelin-blog/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05#.cox40d2ut).
## Getting Started
Zeppelin integrates with [Truffle](https://github.com/ConsenSys/truffle), an Ethereum development environment. Please install Truffle and initialize your project with `truffle init`.
OpenZeppelin integrates with [Truffle](https://github.com/ConsenSys/truffle), an Ethereum development environment. Please install Truffle and initialize your project with `truffle init`.
```sh
npm install -g truffle
mkdir myproject && cd myproject
truffle init
```
To install the Zeppelin library, run:
To install the OpenZeppelin library, run the following in your Solidity project root directory:
```sh
npm i zeppelin-solidity
npm init -y
npm install -E zeppelin-solidity
```
After that, you'll get all the library's contracts in the `contracts/zeppelin` folder. You can use the contracts in the library like so:
**Note that OpenZeppelin does not currently follow semantic versioning.** You may encounter breaking changes upon a minor version bump. We recommend pinning the version of OpenZeppelin you use, as done by the `-E` (`--save-exact`) option.
After that, you'll get all the library's contracts in the `node_modules/zeppelin-solidity/contracts` folder. You can use the contracts in the library like so:
```js
import "./zeppelin/Ownable.sol";
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';
contract MyContract is Ownable {
...
}
```
> NOTE: The current distribution channel is npm, which is not ideal. [We're looking into providing a better tool for code distribution](https://github.com/OpenZeppelin/zeppelin-solidity/issues/13), and ideas are welcome.
#### Truffle Beta Support
We also support Truffle Beta npm integration. If you're using Truffle Beta, the contracts in `node_modules` will be enough, so feel free to delete the copies at your `contracts` folder. If you're using Truffle Beta, you can use Zeppelin contracts like so:
```js
import "zeppelin-solidity/contracts/Ownable.sol";
contract MyContract is Ownable {
...
}
```
For more info see [the Truffle Beta package management tutorial](http://truffleframework.com/tutorials/package-management).
## Security
Zeppelin is meant to provide secure, tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problem you might experience.
OpenZeppelin is meant to provide secure, tested and community-audited code, but please use common sense when doing anything that deals with real money! We take no responsibility for your implementation decisions and any security problem you might experience.
If you find a security issue, please email [security@openzeppelin.org](mailto:security@openzeppelin.org).
## Developer Resources
Building a distributed application, protocol or organization with Zeppelin?
Building a distributed application, protocol or organization with OpenZeppelin?
- Read documentation: http://zeppelin-solidity.readthedocs.io/en/latest/
- Read documentation: https://zeppelin-solidity.readthedocs.io/en/latest/
- Ask for help and follow progress at: https://zeppelin-slackin.herokuapp.com/
- Ask for help and follow progress at: https://slack.openzeppelin.org/
Interested in contributing to Zeppelin?
Interested in contributing to OpenZeppelin?
- Framework proposal and roadmap: https://medium.com/zeppelin-blog/zeppelin-framework-proposal-and-development-roadmap-fdfa9a3a32ab#.iain47pak
- Issue tracker: https://github.com/OpenZeppelin/zeppelin-solidity/issues
- Contribution guidelines: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/CONTRIBUTING.md
- Wiki: https://github.com/OpenZeppelin/zeppelin-solidity/wiki
## Collaborating organizations and audits by Zeppelin
## Collaborating organizations and audits by OpenZeppelin
- [Golem](https://golem.network/)
- [Mediachain](https://golem.network/)
- [Mediachain](http://www.mediachain.io/)
- [Truffle](http://truffleframework.com/)
- [Firstblood](http://firstblood.io/)
- [Rootstock](http://www.rsk.co/)
- [Firstblood](https://firstblood.io/)
- [Rootstock](https://www.rsk.co/)
- [Consensys](https://consensys.net/)
- [DigixGlobal](https://www.dgx.io/)
- [Coinfund](https://coinfund.io/)
- [DemocracyEarth](http://democracy.earth/)
- [DemocracyEarth](https://democracy.earth/)
- [Signatura](https://signatura.co/)
- [Ether.camp](http://www.ether.camp/)
- [Aragon](https://aragon.one/)
- [Wings](https://wings.ai/)
among others...

290
audit/ZeppelinAudit.md Normal file
View File

@ -0,0 +1,290 @@
# OpenZeppelin Audit
March, 2017
Authored by Dennis Peterson and Peter Vessenes
# Introduction
Zeppelin requested that New Alchemy perform an audit of the contracts in their OpenZeppelin library. The OpenZeppelin contracts are a set of contracts intended to be a safe building block for a variety of uses by parties that may not be as sophisticated as the OpenZeppelin team. It is a design goal that the contracts be deployable safely and "as-is".
The contracts are hosted at:
https://github.com/OpenZeppelin/zeppelin-solidity
All the contracts in the "contracts" folder are in scope.
The git commit hash we evaluated is:
9c5975a706b076b7000e8179f8101e0c61024c87
# Disclaimer
The audit makes no statements or warrantees about utility of the code, safety of the code, suitability of the business model, regulatory regime for the business model, or any other statements about fitness of the contracts to purpose, or their bugfree status. The audit documentation is for discussion purposes only.
# Executive Summary
Overall the OpenZeppelin codebase is of reasonably high quality -- it is clean, modular and follows best practices throughout.
It is still in flux as a codebase, and needs better documentation per file as to expected behavior and future plans. It probably needs more comprehensive and aggressive tests written by people less nice than the current OpenZeppelin team.
We identified two critical errors and one moderate issue, and would not recommend this commit hash for public use until these bugs are remedied.
The repository includes a set of Truffle unit tests, a requirement and best practice for smart contracts like these; we recommend these be bulked up.
# Discussion
## Big Picture: Is This A Worthwhile Project?
As soon as a developer touches OpenZeppelin contracts, they will modify something, leaving them in an un-audited state. We do not recommend developers deploy any unaudited code to the Blockchain if it will handle money, information or other things of value.
> "In accordance with Unix philosophy, Perl gives you enough rope to hang yourself"
> --Larry Wall
We think this is an incredibly worthwhile project -- aided by the high code quality. Creating a framework that can be easily extended helps increase the average code quality on the Blockchain by charting a course for developers and encouraging containment of modifications to certain sections.
> "Rust: The language that makes you take the safety off before shooting yourself in the foot"
> -- (@mbrubeck)
We think much more could be done here, and recommend the OpenZeppelin team keep at this and keep focusing on the design goal of removing rope and adding safety.
## Solidity Version Updates Recommended
Most of the code uses Solidity 0.4.11, but some files under `Ownership` are marked 0.4.0. These should be updated.
Solidity 0.4.10 will add several features which could be useful in these contracts:
- `assert(condition)`, which throws if the condition is false
- `revert()`, which rolls back without consuming all remaining gas.
- `address.transfer(value)`, which is like `send` but automatically propagates exceptions, and supports `.gas()`. See https://github.com/ethereum/solidity/issues/610 for more on this.
## Error Handling: Throw vs Return False
Solidity standards allow two ways to handle an error -- either calling `throw` or returning `false`. Both have benefits. In particular, a `throw` guarantees a complete wipe of the call stack (up to the preceding external call), whereas `false` allows a function to continue.
In general we prefer `throw` in our code audits, because it is simpler -- it's less for an engineer to keep track of. Returning `false` and using logic to check results can quickly become a poorly-tracked state machine, and this sort of complexity can cause errors.
In the OpenZeppelin contracts, both styles are used in different parts of the codebase. `SimpleToken` transfers throw upon failure, while the full ERC20 token returns `false`. Some modifiers `throw`, others just wrap the function body in a conditional, effectively allowing the function to return false if the condition is not met.
We don't love this, and would usually recommend you stick with one style or the other throughout the codebase.
In at least one case, these different techniques are combined cleverly (see the Multisig comments, line 65). As a set of contracts intended for general use, we recommend you either strive for more consistency or document explicit design criteria that govern which techniques are used where.
Note that it may be impossible to use either one in all situations. For example, SafeMath functions pretty much have to throw upon failure, but ERC20 specifies returning booleans. Therefore we make no particular recommendations, but simply point out inconsistencies to consider.
# Critical Issues
## Stuck Ether in Crowdsale contract
CrowdsaleToken.sol has no provision for withdrawing the raised ether. We *strongly* recommend a standard `withdraw` function be added. There is no scenario in which someone should deploy this contract as is, whether for testing or live.
## Recursive Call in MultisigWallet
Line 45 of `MultisigWallet.sol` checks if the amount being sent by `execute` is under a daily limit.
This function can only be called by the "Owner". As a first angle of attack, it's worth asking what will happen if the multisig wallet owners reset the daily limit by approving a call to `resetSpentToday`.
If a chain of calls can be constructed in which the owner confirms the `resetSpentToday` function and then withdraws through `execute` in a recursive call, the contract can be drained. In fact, this could be done without a recursive call, just through repeated `execute` calls alternating with the `confirm` calls.
We are still working through the confirmation protocol in `Shareable.sol`, but we are not convinced that this is impossible, in fact it looks possible. The flexibility any shared owner has in being able to revoke confirmation later is another worrisome angle of approach even if some simple patches are included.
This bug has a number of causes that need to be addressed:
1. `resetSpentToday` and `confirm` together do not limit the days on which the function can be called or (it appears) the number of times it can be called.
1. Once a call has been confirmed and `execute`d it appears that it can be re-executed. This is not good.
3. `confirmandCheck` doesn't seem to have logic about whether or not the function in question has been called.
4. Even if it did, `revoke` would need updates and logic to deal with revocation requests after a function call had been completed.
We do not recommend using the MultisigWallet until these issues are fixed.
# Moderate to Minor Issues
## PullPayment
PullPayment.sol needs some work. It has no explicit provision for cancelling a payment. This would be desirable in a number of scenarios; consider a payee losing their wallet, or giving a griefing address, or just an address that requires more than the default gas offered by `send`.
`asyncSend` has no overflow checking. This is a bad plan. We recommend overflow and underflow checking at the layer closest to the data manipulation.
`asyncSend` allows more balance to be queued up for sending than the contract holds. This is probably a bad idea, or at the very least should be called something different. If the intent is to allow this, it should have provisions for dealing with race conditions between competing `withdrawPayments` calls.
It would be nice to see how many payments are pending. This would imply a bit of a rewrite; we recommend this contract get some design time, and that developers don't rely on it in its current state.
## Shareable Contract
We do not believe the `Shareable.sol` contract is ready for primetime. It is missing functions, and as written may be vulnerable to a reordering attack -- an attack in which a miner or other party "racing" with a smart contract participant inserts their own information into a list or mapping.
The confirmation and revocation code needs to be looked over with a very careful eye imagining extraordinarily bad behavior by shared owners before this contract can be called safe.
No sanity checks on the initial constructor's `required` argument are worrisome as well.
# Line by Line Comments
## Lifecycle
### Killable
Very simple, allows owner to call selfdestruct, sending funds to owner. No issues. However, note that `selfdestruct` should typically not be used; it is common that a developer may want to access data in a former contract, and they may not understand that `selfdestruct` limits access to the contract. We recommend better documentation about this dynamic, and an alternate function name for `kill` like `completelyDestroy` while `kill` would perhaps merely send funds to the owner.
Also note that a killable function allows the owner to take funds regardless of other logic. This may be desirable or undesirable depending on the circumstances. Perhaps `Killable` should have a different name as well.
### Migrations
I presume that the goal of this contract is to allow and annotate a migration to a new smart contract address. We are not clear here how this would be accomplished by the code; we'd like to review with the OpenZeppelin team.
### Pausable
We like these pauses! Note that these allow significant griefing potential by owners, and that this might not be obvious to participants in smart contracts using the OpenZeppelin framework. We would recommend that additional sample logic be added to for instance the TokenContract showing safer use of the pause and resume functions. In particular, we would recommend a timelock after which anyone could unpause the contract.
The modifers use the pattern `if(bool){_;}`. This is fine for functions that return false upon failure, but could be problematic for functions expected to throw upon failure. See our comments above on standardizing on `throw` or `return(false)`.
## Ownership
### Ownable
Line 19: Modifier throws if doesn't meet condition, in contrast to some other inheritable modifiers (e.g. in Pausable) that use `if(bool){_;}`.
### Claimable
Inherits from Ownable but the existing owner sets a pendingOwner who has to claim ownership.
Line 17: Another modifier that throws.
### DelayedClaimable
Is there any reason to descend from Ownable directly, instead of just Claimable, which descends from Ownable? If not, descending from both just adds confusion.
### Contactable
Allows owner to set a public string of contract information. No issues.
### Shareable
This needs some work. Doesn't check if `_required <= len(_owners)` for instance, that would be a bummer. What if _required were like `MAX - 1`?
I have a general concern about the difference between `owners`, `_owners`, and `owner` in `Ownable.sol`. I recommend "Owners" be renamed. In general we do not recomment single character differences in variable names, although a preceding underscore is not uncommon in Solidity code.
Line 34: "this contract only has six types of events"...actually only two.
Line 61: Why is `ownerIndex` keyed by addresses hashed to `uint`s? Why not use the addresses directly, so `ownerIndex` is less obscure, and so there's stronger typing?
Line 62: Do not love `++i) ... owners[2+ i]`. Makes me do math, which is not what I want to do. I want to not have to do math.
There should probably be a function for adding a new operation, so the developer doesn't have to work directly with the internal data. (This would make the multisig contract even shorter.)
There's a `revoke` function but not a `propose` function that we can see.
Beware reordering. If `propose` allows the user to choose a bytes string for their proposal, bad things(TM) will happen as currently written.
### Multisig
Just an interface. Note it allows changing an owner address, but not changing the number of owners. This is somewhat limiting but also simplifies implementation.
## Payment
### PullPayment
Safe from reentrance attack since ether send is at the end, plus it uses `.send()` rather than `.call.value()`.
There's an argument to be made that `.call.value()` is a better option *if* you're sure that it will be done after all state updates, since `.send` will fail if the recipient has an expensive fallback function. However, in the context of a function meant to be embedded in other contracts, it's probably better to use `.send`. One possible compromise is to add a function which allows only the owner to send ether via `.call.value`.
If you don't use `call.value` you should implement a `cancel` function in case some value is pending here.
Line 14:
Doesn't use safeAdd. Although it appears that payout amounts can only be increased, in fact the payer could lower the payout as much as desired via overflow. Also, the payer could add a large non-overflowing amount, causing the payment to exceed the contract balance and therefore fail when withdraw is attempted.
Recommendation: track the sum of non-withdrawn asyncSends, and don't allow a new one which exceeds the leftover balance. If it's ever desirable to make payments revocable, it should be done explicitly.
## Tokens
### ERC20
Standard ERC20 interface only.
There's a security hole in the standard, reported at Edcon: `approve` does not protect against race conditions and simply replaces the current value. An approved spender could wait for the owner to call `approve` again, then attempt to spend the old limit before the new limit is applied. If successful, this attacker could successfully spend the sum of both limits.
This could be fixed by either (1) including the old limit as a parameter, so the update will fail if some gets spent, or (2) using the value parameter as a delta instead of replacement value.
This is not fixable while adhering to the current full ERC20 standard, though it would be possible to add a "secureApprove" function. The impact isn't extreme since at least you can only be attacked by addresses you approved. Also, users could mitigate this by always setting spending limits to zero and checking for spends, before setting the new limit.
Edcon slides:
https://drive.google.com/file/d/0ByMtMw2hul0EN3NCaVFHSFdxRzA/view
### ERC20Basic
Simpler interface skipping the Approve function. Note this departs from ERC20 in another way: transfer throws instead of returning false.
### BasicToken
Uses `SafeSub` and `SafeMath`, so transfer `throw`s instead of returning false. This complies with ERC20Basic but not the actual ERC20 standard.
### StandardToken
Implementation of full ERC20 token.
Transfer() and transferFrom() use SafeMath functions, which will cause them to throw instead of returning false. Not a security issue but departs from standard.
### SimpleToken
Sample instantiation of StandardToken. Note that in this sample, decimals is 18 and supply only 10,000, so the supply is a small fraction of a single nominal token.
### CrowdsaleToken
StandardToken which mints tokens at a fixed price when sent ether.
There's no provision for owner withdrawing the ether. As a sample for crowdsales it should be Ownable and allow the owner to withdraw ether, rather than stranding the ether in the contract.
Note: an alternative pattern is a mint() function which is only callable from a separate crowdsale contract, so any sort of rules can be added without modifying the token itself.
### VestedToken
Lines 23, 27:
Functions `transfer()` and `transferFrom()` have a modifier canTransfer which throws if not enough tokens are available. However, transfer() returns a boolean success. Inconsistent treatment of failure conditions may cause problems for other contracts using the token. (Note that transferableTokens() relies on safeSub(), so will also throw if there's insufficient balance.)
Line 64:
Delete not actually necessary since the value is overwritten in the next line anyway.
## Root level
### Bounty
Avoids potential race condition by having each researcher deploy a separate contract for attack; if a research manages to break his associated contract, other researchers can't immediately claim the reward, they have to reproduce the attack in their own contracts.
A developer could subvert this intent by implementing `deployContract()` to always return the same address. However, this would break the `researchers` mapping, updating the researcher address associated with the contract. This could be prevented by blocking rewrites in `researchers`.
### DayLimit
The modifier `limitedDaily` calls `underLimit`, which both checks that the spend is below the daily limit, and adds the input value to the daily spend. This is fine if all functions throw upon failure. However, not all OpenZeppelin functions do this; there are functions that returns false, and modifiers that wrap the function body in `if (bool) {_;}`. In these cases, `_value` will be added to `spentToday`, but ether may not actually be sent because other preconditions were not met. (However in the OpenZeppelin multisig this is not a problem.)
Lines 4, 11:
Comment claims that `DayLimit` is multiowned, and Shareable is imported, but DayLimit does not actually inherit from Shareable. The intent may be for child contracts to inherit from Shareable (as Multisig does); in this case the import should be removed and the comment altered.
Line 46:
Manual overflow check instead of using safeAdd. Since this is called from a function that throws upon failure anyway, there's no real downside to using safeAdd.
### LimitBalance
No issues.
### MultisigWallet
Lines 28, 76, 80:
`kill`, `setDailyLimit`, and `resetSpentToday` only happen with multisig approval, and hashes for these actions are logged by Shareable. However, they should probably post their own events for easy reading.
Line 45:
This call to underLimit will reduce the daily limit, and then either throw or return 0. So in this case there's no danger that the limit will be reduced without the operation going through.
Line 65:
Shareable's onlyManyOwners will take the user's confirmation, and execute the function body if and only if enough users have confirmed. Whole thing throws if the send fails, which will roll back the confirmation. Confirm returns false if not enough have confirmed yet, true if the whole thing succeeds, and throws only in the exceptional circumstance that the designated transaction unexpectedly fails. Elegant design.
Line 68:
Throw here is good but note this function can fail either by returning false or by throwing.
Line 92:
A bit odd to split `clearPending()` between this contract and Shareable. However this does allow contracts inheriting from Shareable to use custom structs for pending transactions.
### SafeMath
Another interesting comment from the same Edcon presentation was that the overflow behavior of Solidity is undocumented, so in theory, source code that relies on it could break with a future revision.
However, compiled code should be fine, and in the unlikely event that the compiler is revised in this way, there should be plenty of warning. (But this is an argument for keeping overflow checks isolated in SafeMath.)
Aside from that small caveat, these are fine.

View File

@ -1,58 +1,72 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.18;
import './PullPayment.sol';
import './Killable.sol';
import "./payment/PullPayment.sol";
import "./lifecycle/Destructible.sol";
/*
* Bounty
*
* This bounty will pay out to a researcher if they break invariant logic of the contract.
/**
* @title Bounty
* @dev This bounty will pay out to a researcher if they break invariant logic of the contract.
*/
contract Bounty is PullPayment, Killable {
Target target;
contract Bounty is PullPayment, Destructible {
bool public claimed;
mapping(address => address) public researchers;
event TargetCreated(address createdAddress);
function() payable {
if (claimed) throw;
/**
* @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed.
*/
function() external payable {
require(!claimed);
}
function createTarget() returns(Target) {
target = Target(deployContract());
/**
* @dev Create and deploy the target contract (extension of Target contract), and sets the
* msg.sender as a researcher
* @return A target contract
*/
function createTarget() public returns(Target) {
Target target = Target(deployContract());
researchers[target] = msg.sender;
TargetCreated(target);
return target;
}
function deployContract() internal returns(address);
function checkInvariant() returns(bool){
return target.checkInvariant();
}
function claim(Target target) {
/**
* @dev Sends the contract funds to the researcher that proved the contract is broken.
* @param target contract
*/
function claim(Target target) public {
address researcher = researchers[target];
if (researcher == 0) throw;
require(researcher != 0);
// Check Target contract invariants
if (target.checkInvariant()) {
throw;
}
require(!target.checkInvariant());
asyncSend(researcher, this.balance);
claimed = true;
}
/**
* @dev Internal function to deploy the target contract.
* @return A target contract address
*/
function deployContract() internal returns(address);
}
/*
* Target
*
* Your main contract should inherit from this class and implement the checkInvariant method. This is a function that should check everything your contract assumes to be true all the time. If this function returns false, it means your contract was broken in some way and is in an inconsistent state. This is what security researchers will try to acomplish when trying to get the bounty.
/**
* @title Target
* @dev Your main contract should inherit from this class and implement the checkInvariant method.
*/
contract Target {
function checkInvariant() returns(bool);
}
/**
* @dev Checks all values a contract assumes to be true all the time. If this function returns
* false, the contract is broken in some way and is in an inconsistent state.
* In order to win the bounty, security researchers will try to cause this broken state.
* @return True if all invariant values are correct, false otherwise.
*/
function checkInvariant() public returns(bool);
}

View File

@ -1,29 +0,0 @@
pragma solidity ^0.4.0;
import './Ownable.sol';
/*
* Claimable
*
* Extension for the Ownable contract, where the ownership needs to be claimed. This allows the new owner to accept the transfer.
*/
contract Claimable is Ownable {
address public pendingOwner;
modifier onlyPendingOwner() {
if (msg.sender == pendingOwner)
_;
}
function transferOwnership(address newOwner) onlyOwner {
pendingOwner = newOwner;
}
function claimOwnership() onlyPendingOwner {
owner = pendingOwner;
pendingOwner = 0x0;
}
}

View File

@ -1,59 +1,47 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.18;
import './Shareable.sol';
/*
* DayLimit
*
* inheritable "property" contract that enables methods to be protected by placing a linear limit (specifiable)
* on a particular resource per calendar day. is multiowned to allow the limit to be altered. resource that method
* uses is specified in the modifier.
/**
* @title DayLimit
* @dev Base contract that enables methods to be protected by placing a linear limit (specifiable)
* on a particular resource per calendar day. Is multiowned to allow the limit to be altered.
*/
contract DayLimit {
// FIELDS
uint public dailyLimit;
uint public spentToday;
uint public lastDay;
uint256 public dailyLimit;
uint256 public spentToday;
uint256 public lastDay;
// MODIFIERS
// simple modifier for daily limit.
modifier limitedDaily(uint _value) {
if (underLimit(_value))
_;
}
// CONSTRUCTOR
// stores initial daily limit and records the present day's index.
function DayLimit(uint _limit) {
/**
* @dev Constructor that sets the passed value as a dailyLimit.
* @param _limit uint256 to represent the daily limit.
*/
function DayLimit(uint256 _limit) public {
dailyLimit = _limit;
lastDay = today();
}
// METHODS
// (re)sets the daily limit. doesn't alter the amount already spent today.
function _setDailyLimit(uint _newLimit) internal {
/**
* @dev sets the daily limit. Does not alter the amount already spent today.
* @param _newLimit uint256 to represent the new limit.
*/
function _setDailyLimit(uint256 _newLimit) internal {
dailyLimit = _newLimit;
}
// resets the amount already spent today.
/**
* @dev Resets the amount already spent today.
*/
function _resetSpentToday() internal {
spentToday = 0;
}
// INTERNAL METHODS
// checks to see if there is at least `_value` left from the daily limit today. if there is, subtracts it and
// returns true. otherwise just returns false.
function underLimit(uint _value) internal returns (bool) {
/**
* @dev Checks to see if there is enough resource to spend today. If true, the resource may be expended.
* @param _value uint256 representing the amount of resource to spend.
* @return A boolean that is True if the resource was spent and false otherwise.
*/
function underLimit(uint256 _value) internal returns (bool) {
// reset the spend limit if we're on a different day to last time.
if (today() > lastDay) {
spentToday = 0;
@ -68,8 +56,19 @@ contract DayLimit {
return false;
}
// determines today's index.
function today() private constant returns (uint) {
/**
* @dev Private function to determine today's index
* @return uint256 of today's index.
*/
function today() private view returns (uint256) {
return now / 1 days;
}
/**
* @dev Simple modifier for daily limit.
*/
modifier limitedDaily(uint256 _value) {
require(underLimit(_value));
_;
}
}

View File

@ -1,30 +0,0 @@
pragma solidity ^0.4.4;
import './Ownable.sol';
import './Claimable.sol';
/*
* DelayedClaimable
* Extension for the Claimable contract, where the ownership needs to be claimed before/after certain block number
*/
contract DelayedClaimable is Ownable, Claimable {
uint public claimBeforeBlock;
uint public claimAfterBlock;
function setClaimBlocks(uint _claimBeforeBlock, uint _claimAfterBlock) onlyOwner {
if (_claimAfterBlock > claimBeforeBlock)
throw;
claimBeforeBlock = _claimBeforeBlock;
claimAfterBlock = _claimAfterBlock;
}
function claimOwnership() onlyPendingOwner {
if ((block.number > claimBeforeBlock) || (block.number < claimAfterBlock))
throw;
owner = pendingOwner;
pendingOwner = 0x0;
claimBeforeBlock = 0;
}
}

47
contracts/ECRecovery.sol Normal file
View File

@ -0,0 +1,47 @@
pragma solidity ^0.4.18;
/**
* @title Eliptic curve signature operations
*
* @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
*/
library ECRecovery {
/**
* @dev Recover signer address from a message by using his signature
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes sig) public pure returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
//Check the signature length
if (sig.length != 65) {
return (address(0));
}
// Divide the signature in r, s and v variables
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
// Version of signature should be 27 or 28, but 0 and 1 are also possible versions
if (v < 27) {
v += 27;
}
// If the version is correct return the signer address
if (v != 27 && v != 28) {
return (address(0));
} else {
return ecrecover(hash, v, r, s);
}
}
}

View File

@ -1,15 +0,0 @@
pragma solidity ^0.4.4;
import "./Ownable.sol";
/*
* Killable
* Base contract that can be killed by owner. All funds in contract will be sent to the owner.
*/
contract Killable is Ownable {
function kill() onlyOwner {
selfdestruct(owner);
}
}

View File

@ -1,27 +1,31 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.18;
/**
* LimitBalance
* Simple contract to limit the balance of child contract.
* Note this doesn't prevent other contracts to send funds
* by using selfdestruct(address);
* See: https://github.com/ConsenSys/smart-contract-best-practices#remember-that-ether-can-be-forcibly-sent-to-an-account
* @title LimitBalance
* @dev Simple contract to limit the balance of child contract.
* @dev Note this doesn't prevent other contracts to send funds by using selfdestruct(address);
* @dev See: https://github.com/ConsenSys/smart-contract-best-practices#remember-that-ether-can-be-forcibly-sent-to-an-account
*/
contract LimitBalance {
uint public limit;
uint256 public limit;
function LimitBalance(uint _limit) {
/**
* @dev Constructor that sets the passed value as a limit.
* @param _limit uint256 to represent the limit.
*/
function LimitBalance(uint256 _limit) public {
limit = _limit;
}
modifier limitedPayable() {
if (this.balance > limit) {
throw;
}
/**
* @dev Checks if limit was reached. Case true, it throws.
*/
modifier limitedPayable() {
require(this.balance <= limit);
_;
}
}

44
contracts/MerkleProof.sol Normal file
View File

@ -0,0 +1,44 @@
pragma solidity ^0.4.18;
/*
* @title MerkleProof
* @dev Merkle proof verification
* @note Based on https://github.com/ameensol/merkle-tree-solidity/blob/master/src/MerkleProof.sol
*/
library MerkleProof {
/*
* @dev Verifies a Merkle proof proving the existence of a leaf in a Merkle tree. Assumes that each pair of leaves
* and each pair of pre-images is sorted.
* @param _proof Merkle proof containing sibling hashes on the branch from the leaf to the root of the Merkle tree
* @param _root Merkle root
* @param _leaf Leaf of Merkle tree
*/
function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) public pure returns (bool) {
// Check if proof length is a multiple of 32
if (_proof.length % 32 != 0) {
return false;
}
bytes32 proofElement;
bytes32 computedHash = _leaf;
for (uint256 i = 32; i <= _proof.length; i += 32) {
assembly {
// Load the current element of the proof
proofElement := mload(add(_proof, i))
}
if (computedHash < proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(proofElement, computedHash);
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == _root;
}
}

View File

@ -1,18 +0,0 @@
pragma solidity ^0.4.4;
import './Ownable.sol';
contract Migrations is Ownable {
uint public lastCompletedMigration;
function setCompleted(uint completed) onlyOwner {
lastCompletedMigration = completed;
}
function upgrade(address newAddress) onlyOwner {
Migrations upgraded = Migrations(newAddress);
upgraded.setCompleted(lastCompletedMigration);
}
}

View File

@ -1,29 +0,0 @@
pragma solidity ^0.4.4;
/*
* Multisig
* Interface contract for multisig proxy contracts; see below for docs.
*/
contract Multisig {
// EVENTS
// logged events:
// Funds has arrived into the wallet (record how much).
event Deposit(address _from, uint value);
// Single transaction going out of the wallet (record who signed for it, how much, and to whom it's going).
event SingleTransact(address owner, uint value, address to, bytes data);
// Multi-sig transaction going out of the wallet (record who signed for it last, the operation hash, how much, and to whom it's going).
event MultiTransact(address owner, bytes32 operation, uint value, address to, bytes data);
// Confirmation still needed for a transaction.
event ConfirmationNeeded(bytes32 operation, address initiator, uint value, address to, bytes data);
// FUNCTIONS
// TODO: document
function changeOwner(address _from, address _to) external;
function execute(address _to, uint _value, bytes _data) external returns (bytes32);
function confirm(bytes32 _h) returns (bool);
}

View File

@ -1,110 +0,0 @@
pragma solidity ^0.4.4;
import "./Multisig.sol";
import "./Shareable.sol";
import "./DayLimit.sol";
/*
* MultisigWallet
* usage:
* bytes32 h = Wallet(w).from(oneOwner).execute(to, value, data);
* Wallet(w).from(anotherOwner).confirm(h);
*/
contract MultisigWallet is Multisig, Shareable, DayLimit {
// TYPES
// Transaction structure to remember details of transaction lest it need be saved for a later call.
struct Transaction {
address to;
uint value;
bytes data;
}
// CONSTRUCTOR
// just pass on the owner array to the multiowned and
// the limit to daylimit
function MultisigWallet(address[] _owners, uint _required, uint _daylimit)
Shareable(_owners, _required)
DayLimit(_daylimit) { }
// METHODS
// kills the contract sending everything to `_to`.
function kill(address _to) onlymanyowners(sha3(msg.data)) external {
suicide(_to);
}
// gets called when no other function matches
function() payable {
// just being sent some cash?
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
// Outside-visible transact entry point. Executes transaction immediately if below daily spend limit.
// If not, goes into multisig process. We provide a hash on return to allow the sender to provide
// shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value
// and _data arguments). They still get the option of using them if they want, anyways.
function execute(address _to, uint _value, bytes _data) external onlyOwner returns (bytes32 _r) {
// first, take the opportunity to check that we're under the daily limit.
if (underLimit(_value)) {
SingleTransact(msg.sender, _value, _to, _data);
// yes - just execute the call.
if (!_to.call.value(_value)(_data)) {
throw;
}
return 0;
}
// determine our operation hash.
_r = sha3(msg.data, block.number);
if (!confirm(_r) && txs[_r].to == 0) {
txs[_r].to = _to;
txs[_r].value = _value;
txs[_r].data = _data;
ConfirmationNeeded(_r, msg.sender, _value, _to, _data);
}
}
// confirm a transaction through just the hash. we use the previous transactions map, txs, in order
// to determine the body of the transaction from the hash provided.
function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) {
if (txs[_h].to != 0) {
if (!txs[_h].to.call.value(txs[_h].value)(txs[_h].data)) {
throw;
}
MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data);
delete txs[_h];
return true;
}
}
function setDailyLimit(uint _newLimit) onlymanyowners(sha3(msg.data)) external {
_setDailyLimit(_newLimit);
}
function resetSpentToday() onlymanyowners(sha3(msg.data)) external {
_resetSpentToday();
}
// INTERNAL METHODS
function clearPending() internal {
uint length = pendingsIndex.length;
for (uint i = 0; i < length; ++i) {
delete txs[pendingsIndex[i]];
}
super.clearPending();
}
// FIELDS
// pending transactions we have at present.
mapping (bytes32 => Transaction) txs;
}

View File

@ -1,26 +0,0 @@
pragma solidity ^0.4.4;
/*
* Ownable
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender == owner)
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) owner = newOwner;
}
}

View File

@ -1,30 +0,0 @@
pragma solidity ^0.4.4;
/*
* PullPayment
* Base contract supporting async send for pull payments.
* Inherit from this contract and use asyncSend instead of send.
*/
contract PullPayment {
mapping(address => uint) public payments;
// store sent amount as credit to be pulled, called by payer
function asyncSend(address dest, uint amount) internal {
payments[dest] += amount;
}
// withdraw accumulated balance, called by payee
function withdrawPayments() {
address payee = msg.sender;
uint payment = payments[payee];
if (payment == 0) throw;
if (this.balance < payment) throw;
payments[payee] = 0;
if (!payee.send(payment)) {
throw;
}
}
}

View File

@ -0,0 +1,32 @@
pragma solidity ^0.4.18;
/**
* @title Helps contracts guard agains reentrancy attacks.
* @author Remco Bloemen <remco@2π.com>
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`.
*/
contract ReentrancyGuard {
/**
* @dev We use a single lock for the whole contract.
*/
bool private reentrancy_lock = false;
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @notice If you mark a function `nonReentrant`, you should also
* mark it `external`. Calling one nonReentrant function from
* another is not supported. Instead, you can implement a
* `private` function doing the actual work, and a `external`
* wrapper marked as `nonReentrant`.
*/
modifier nonReentrant() {
require(!reentrancy_lock);
reentrancy_lock = true;
_;
reentrancy_lock = false;
}
}

View File

@ -1,29 +0,0 @@
pragma solidity ^0.4.4;
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function assert(bool assertion) internal {
if (!assertion) throw;
}
}

View File

@ -1,164 +0,0 @@
pragma solidity ^0.4.4;
/*
* Shareable
*
* Based on https://github.com/ethereum/dapp-bin/blob/master/wallet/wallet.sol
*
* inheritable "property" contract that enables methods to be protected by requiring the acquiescence of either a single, or, crucially, each of a number of, designated owners.
*
* usage:
* use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by some number (specified in constructor) of the set of owners (specified in the constructor) before the interior is executed.
*/
contract Shareable {
// TYPES
// struct for the status of a pending operation.
struct PendingState {
uint yetNeeded;
uint ownersDone;
uint index;
}
// FIELDS
// the number of owners that must confirm the same operation before it is run.
uint public required;
// list of owners
uint[256] owners;
uint constant c_maxOwners = 250;
// index on the list of owners to allow reverse lookup
mapping(uint => uint) ownerIndex;
// the ongoing operations.
mapping(bytes32 => PendingState) pendings;
bytes32[] pendingsIndex;
// EVENTS
// this contract only has six types of events: it can accept a confirmation, in which case
// we record owner and operation (hash) alongside it.
event Confirmation(address owner, bytes32 operation);
event Revoke(address owner, bytes32 operation);
// MODIFIERS
// simple single-sig function modifier.
modifier onlyOwner {
if (isOwner(msg.sender))
_;
}
// multi-sig function modifier: the operation must have an intrinsic hash in order
// that later attempts can be realised as the same underlying operation and
// thus count as confirmations.
modifier onlymanyowners(bytes32 _operation) {
if (confirmAndCheck(_operation))
_;
}
// CONSTRUCTOR
// constructor is given number of sigs required to do protected "onlymanyowners" transactions
// as well as the selection of addresses capable of confirming them.
function Shareable(address[] _owners, uint _required) {
owners[1] = uint(msg.sender);
ownerIndex[uint(msg.sender)] = 1;
for (uint i = 0; i < _owners.length; ++i) {
owners[2 + i] = uint(_owners[i]);
ownerIndex[uint(_owners[i])] = 2 + i;
}
required = _required;
}
// METHODS
// Revokes a prior confirmation of the given operation
function revoke(bytes32 _operation) external {
uint index = ownerIndex[uint(msg.sender)];
// make sure they're an owner
if (index == 0) return;
uint ownerIndexBit = 2**index;
var pending = pendings[_operation];
if (pending.ownersDone & ownerIndexBit > 0) {
pending.yetNeeded++;
pending.ownersDone -= ownerIndexBit;
Revoke(msg.sender, _operation);
}
}
// Gets an owner by 0-indexed position (using numOwners as the count)
function getOwner(uint ownerIndex) external constant returns (address) {
return address(owners[ownerIndex + 1]);
}
function isOwner(address _addr) constant returns (bool) {
return ownerIndex[uint(_addr)] > 0;
}
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
var pending = pendings[_operation];
uint index = ownerIndex[uint(_owner)];
// make sure they're an owner
if (index == 0) return false;
// determine the bit to set for this owner.
uint ownerIndexBit = 2**index;
return !(pending.ownersDone & ownerIndexBit == 0);
}
// INTERNAL METHODS
function confirmAndCheck(bytes32 _operation) internal returns (bool) {
// determine what index the present sender is:
uint index = ownerIndex[uint(msg.sender)];
// make sure they're an owner
if (index == 0) return;
var pending = pendings[_operation];
// if we're not yet working on this operation, switch over and reset the confirmation status.
if (pending.yetNeeded == 0) {
// reset count of confirmations needed.
pending.yetNeeded = required;
// reset which owners have confirmed (none) - set our bitmap to 0.
pending.ownersDone = 0;
pending.index = pendingsIndex.length++;
pendingsIndex[pending.index] = _operation;
}
// determine the bit to set for this owner.
uint ownerIndexBit = 2**index;
// make sure we (the message sender) haven't confirmed this operation previously.
if (pending.ownersDone & ownerIndexBit == 0) {
Confirmation(msg.sender, _operation);
// ok - check if count is enough to go ahead.
if (pending.yetNeeded <= 1) {
// enough confirmations: reset and run interior.
delete pendingsIndex[pendings[_operation].index];
delete pendings[_operation];
return true;
}
else
{
// not enough: record that this owner in particular confirmed.
pending.yetNeeded--;
pending.ownersDone |= ownerIndexBit;
}
}
}
function clearPending() internal {
uint length = pendingsIndex.length;
for (uint i = 0; i < length; ++i)
if (pendingsIndex[i] != 0)
delete pendings[pendingsIndex[i]];
delete pendingsIndex;
}
}

View File

@ -1,28 +0,0 @@
pragma solidity ^0.4.4;
import "./Ownable.sol";
/*
* Stoppable
* Abstract contract that allows children to implement an
* emergency stop mechanism.
*/
contract Stoppable is Ownable {
bool public stopped;
modifier stopInEmergency { if (!stopped) _; }
modifier onlyInEmergency { if (stopped) _; }
// called by the owner on emergency, triggers stopped state
function emergencyStop() external onlyOwner {
stopped = true;
}
// called by the owner on end of emergency, returns to normal state
function release() external onlyOwner onlyInEmergency {
stopped = false;
}
}

View File

@ -0,0 +1,35 @@
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
import "./Crowdsale.sol";
/**
* @title CappedCrowdsale
* @dev Extension of Crowdsale with a max amount of funds raised
*/
contract CappedCrowdsale is Crowdsale {
using SafeMath for uint256;
uint256 public cap;
function CappedCrowdsale(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
// overriding Crowdsale#hasEnded to add cap logic
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
bool capReached = weiRaised >= cap;
return capReached || super.hasEnded();
}
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function validPurchase() internal view returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap;
return withinCap && super.validPurchase();
}
}

View File

@ -0,0 +1,110 @@
pragma solidity ^0.4.18;
import "../token/ERC20/MintableToken.sol";
import "../math/SafeMath.sol";
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) public {
require(_startTime >= now);
require(_endTime >= _startTime);
require(_rate > 0);
require(_wallet != address(0));
token = createTokenContract();
startTime = _startTime;
endTime = _endTime;
rate = _rate;
wallet = _wallet;
}
// fallback function can be used to buy tokens
function () external payable {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != address(0));
require(validPurchase());
uint256 weiAmount = msg.value;
// calculate token amount to be created
uint256 tokens = getTokenAmount(weiAmount);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
// @return true if crowdsale event has ended
function hasEnded() public view returns (bool) {
return now > endTime;
}
// creates the token to be sold.
// override this method to have crowdsale of a specific mintable token.
function createTokenContract() internal returns (MintableToken) {
return new MintableToken();
}
// Override this method to have a way to add business logic to your crowdsale when buying
function getTokenAmount(uint256 weiAmount) internal view returns(uint256) {
return weiAmount.mul(rate);
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// @return true if the transaction can buy tokens
function validPurchase() internal view returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
}
}

View File

@ -0,0 +1,41 @@
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
import "../ownership/Ownable.sol";
import "./Crowdsale.sol";
/**
* @title FinalizableCrowdsale
* @dev Extension of Crowdsale where an owner can do extra work
* after finishing.
*/
contract FinalizableCrowdsale is Crowdsale, Ownable {
using SafeMath for uint256;
bool public isFinalized = false;
event Finalized();
/**
* @dev Must be called after crowdsale ends, to do some extra finalization
* work. Calls the contract's finalization function.
*/
function finalize() onlyOwner public {
require(!isFinalized);
require(hasEnded());
finalization();
Finalized();
isFinalized = true;
}
/**
* @dev Can be overridden to add finalization logic. The overriding function
* should call super.finalization() to ensure the chain of finalization is
* executed entirely.
*/
function finalization() internal {
}
}

View File

@ -0,0 +1,57 @@
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
import "../ownership/Ownable.sol";
/**
* @title RefundVault
* @dev This contract is used for storing funds while a crowdsale
* is in progress. Supports refunding the money if crowdsale fails,
* and forwarding it if crowdsale is successful.
*/
contract RefundVault is Ownable {
using SafeMath for uint256;
enum State { Active, Refunding, Closed }
mapping (address => uint256) public deposited;
address public wallet;
State public state;
event Closed();
event RefundsEnabled();
event Refunded(address indexed beneficiary, uint256 weiAmount);
function RefundVault(address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
state = State.Active;
}
function deposit(address investor) onlyOwner public payable {
require(state == State.Active);
deposited[investor] = deposited[investor].add(msg.value);
}
function close() onlyOwner public {
require(state == State.Active);
state = State.Closed;
Closed();
wallet.transfer(this.balance);
}
function enableRefunds() onlyOwner public {
require(state == State.Active);
state = State.Refunding;
RefundsEnabled();
}
function refund(address investor) public {
require(state == State.Refunding);
uint256 depositedValue = deposited[investor];
deposited[investor] = 0;
investor.transfer(depositedValue);
Refunded(investor, depositedValue);
}
}

View File

@ -0,0 +1,60 @@
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
import "./FinalizableCrowdsale.sol";
import "./RefundVault.sol";
/**
* @title RefundableCrowdsale
* @dev Extension of Crowdsale contract that adds a funding goal, and
* the possibility of users getting a refund if goal is not met.
* Uses a RefundVault as the crowdsale's vault.
*/
contract RefundableCrowdsale is FinalizableCrowdsale {
using SafeMath for uint256;
// minimum amount of funds to be raised in weis
uint256 public goal;
// refund vault used to hold funds while crowdsale is running
RefundVault public vault;
function RefundableCrowdsale(uint256 _goal) public {
require(_goal > 0);
vault = new RefundVault(wallet);
goal = _goal;
}
// if crowdsale is unsuccessful, investors can claim refunds here
function claimRefund() public {
require(isFinalized);
require(!goalReached());
vault.refund(msg.sender);
}
function goalReached() public view returns (bool) {
return weiRaised >= goal;
}
// vault finalization task, called when owner calls finalize()
function finalization() internal {
if (goalReached()) {
vault.close();
} else {
vault.enableRefunds();
}
super.finalization();
}
// We're overriding the fund forwarding from Crowdsale.
// In addition to sending the funds, we want to call
// the RefundVault deposit function
function forwardFunds() internal {
vault.deposit.value(msg.value)(msg.sender);
}
}

View File

@ -1,23 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
// UNSAFE CODE, DO NOT USE!
contract BadArrayUse is PullPayment {
address[] employees;
function payBonus() {
for (var i = 0; i < employees.length; i++) {
address employee = employees[i];
uint bonus = calculateBonus(employee);
asyncSend(employee, bonus);
}
}
function calculateBonus(address employee) returns (uint) {
// some expensive computation...
}
}

View File

@ -1,17 +0,0 @@
pragma solidity ^0.4.4;
// UNSAFE CODE, DO NOT USE!
contract BadFailEarly {
uint constant DEFAULT_SALARY = 50000;
mapping(string => uint) nameToSalary;
function getSalary(string name) constant returns (uint) {
if (bytes(name).length != 0 && nameToSalary[name] != 0) {
return nameToSalary[name];
} else {
return DEFAULT_SALARY;
}
}
}

View File

@ -1,23 +0,0 @@
pragma solidity ^0.4.4;
// UNSAFE CODE, DO NOT USE!
contract BadPushPayments {
address highestBidder;
uint highestBid;
function bid() payable {
if (msg.value < highestBid) throw;
if (highestBidder != 0) {
// return bid to previous winner
if (!highestBidder.send(highestBid)) {
throw;
}
}
highestBidder = msg.sender;
highestBid = msg.value;
}
}

View File

@ -1,25 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
contract GoodArrayUse is PullPayment {
address[] employees;
mapping(address => uint) bonuses;
function payBonus() {
for (uint i = 0; i < employees.length; i++) {
address employee = employees[i];
uint bonus = bonuses[employee];
asyncSend(employee, bonus);
}
}
function calculateBonus(address employee) returns (uint) {
uint bonus = 0;
// some expensive computation...
bonuses[employee] = bonus;
}
}

View File

@ -1,15 +0,0 @@
pragma solidity ^0.4.4;
contract GoodFailEarly {
uint constant DEFAULT_SALARY = 50000;
mapping(string => uint) nameToSalary;
function getSalary(string name) constant returns (uint) {
if (bytes(name).length == 0) throw;
if (nameToSalary[name] == 0) throw;
return nameToSalary[name];
}
}

View File

@ -1,27 +0,0 @@
pragma solidity ^0.4.4;
contract GoodPullPayments {
address highestBidder;
uint highestBid;
mapping(address => uint) refunds;
function bid() external payable {
if (msg.value < highestBid) throw;
if (highestBidder != 0) {
refunds[highestBidder] += highestBid;
}
highestBidder = msg.sender;
highestBid = msg.value;
}
function withdrawBid() external {
uint refund = refunds[msg.sender];
refunds[msg.sender] = 0;
if (!msg.sender.send(refund)) {
refunds[msg.sender] = refund;
}
}
}

View File

@ -1,38 +0,0 @@
pragma solidity ^0.4.4;
/*
* Proof of Existence example contract
* see https://medium.com/zeppelin-blog/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05
*/
contract ProofOfExistence {
mapping (bytes32 => bool) public proofs;
// store a proof of existence in the contract state
function storeProof(bytes32 proof) {
proofs[proof] = true;
}
// calculate and store the proof for a document
function notarize(string document) {
var proof = calculateProof(document);
storeProof(proof);
}
// helper function to get a document's sha256
function calculateProof(string document) constant returns (bytes32) {
return sha256(document);
}
// check if a document has been notarized
function checkDocument(string document) constant returns (bool) {
var proof = calculateProof(document);
return hasProof(proof);
}
// returns true if proof is stored
function hasProof(bytes32 proof) constant returns (bool) {
return proofs[proof];
}
}

View File

@ -1,20 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
contract PullPaymentBid is PullPayment {
address public highestBidder;
uint public highestBid;
function bid() external payable {
if (msg.value <= highestBid) throw;
if (highestBidder != 0) {
asyncSend(highestBidder, highestBid);
}
highestBidder = msg.sender;
highestBid = msg.value;
}
}

View File

@ -0,0 +1,50 @@
pragma solidity ^0.4.18;
import "../crowdsale/CappedCrowdsale.sol";
import "../crowdsale/RefundableCrowdsale.sol";
import "../token/ERC20/MintableToken.sol";
/**
* @title SampleCrowdsaleToken
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract SampleCrowdsaleToken is MintableToken {
string public constant name = "Sample Crowdsale Token"; // solium-disable-line uppercase
string public constant symbol = "SCT"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
}
/**
* @title SampleCrowdsale
* @dev This is an example of a fully fledged crowdsale.
* The way to add new features to a base crowdsale is by multiple inheritance.
* In this example we are providing following extensions:
* CappedCrowdsale - sets a max boundary for raised funds
* RefundableCrowdsale - set a min goal to be reached and returns funds if it's not met
*
* After adding multiple features it's good practice to run integration tests
* to ensure that subcontracts works together as intended.
*/
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale {
function SampleCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet) public
CappedCrowdsale(_cap)
FinalizableCrowdsale()
RefundableCrowdsale(_goal)
Crowdsale(_startTime, _endTime, _rate, _wallet)
{
//As goal needs to be met for a successful crowdsale
//the value needs to less or equal than a cap which is limit for accepted funds
require(_goal <= _cap);
}
function createTokenContract() internal returns (MintableToken) {
return new SampleCrowdsaleToken();
}
}

View File

@ -0,0 +1,40 @@
pragma solidity ^0.4.11;
import "../ownership/Heritable.sol";
/**
* @title SimpleSavingsWallet
* @dev Simplest form of savings wallet whose ownership can be claimed by a heir
* if owner dies.
* In this example, we take a very simple savings wallet providing two operations
* (to send and receive funds) and extend its capabilities by making it Heritable.
* The account that creates the contract is set as owner, who has the authority to
* choose an heir account. Heir account can reclaim the contract ownership in the
* case that the owner dies.
*/
contract SimpleSavingsWallet is Heritable {
event Sent(address indexed payee, uint256 amount, uint256 balance);
event Received(address indexed payer, uint256 amount, uint256 balance);
function SimpleSavingsWallet(uint256 _heartbeatTimeout) Heritable(_heartbeatTimeout) public {}
/**
* @dev wallet can receive funds.
*/
function () public payable {
Received(msg.sender, msg.value, this.balance);
}
/**
* @dev wallet can send funds
*/
function sendTo(address payee, uint256 amount) public onlyOwner {
require(payee != 0 && payee != address(this));
require(amount > 0);
payee.transfer(amount);
Sent(payee, amount, this.balance);
}
}

View File

@ -0,0 +1,30 @@
pragma solidity ^0.4.18;
import "../token/ERC20/StandardToken.sol";
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
*/
contract SimpleToken is StandardToken {
string public constant name = "SimpleToken"; // solium-disable-line uppercase
string public constant symbol = "SIM"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function SimpleToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}

View File

@ -1,26 +0,0 @@
pragma solidity ^0.4.4;
import '../PullPayment.sol';
import '../Stoppable.sol';
contract StoppableBid is Stoppable, PullPayment {
address public highestBidder;
uint public highestBid;
function bid() external payable stopInEmergency {
if (msg.value <= highestBid) throw;
if (highestBidder != 0) {
asyncSend(highestBidder, highestBid);
}
highestBidder = msg.sender;
highestBid = msg.value;
}
function withdraw() onlyInEmergency {
selfdestruct(owner);
}
}

View File

@ -0,0 +1,25 @@
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
/**
* @title Destructible
* @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
*/
contract Destructible is Ownable {
function Destructible() public payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfdestruct(_recipient);
}
}

View File

@ -0,0 +1,21 @@
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
/**
* @title Migrations
* @dev This is a truffle contract, needed for truffle integration, not meant for use by Zeppelin users.
*/
contract Migrations is Ownable {
uint256 public lastCompletedMigration;
function setCompleted(uint256 completed) onlyOwner public {
lastCompletedMigration = completed;
}
function upgrade(address newAddress) onlyOwner public {
Migrations upgraded = Migrations(newAddress);
upgraded.setCompleted(lastCompletedMigration);
}
}

View File

@ -0,0 +1,49 @@
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}

View File

@ -0,0 +1,36 @@
pragma solidity ^0.4.18;
import "../ownership/Ownable.sol";
import "../token/ERC20/ERC20Basic.sol";
/**
* @title TokenDestructible:
* @author Remco Bloemen <remco@2π.com>
* @dev Base contract that can be destroyed by owner. All funds in contract including
* listed tokens will be sent to the owner.
*/
contract TokenDestructible is Ownable {
function TokenDestructible() public payable { }
/**
* @notice Terminate contract and refund to owner
* @param tokens List of addresses of ERC20 or ERC20Basic token contracts to
refund.
* @notice The called token contracts could try to re-enter this contract. Only
supply token contracts you trust.
*/
function destroy(address[] tokens) onlyOwner public {
// Transfer tokens to owner
for (uint256 i = 0; i < tokens.length; i++) {
ERC20Basic token = ERC20Basic(tokens[i]);
uint256 balance = token.balanceOf(this);
token.transfer(owner, balance);
}
// Transfer Eth to owner and terminate contract
selfdestruct(owner);
}
}

24
contracts/math/Math.sol Normal file
View File

@ -0,0 +1,24 @@
pragma solidity ^0.4.18;
/**
* @title Math
* @dev Assorted math operations
*/
library Math {
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}

View File

@ -0,0 +1,48 @@
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}

View File

@ -0,0 +1,15 @@
pragma solidity ^0.4.18;
import "../token/ERC20/BasicToken.sol";
// mock class using BasicToken
contract BasicTokenMock is BasicToken {
function BasicTokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}
}

View File

@ -0,0 +1,13 @@
pragma solidity ^0.4.18;
import "../token/ERC20/BurnableToken.sol";
contract BurnableTokenMock is BurnableToken {
function BurnableTokenMock(address initialAccount, uint initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}
}

View File

@ -0,0 +1,21 @@
pragma solidity ^0.4.18;
import "../crowdsale/CappedCrowdsale.sol";
contract CappedCrowdsaleImpl is CappedCrowdsale {
function CappedCrowdsaleImpl (
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet,
uint256 _cap
) public
Crowdsale(_startTime, _endTime, _rate, _wallet)
CappedCrowdsale(_cap)
{
}
}

View File

@ -0,0 +1,25 @@
pragma solidity ^0.4.18;
import "../../contracts/DayLimit.sol";
contract DayLimitMock is DayLimit {
uint256 public totalSpending;
function DayLimitMock(uint256 _value) public DayLimit(_value) {
totalSpending = 0;
}
function attemptSpend(uint256 _value) external limitedDaily(_value) {
totalSpending += _value;
}
function setDailyLimit(uint256 _newLimit) external {
_setDailyLimit(_newLimit);
}
function resetSpentToday() external {
_resetSpentToday();
}
}

View File

@ -0,0 +1,9 @@
pragma solidity ^0.4.18;
import "../token/ERC20/StandardToken.sol";
import "../token/ERC20/DetailedERC20.sol";
contract DetailedERC20Mock is StandardToken, DetailedERC20 {
function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) public {}
}

View File

@ -0,0 +1,16 @@
pragma solidity ^0.4.18;
import "../ECRecovery.sol";
contract ECRecoveryMock {
using ECRecovery for bytes32;
address public addrRecovered;
function recover(bytes32 hash, bytes sig) public returns (address) {
addrRecovered = hash.recover(sig);
}
}

View File

@ -0,0 +1,31 @@
pragma solidity ^0.4.18;
import "../token/ERC20/BasicToken.sol";
contract ERC223ContractInterface {
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
contract ERC223TokenMock is BasicToken {
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}
// ERC223 compatible transfer function (except the name)
function transferERC223(address _to, uint256 _value, bytes _data) public
returns (bool success)
{
transfer(_to, _value);
bool is_contract = false;
assembly {
is_contract := not(iszero(extcodesize(_to)))
}
if (is_contract) {
ERC223ContractInterface receiver = ERC223ContractInterface(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
return true;
}
}

View File

@ -0,0 +1,19 @@
pragma solidity ^0.4.18;
import "../token/ERC721/ERC721Token.sol";
/**
* @title ERC721TokenMock
* This mock just provides a public mint and burn functions for testing purposes.
*/
contract ERC721TokenMock is ERC721Token {
function ERC721TokenMock() ERC721Token() public { }
function mint(address _to, uint256 _tokenId) public {
super._mint(_to, _tokenId);
}
function burn(uint256 _tokenId) public {
super._burn(_tokenId);
}
}

View File

@ -0,0 +1,15 @@
pragma solidity ^0.4.13;
import "../token/ERC827/ERC827Token.sol";
// mock class using ERC827 Token
contract ERC827TokenMock is ERC827Token {
function ERC827TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}
}

View File

@ -0,0 +1,19 @@
pragma solidity ^0.4.18;
import "../crowdsale/FinalizableCrowdsale.sol";
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
function FinalizableCrowdsaleImpl (
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet
) public
Crowdsale(_startTime, _endTime, _rate, _wallet)
{
}
}

View File

@ -0,0 +1,16 @@
pragma solidity ^0.4.18;
// @title Force Ether into a contract.
// @notice even
// if the contract is not payable.
// @notice To use, construct the contract with the target as argument.
// @author Remco Bloemen <remco@neufund.org>
contract ForceEther {
function ForceEther() public payable { }
function destroyAndSend(address _recipient) public {
selfdestruct(_recipient);
}
}

View File

@ -0,0 +1,12 @@
pragma solidity ^0.4.18;
import "../../contracts/ownership/HasNoEther.sol";
contract HasNoEtherTest is HasNoEther {
// Constructor with explicit payable — should still fail
function HasNoEtherTest() public payable {
}
}

View File

@ -1,15 +1,15 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.18;
import {Bounty, Target} from "../Bounty.sol";
import {Bounty, Target} from "../../contracts/Bounty.sol";
contract InsecureTargetMock is Target {
function checkInvariant() returns(bool){
function checkInvariant() public returns(bool) {
return false;
}
}
contract InsecureTargetBounty is Bounty {
function deployContract() internal returns (address) {
return new InsecureTargetMock();

View File

@ -0,0 +1,13 @@
pragma solidity ^0.4.18;
import "../LimitBalance.sol";
// mock class using LimitBalance
contract LimitBalanceMock is LimitBalance(1000) {
function limitedDeposit() public payable limitedPayable {
}
}

View File

@ -0,0 +1,23 @@
pragma solidity ^0.4.11;
contract MessageHelper {
event Show(bytes32 b32, uint256 number, string text);
function showMessage( bytes32 message, uint256 number, string text ) public returns (bool) {
Show(message, number, text);
return true;
}
function fail() public {
require(false);
}
function call(address to, bytes data) public returns (bool) {
if (to.call(data))
return true;
else
return false;
}
}

View File

@ -0,0 +1,25 @@
pragma solidity ^0.4.18;
import "../lifecycle/Pausable.sol";
// mock class using Pausable
contract PausableMock is Pausable {
bool public drasticMeasureTaken;
uint256 public count;
function PausableMock() public {
drasticMeasureTaken = false;
count = 0;
}
function normalProcess() external whenNotPaused {
count++;
}
function drasticMeasure() external whenPaused {
drasticMeasureTaken = true;
}
}

View File

@ -0,0 +1,13 @@
pragma solidity ^0.4.18;
import "../token/ERC20/PausableToken.sol";
// mock class using PausableToken
contract PausableTokenMock is PausableToken {
function PausableTokenMock(address initialAccount, uint initialBalance) public {
balances[initialAccount] = initialBalance;
}
}

View File

@ -0,0 +1,17 @@
pragma solidity ^0.4.18;
import "../payment/PullPayment.sol";
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
function PullPaymentMock() public payable { }
// test helper function to call asyncSend
function callSend(address dest, uint256 amount) public {
asyncSend(dest, amount);
}
}

View File

@ -0,0 +1,69 @@
pragma solidity ^0.4.8;
import "../ownership/rbac/RBAC.sol";
contract RBACMock is RBAC {
string constant ROLE_ADVISOR = "advisor";
modifier onlyAdminOrAdvisor()
{
require(
hasRole(msg.sender, ROLE_ADMIN) ||
hasRole(msg.sender, ROLE_ADVISOR)
);
_;
}
function RBACMock(address[] _advisors)
public
{
addRole(msg.sender, ROLE_ADVISOR);
for (uint256 i = 0; i < _advisors.length; i++) {
addRole(_advisors[i], ROLE_ADVISOR);
}
}
function onlyAdminsCanDoThis()
onlyAdmin
view
external
{
}
function onlyAdvisorsCanDoThis()
onlyRole(ROLE_ADVISOR)
view
external
{
}
function eitherAdminOrAdvisorCanDoThis()
onlyAdminOrAdvisor
view
external
{
}
function nobodyCanDoThis()
onlyRole("unknown")
view
external
{
}
// admins can remove advisor's role
function removeAdvisor(address _addr)
onlyAdmin
public
{
// revert if the user isn't an advisor
// (perhaps you want to soft-fail here instead?)
checkRole(_addr, ROLE_ADVISOR);
// remove the advisor's role
removeRole(_addr, ROLE_ADVISOR);
}
}

View File

@ -0,0 +1,10 @@
pragma solidity ^0.4.18;
contract ReentrancyAttack {
function callSender(bytes4 data) public {
require(msg.sender.call(data));
}
}

View File

@ -0,0 +1,45 @@
pragma solidity ^0.4.18;
import "../ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
contract ReentrancyMock is ReentrancyGuard {
uint256 public counter;
function ReentrancyMock() public {
counter = 0;
}
function callback() external nonReentrant {
count();
}
function countLocalRecursive(uint256 n) public nonReentrant {
if (n > 0) {
count();
countLocalRecursive(n - 1);
}
}
function countThisRecursive(uint256 n) public nonReentrant {
bytes4 func = bytes4(keccak256("countThisRecursive(uint256)"));
if (n > 0) {
count();
bool result = this.call(func, n - 1);
require(result == true);
}
}
function countAndCall(ReentrancyAttack attacker) public nonReentrant {
count();
bytes4 func = bytes4(keccak256("callback()"));
attacker.callSender(func);
}
function count() private {
counter += 1;
}
}

View File

@ -0,0 +1,21 @@
pragma solidity ^0.4.18;
import "../crowdsale/RefundableCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
function RefundableCrowdsaleImpl (
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet,
uint256 _goal
) public
Crowdsale(_startTime, _endTime, _rate, _wallet)
RefundableCrowdsale(_goal)
{
}
}

View File

@ -0,0 +1,95 @@
pragma solidity ^0.4.18;
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/SafeERC20.sol";
contract ERC20FailingMock is ERC20 {
function totalSupply() public view returns (uint256) {
return 0;
}
function transfer(address, uint256) public returns (bool) {
return false;
}
function transferFrom(address, address, uint256) public returns (bool) {
return false;
}
function approve(address, uint256) public returns (bool) {
return false;
}
function balanceOf(address) public constant returns (uint256) {
return 0;
}
function allowance(address, address) public constant returns (uint256) {
return 0;
}
}
contract ERC20SucceedingMock is ERC20 {
function totalSupply() public view returns (uint256) {
return 0;
}
function transfer(address, uint256) public returns (bool) {
return true;
}
function transferFrom(address, address, uint256) public returns (bool) {
return true;
}
function approve(address, uint256) public returns (bool) {
return true;
}
function balanceOf(address) public constant returns (uint256) {
return 0;
}
function allowance(address, address) public constant returns (uint256) {
return 0;
}
}
contract SafeERC20Helper {
using SafeERC20 for ERC20;
ERC20 failing;
ERC20 succeeding;
function SafeERC20Helper() public {
failing = new ERC20FailingMock();
succeeding = new ERC20SucceedingMock();
}
function doFailingTransfer() public {
failing.safeTransfer(0, 0);
}
function doFailingTransferFrom() public {
failing.safeTransferFrom(0, 0, 0);
}
function doFailingApprove() public {
failing.safeApprove(0, 0);
}
function doSucceedingTransfer() public {
succeeding.safeTransfer(0, 0);
}
function doSucceedingTransferFrom() public {
succeeding.safeTransferFrom(0, 0, 0);
}
function doSucceedingApprove() public {
succeeding.safeApprove(0, 0);
}
}

View File

@ -0,0 +1,21 @@
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
contract SafeMathMock {
uint256 public result;
function multiply(uint256 a, uint256 b) public {
result = SafeMath.mul(a, b);
}
function subtract(uint256 a, uint256 b) public {
result = SafeMath.sub(a, b);
}
function add(uint256 a, uint256 b) public {
result = SafeMath.add(a, b);
}
}

View File

@ -1,15 +1,15 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.18;
import {Bounty, Target} from "../Bounty.sol";
import {Bounty, Target} from "../../contracts/Bounty.sol";
contract SecureTargetMock is Target {
function checkInvariant() returns(bool) {
function checkInvariant() public returns(bool) {
return true;
}
}
contract SecureTargetBounty is Bounty {
function deployContract() internal returns (address) {
return new SecureTargetMock();

View File

@ -0,0 +1,13 @@
pragma solidity ^0.4.18;
import "../token/ERC20/StandardToken.sol";
// mock class using StandardToken
contract StandardTokenMock is StandardToken {
function StandardTokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply_ = initialBalance;
}
}

View File

@ -0,0 +1,26 @@
pragma solidity ^0.4.18;
import "./Ownable.sol";
import "../token/ERC20/ERC20Basic.sol";
import "../token/ERC20/SafeERC20.sol";
/**
* @title Contracts that should be able to recover tokens
* @author SylTi
* @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.
* This will prevent any accidental loss of tokens.
*/
contract CanReclaimToken is Ownable {
using SafeERC20 for ERC20Basic;
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20Basic The address of the token contract
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.safeTransfer(owner, balance);
}
}

View File

@ -0,0 +1,39 @@
pragma solidity ^0.4.18;
import "./Ownable.sol";
/**
* @title Claimable
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
* This allows the new owner to accept the transfer.
*/
contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}

View File

@ -0,0 +1,22 @@
pragma solidity ^0.4.18;
import "./Ownable.sol";
/**
* @title Contactable token
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
* contact information.
*/
contract Contactable is Ownable {
string public contactInformation;
/**
* @dev Allows the owner to set a string with their contact information.
* @param info The contact information to attach to the contract.
*/
function setContactInformation(string info) onlyOwner public {
contactInformation = info;
}
}

View File

@ -0,0 +1,40 @@
pragma solidity ^0.4.18;
import "./Claimable.sol";
/**
* @title DelayedClaimable
* @dev Extension for the Claimable contract, where the ownership needs to be claimed before/after
* a certain block number.
*/
contract DelayedClaimable is Claimable {
uint256 public end;
uint256 public start;
/**
* @dev Used to specify the time period during which a pending
* owner can claim ownership.
* @param _start The earliest time ownership can be claimed.
* @param _end The latest time ownership can be claimed.
*/
function setLimits(uint256 _start, uint256 _end) onlyOwner public {
require(_start <= _end);
end = _end;
start = _start;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within
* the specified start and end time.
*/
function claimOwnership() onlyPendingOwner public {
require((block.number <= end) && (block.number >= start));
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
end = 0;
}
}

View File

@ -0,0 +1,22 @@
pragma solidity ^0.4.18;
import "./Ownable.sol";
/**
* @title Contracts that should not own Contracts
* @author Remco Bloemen <remco@2π.com>
* @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner
* of this contract to reclaim ownership of the contracts.
*/
contract HasNoContracts is Ownable {
/**
* @dev Reclaim ownership of Ownable contracts
* @param contractAddr The address of the Ownable to be reclaimed.
*/
function reclaimContract(address contractAddr) external onlyOwner {
Ownable contractInst = Ownable(contractAddr);
contractInst.transferOwnership(owner);
}
}

View File

@ -0,0 +1,41 @@
pragma solidity ^0.4.18;
import "./Ownable.sol";
/**
* @title Contracts that should not own Ether
* @author Remco Bloemen <remco@2π.com>
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
* in the contract, it will allow the owner to reclaim this ether.
* @notice Ether can still be send to this contract by:
* calling functions labeled `payable`
* `selfdestruct(contract_address)`
* mining directly to the contract address
*/
contract HasNoEther is Ownable {
/**
* @dev Constructor that rejects incoming Ether
* @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
* we could use assembly to access msg.value.
*/
function HasNoEther() public payable {
require(msg.value == 0);
}
/**
* @dev Disallows direct send by settings a default function without the `payable` flag.
*/
function() external {
}
/**
* @dev Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() external onlyOwner {
assert(owner.send(this.balance));
}
}

View File

@ -0,0 +1,28 @@
pragma solidity ^0.4.18;
import "./CanReclaimToken.sol";
/**
* @title Contracts that should not own Tokens
* @author Remco Bloemen <remco@2π.com>
* @dev This blocks incoming ERC223 tokens to prevent accidental loss of tokens.
* Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
* owner to reclaim the tokens.
*/
contract HasNoTokens is CanReclaimToken {
/**
* @dev Reject all ERC223 compatible tokens
* @param from_ address The address that is transferring the tokens
* @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
*/
function tokenFallback(address from_, uint256 value_, bytes data_) external {
from_;
value_;
data_;
revert();
}
}

View File

@ -0,0 +1,99 @@
pragma solidity ^0.4.11;
import "./Ownable.sol";
/**
* @title Heritable
* @dev The Heritable contract provides ownership transfer capabilities, in the
* case that the current owner stops "heartbeating". Only the heir can pronounce the
* owner's death.
*/
contract Heritable is Ownable {
address public heir;
// Time window the owner has to notify they are alive.
uint256 public heartbeatTimeout;
// Timestamp of the owner's death, as pronounced by the heir.
uint256 public timeOfDeath;
event HeirChanged(address indexed owner, address indexed newHeir);
event OwnerHeartbeated(address indexed owner);
event OwnerProclaimedDead(address indexed owner, address indexed heir, uint256 timeOfDeath);
event HeirOwnershipClaimed(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throw an exception if called by any account other than the heir's.
*/
modifier onlyHeir() {
require(msg.sender == heir);
_;
}
/**
* @notice Create a new Heritable Contract with heir address 0x0.
* @param _heartbeatTimeout time available for the owner to notify they are alive,
* before the heir can take ownership.
*/
function Heritable(uint256 _heartbeatTimeout) public {
setHeartbeatTimeout(_heartbeatTimeout);
}
function setHeir(address newHeir) public onlyOwner {
require(newHeir != owner);
heartbeat();
HeirChanged(owner, newHeir);
heir = newHeir;
}
/**
* @dev set heir = 0x0
*/
function removeHeir() public onlyOwner {
heartbeat();
heir = 0;
}
/**
* @dev Heir can pronounce the owners death. To claim the ownership, they will
* have to wait for `heartbeatTimeout` seconds.
*/
function proclaimDeath() public onlyHeir {
require(ownerLives());
OwnerProclaimedDead(owner, heir, timeOfDeath);
timeOfDeath = now;
}
/**
* @dev Owner can send a heartbeat if they were mistakenly pronounced dead.
*/
function heartbeat() public onlyOwner {
OwnerHeartbeated(owner);
timeOfDeath = 0;
}
/**
* @dev Allows heir to transfer ownership only if heartbeat has timed out.
*/
function claimHeirOwnership() public onlyHeir {
require(!ownerLives());
require(now >= timeOfDeath + heartbeatTimeout);
OwnershipTransferred(owner, heir);
HeirOwnershipClaimed(owner, heir);
owner = heir;
timeOfDeath = 0;
}
function setHeartbeatTimeout(uint256 newHeartbeatTimeout) internal onlyOwner {
require(ownerLives());
heartbeatTimeout = newHeartbeatTimeout;
}
function ownerLives() internal view returns (bool) {
return timeOfDeath == 0;
}
}

View File

@ -0,0 +1,15 @@
pragma solidity ^0.4.18;
import "./HasNoEther.sol";
import "./HasNoTokens.sol";
import "./HasNoContracts.sol";
/**
* @title Base contract for contracts that should not own things.
* @author Remco Bloemen <remco@2π.com>
* @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or
* Owned contracts. See respective base contracts for details.
*/
contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts {
}

View File

@ -0,0 +1,42 @@
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}

View File

@ -0,0 +1,156 @@
pragma solidity ^0.4.18;
import "./Roles.sol";
/**
* @title RBAC (Role-Based Access Control)
* @author Matt Condon (@Shrugs)
* @dev Stores and provides setters and getters for roles and addresses.
* Supports unlimited numbers of roles and addresses.
* See //contracts/mocks/RBACMock.sol for an example of usage.
* This RBAC method uses strings to key roles. It may be beneficial
* for you to write your own implementation of this interface using Enums or similar.
* It's also recommended that you define constants in the contract, like ROLE_ADMIN below,
* to avoid typos.
*/
contract RBAC {
using Roles for Roles.Role;
mapping (string => Roles.Role) private roles;
event RoleAdded(address addr, string roleName);
event RoleRemoved(address addr, string roleName);
/**
* A constant role name for indicating admins.
*/
string public constant ROLE_ADMIN = "admin";
/**
* @dev constructor. Sets msg.sender as admin by default
*/
function RBAC()
public
{
addRole(msg.sender, ROLE_ADMIN);
}
/**
* @dev reverts if addr does not have role
* @param addr address
* @param roleName the name of the role
* // reverts
*/
function checkRole(address addr, string roleName)
view
public
{
roles[roleName].check(addr);
}
/**
* @dev determine if addr has role
* @param addr address
* @param roleName the name of the role
* @return bool
*/
function hasRole(address addr, string roleName)
view
public
returns (bool)
{
return roles[roleName].has(addr);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function adminAddRole(address addr, string roleName)
onlyAdmin
public
{
addRole(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function adminRemoveRole(address addr, string roleName)
onlyAdmin
public
{
removeRole(addr, roleName);
}
/**
* @dev add a role to an address
* @param addr address
* @param roleName the name of the role
*/
function addRole(address addr, string roleName)
internal
{
roles[roleName].add(addr);
RoleAdded(addr, roleName);
}
/**
* @dev remove a role from an address
* @param addr address
* @param roleName the name of the role
*/
function removeRole(address addr, string roleName)
internal
{
roles[roleName].remove(addr);
RoleRemoved(addr, roleName);
}
/**
* @dev modifier to scope access to a single role (uses msg.sender as addr)
* @param roleName the name of the role
* // reverts
*/
modifier onlyRole(string roleName)
{
checkRole(msg.sender, roleName);
_;
}
/**
* @dev modifier to scope access to admins
* // reverts
*/
modifier onlyAdmin()
{
checkRole(msg.sender, ROLE_ADMIN);
_;
}
/**
* @dev modifier to scope access to a set of roles (uses msg.sender as addr)
* @param roleNames the names of the roles to scope access to
* // reverts
*
* @TODO - when solidity supports dynamic arrays as arguments to modifiers, provide this
* see: https://github.com/ethereum/solidity/issues/2467
*/
// modifier onlyRoles(string[] roleNames) {
// bool hasAnyRole = false;
// for (uint8 i = 0; i < roleNames.length; i++) {
// if (hasRole(msg.sender, roleNames[i])) {
// hasAnyRole = true;
// break;
// }
// }
// require(hasAnyRole);
// _;
// }
}

View File

@ -0,0 +1,55 @@
pragma solidity ^0.4.18;
/**
* @title Roles
* @author Francisco Giordano (@frangio)
* @dev Library for managing addresses assigned to a Role.
* See RBAC.sol for example usage.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an address access to this role
*/
function add(Role storage role, address addr)
internal
{
role.bearer[addr] = true;
}
/**
* @dev remove an address' access to this role
*/
function remove(Role storage role, address addr)
internal
{
role.bearer[addr] = false;
}
/**
* @dev check if an address has this role
* // reverts
*/
function check(Role storage role, address addr)
view
internal
{
require(has(role, addr));
}
/**
* @dev check if an address has this role
* @return bool
*/
function has(Role storage role, address addr)
view
internal
returns (bool)
{
return role.bearer[addr];
}
}

View File

@ -0,0 +1,43 @@
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
/**
* @title PullPayment
* @dev Base contract supporting async send for pull payments. Inherit from this
* contract and use asyncSend instead of send.
*/
contract PullPayment {
using SafeMath for uint256;
mapping(address => uint256) public payments;
uint256 public totalPayments;
/**
* @dev withdraw accumulated balance, called by payee.
*/
function withdrawPayments() public {
address payee = msg.sender;
uint256 payment = payments[payee];
require(payment != 0);
require(this.balance >= payment);
totalPayments = totalPayments.sub(payment);
payments[payee] = 0;
assert(payee.send(payment));
}
/**
* @dev Called by the payer to store the sent amount as credit to be pulled.
* @param dest The destination address of the funds.
* @param amount The amount to transfer.
*/
function asyncSend(address dest, uint256 amount) internal {
payments[dest] = payments[dest].add(amount);
totalPayments = totalPayments.add(amount);
}
}

View File

@ -0,0 +1,71 @@
pragma solidity ^0.4.18;
import "../math/SafeMath.sol";
/**
* @title SplitPayment
* @dev Base contract that supports multiple payees claiming funds sent to this contract
* according to the proportion they own.
*/
contract SplitPayment {
using SafeMath for uint256;
uint256 public totalShares = 0;
uint256 public totalReleased = 0;
mapping(address => uint256) public shares;
mapping(address => uint256) public released;
address[] public payees;
/**
* @dev Constructor
*/
function SplitPayment(address[] _payees, uint256[] _shares) public payable {
require(_payees.length == _shares.length);
for (uint256 i = 0; i < _payees.length; i++) {
addPayee(_payees[i], _shares[i]);
}
}
/**
* @dev payable fallback
*/
function () public payable {}
/**
* @dev Claim your share of the balance.
*/
function claim() public {
address payee = msg.sender;
require(shares[payee] > 0);
uint256 totalReceived = this.balance.add(totalReleased);
uint256 payment = totalReceived.mul(shares[payee]).div(totalShares).sub(released[payee]);
require(payment != 0);
require(this.balance >= payment);
released[payee] = released[payee].add(payment);
totalReleased = totalReleased.add(payment);
payee.transfer(payment);
}
/**
* @dev Add a new payee to the contract.
* @param _payee The address of the payee to add.
* @param _shares The number of shares owned by the payee.
*/
function addPayee(address _payee, uint256 _shares) internal {
require(_payee != address(0));
require(_shares > 0);
require(shares[_payee] == 0);
payees.push(_payee);
shares[_payee] = _shares;
totalShares = totalShares.add(_shares);
}
}

View File

@ -1,15 +0,0 @@
pragma solidity ^0.4.4;
import '../token/BasicToken.sol';
// mock class using BasicToken
contract BasicTokenMock is BasicToken {
function BasicTokenMock(address initialAccount, uint initialBalance) {
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
}
}

View File

@ -1,23 +0,0 @@
pragma solidity ^0.4.4;
import "../DayLimit.sol";
contract DayLimitMock is DayLimit {
uint public totalSpending;
function DayLimitMock(uint _value) DayLimit(_value) {
totalSpending = 0;
}
function attemptSpend(uint _value) external limitedDaily(_value) {
totalSpending += _value;
}
function setDailyLimit(uint _newLimit) external {
_setDailyLimit(_newLimit);
}
function resetSpentToday() external {
_resetSpentToday();
}
}

View File

@ -1,13 +0,0 @@
pragma solidity ^0.4.4;
import '../LimitBalance.sol';
// mock class using LimitBalance
contract LimitBalanceMock is LimitBalance(1000) {
function limitedDeposit() payable limitedPayable {
}
}

View File

@ -1,12 +0,0 @@
pragma solidity ^0.4.4;
import "../MultisigWallet.sol";
contract MultisigWalletMock is MultisigWallet {
uint public totalSpending;
function MultisigWalletMock(address[] _owners, uint _required, uint _daylimit)
MultisigWallet(_owners, _required, _daylimit) payable { }
function changeOwner(address _from, address _to) external { }
}

Some files were not shown because too many files have changed in this diff Show More