Compare commits

...

182 Commits

Author SHA1 Message Date
b047d28476 Bump to version 2.0.2 2018-10-22 14:54:57 +02:00
54268bfeed Move standalone ERC20 and ERC721 to token dir (#38) 2018-10-19 11:45:02 -06:00
0c05ce0eb1 Bump to v2.0.1 2018-10-18 20:40:38 +02:00
f28a4427a2 Add missing zos.json files 2018-10-18 20:34:50 +02:00
e5ba8666de Update readme 2018-10-18 20:12:09 +02:00
2fa3176399 Update to zOS 2.0.0 and version bump to 2.0.0 2018-10-18 20:05:48 +02:00
d1f2b19e6e Frozen all releases 2018-10-18 19:47:57 +02:00
a8a3e0be05 Deployed openzeppelin-eth to all networks 2018-10-18 19:28:56 +02:00
f38ff1bdbd Add publish flag to zos.json 2018-10-18 18:34:59 +02:00
34fdb0fe23 Fix split payment contract variable initialization (#37)
* Remove variables initialization on declaration for SplitPayment contracts
2018-10-18 18:20:05 +02:00
793de306cf Initialize zos project 2018-10-18 18:17:16 +02:00
0720923115 Add zos CLI as dev dependency and bump zos lib version 2018-10-18 18:17:16 +02:00
95666637b6 Add prepare script (#36) 2018-10-18 17:53:56 +02:00
0ae92d78eb Fix linter issues 2018-10-18 15:22:40 +02:00
5e69036bbc EVM Package examples (#32)
* Added StandardToken (on-chain lib)

* Added OnChainERC20 example.

* Added OnChainERC721

* Update OnChainERC721.test.js

* Renamed the contracts to Standalone*.

* Fix path to Initializable in StandardToken example
2018-10-18 15:03:34 +02:00
6395ddac2c Merge pull request #34 from nventuro/oz-eth
Updated package.json
2018-10-18 14:45:26 +02:00
a2a28b02e8 Updated package.json 2018-10-17 15:15:11 -03:00
84a37e1460 Merge pull request #33 from nventuro/erc721-init
ERC721 contracts no longer initialize their parents.
2018-10-15 14:32:28 -03:00
36043ecc3e Merge pull request #27 from nventuro/init-asserts
Added assertions to leaf initializers of (some) pseudo-abstract contr…
2018-10-15 14:32:20 -03:00
d75ba16223 ERC721 contracts no longer initialize their parents (but have some safety checks). 2018-10-15 13:41:51 -03:00
1961032592 Merge pull request #31 from nventuro/peer-dep
Added zos-lib as a peer dependency and used its Initializable.
2018-10-10 12:53:51 -03:00
fffa406aa4 Merge branch 'master' into peer-dep 2018-10-10 09:09:06 -03:00
488c3de389 Merge pull request #29 from nventuro/storage-slots
Added gaps at the end of the storage of each contract.
2018-10-10 09:07:29 -03:00
45747144ff Trying to get the Travis build to pass. 2018-10-09 19:05:39 -03:00
bc7ba69f9b Removed Initializable, now using zos-lib's. 2018-10-09 17:56:56 -03:00
423c6523ba Added zos-lib peer dependency. 2018-10-09 17:56:40 -03:00
ecd6c57faa Added internal check methods. 2018-10-09 17:21:53 -03:00
19de09afe1 Merge branch 'master' into storage-slots 2018-10-09 16:30:52 -03:00
932a39f5fd Added gaps at the end of the storage of each contract. 2018-10-08 14:42:02 -03:00
6956b935b3 Merge pull request #28 from nventuro/accidental-death
Removed BreakInvariantBounty.
2018-10-08 13:38:34 -03:00
7bdefbeb9a Removed BreakInvariantBounty. 2018-10-08 12:51:11 -03:00
6fe9b340b4 Added assertions to leaf initializers of (some) pseudo-abstract contracts. 2018-10-08 12:45:58 -03:00
b25e8b91a5 Merge pull request #26 from nventuro/sender-param
Added sender parameter to initializers using msg.sender.
2018-10-08 11:03:10 -03:00
14dd3f6610 Added sender parameter to initializers using msg.sender. 2018-10-05 17:40:38 -03:00
716efc4b51 Merge pull request #24 from nventuro/init-improvs
Initialization improvements
2018-10-05 16:39:44 -03:00
143ccf7a74 Removed Initializable from mocks, removed explicit inheritances in the crowdsale mocks. 2018-10-05 16:34:29 -03:00
dd750bc094 Added missing initializations. 2018-10-05 16:34:29 -03:00
ef83f895b9 Added initializer to ERC721MetadataMintable. 2018-10-05 16:34:29 -03:00
cd3be5fb02 Merge pull request #23 from nventuro/oz-sol-rc3
Merging OZ 2.0.0.rc3
2018-10-05 16:29:08 -03:00
f29e98f772 Merge remote-tracking branch 'solidity/release-v2.0.0' into oz-sol-rc3 2018-10-04 12:00:12 -03:00
2d30918149 Release candidate v2.0.0-rc.3 2018-10-04 11:17:57 -03:00
0db1f8144d Removed unnecessary Secondary inheritance from RefundEscrow. (#1381)
(cherry picked from commit 308e5e9cc0)
2018-10-04 11:15:53 -03:00
ffeae0d83e ERC20 internal transfer method (#1370)
(cherry picked from commit 43ebb4fc43)
2018-10-04 11:14:05 -03:00
38ca422170 Removing unrequired _burn() override (#1373)
* signing prefix added

* Minor improvement

* Tests changed

* Successfully tested

* Minor improvements

* Minor improvements

* Revert "Dangling commas are now required. (#1359)"

This reverts commit a6889776f4.

* updates

* fixes #1371

* Removed extra whitespace

(cherry picked from commit f3888bb0b0)
2018-10-04 11:13:05 -03:00
7c984968d8 Prevents Bounty from being claimed twice (#1374)
* signing prefix added

* Minor improvement

* Tests changed

* Successfully tested

* Minor improvements

* Minor improvements

* Revert "Dangling commas are now required. (#1359)"

This reverts commit a6889776f4.

* updates

* fixes #1356

* Removed extra semicolon.

(cherry picked from commit c87433e0c2)
2018-10-04 11:12:45 -03:00
bd8345a153 Separate ERC721Mintable (#1365)
* separate part of ERC721Mintable into ERC721MetadataMintable

* remove mint and burn from 721 tests

* Fixed linter error.

* fix ERC721 mint tests

* Minor fixes.

(cherry picked from commit 744f567f40)
2018-10-04 11:12:05 -03:00
3df0a786e4 Merge pull request #18 from OpenZeppelin/release-v2.0.0
Merge OpenZeppelin 2.0 with initializer functions
2018-10-04 08:36:30 -03:00
3c4528b8f4 fix initialization of ReetrancyGuard storage variable 2018-10-03 17:28:22 -03:00
94a7abcebc Merge pull request #14 from glesaint/patch-1
update Math.sol path
2018-10-02 10:57:53 -03:00
32d0f6770c fix lint errors 2018-10-01 18:56:50 -03:00
caa0db9fa9 Merge branch 'master' into release-v2.0.0 2018-10-01 18:54:26 -03:00
621d4b30da remove constructors from Crowdsales 2018-09-28 17:51:59 -03:00
693907d3c8 convert SampleCrowdsale and SampleCrowdsaleToken to initializers 2018-09-28 17:48:07 -03:00
2108641a37 convert distribution crowdsales to initializers 2018-09-28 16:38:04 -03:00
418b6f7cb3 convert IncreasingPriceCrowdsale to initializers 2018-09-28 16:01:57 -03:00
76169cda40 Fixed a broken payment test (+ another small fix) (#1318)
* Fixed a broken payment test

* In PR template, npm run lint:fix, not lint:all:fix

* In SplitPayment test, replaced an await-in-loop with Promise.all

(cherry picked from commit b79196f911)
2018-09-28 11:36:06 -03:00
08bf6bbed9 Add missing tests to ECSDA (#1248)
* fix: refactor sign.js and related tests

* fix: remove unused dep

* fix: update package.json correctly

* Add missing tests to ECRecovery

* fix lint

* Reorganize the tests

* Reuse signature

* fix static errors

* Apply suggestions by @frangion and @nventuro

* Remove only

* More suggestions

* Remove unnecessary max-len

* remove only

(cherry picked from commit 75c0a59bb4)
2018-09-28 11:28:46 -03:00
8c394de450 Add SignatureBouncer test for when msg.data is too short (#1360)
* add test for msg.data too short

* fix test to hit that branch

* Update SignatureBouncer.test.js

(cherry picked from commit 1a4e5346ed)
2018-09-28 09:38:48 -03:00
ed200a0219 convert IndividuallyCappedCrowdsale to initializers 2018-09-27 19:28:14 -03:00
c4487ba836 convert CappedCrowdsale 2018-09-27 19:24:02 -03:00
2c2d80d9a0 convert TimedCrowdsale to initializers 2018-09-27 19:14:30 -03:00
6247a7bf7c convert AllowanceCrowdsale to initializers 2018-09-27 18:57:59 -03:00
22f8660c8e convert MintedCrowdsale to initializers 2018-09-27 18:53:31 -03:00
175e2c7254 convert Crowdsale to initializers 2018-09-27 18:43:58 -03:00
a0a3187b30 make roles initializers idempotent 2018-09-26 19:21:25 -03:00
f3b5f9e8f0 convert SignatureBouncer to initializers 2018-09-26 19:01:36 -03:00
e6d5379e39 convert TokenVesting to initializers 2018-09-26 18:59:07 -03:00
8bf7356f38 convert ERC20Migrator to initializers 2018-09-26 18:49:47 -03:00
d7b7644e68 convert ERC1046 to initializers 2018-09-26 18:30:45 -03:00
8dd0739072 convert BreakInvariantBounty to initializers 2018-09-26 18:26:45 -03:00
838509c0a4 Merge branch 'release-v2.0.0' of github.com:OpenZeppelin/openzeppelin-solidity into release-v2.0.0 2018-09-26 18:19:41 -03:00
e6252d511c convert SimpleToken to initializers 2018-09-26 18:08:29 -03:00
e2e05294b0 convert RefundEscrow to initializers 2018-09-26 18:01:02 -03:00
3130a3f3de convert ConditionalEscrow to initializers 2018-09-26 17:55:08 -03:00
884d5e0132 convert SplitPayment to initializers 2018-09-26 17:51:33 -03:00
8d28bd445a covnert TokenTimelock into initializers 2018-09-26 17:46:54 -03:00
d643caf8fe convert CapperRole and SignerRole to initializers 2018-09-26 17:18:45 -03:00
a010d88def convert ERC721Pausable to initializers 2018-09-26 17:12:16 -03:00
d3116fcea8 add Initializable to simple ERC721 contracts 2018-09-26 17:12:16 -03:00
cda2866e7c convert ERC721Burnable to initializers 2018-09-26 16:45:37 -03:00
fa5ecd03cb Improved bounty tests. (#1350)
* Improved bounty tests.

* Fixed linter errors.

* Addressed review comments.

(cherry picked from commit ae109f69cc)
2018-09-26 16:37:31 -03:00
1b0c6b94b9 Removed mintingFinished. (#1351)
* Removed mintingFinished from ERC20Mintable.

* Removed MintingFinished from ERC721Mintable.

* Removed MintingFinished event.

(cherry picked from commit 5fdeaa81d5)
2018-09-26 16:06:27 -03:00
652243b7c3 Removed assertions from Escrow and SplitPayment. (#1349)
(cherry picked from commit db2e1d2c74)
2018-09-26 12:57:15 -03:00
c9e8a66e85 Add the missing test for ERC721Holder (#1249)
* Add the missing test for ERC721Holder

* fix lint

* Move the holder test to a separate file

(cherry picked from commit 396680b856)
2018-09-26 12:15:08 -03:00
e7c99dd7dd Roles now emit events in construction and when renouncing. (#1329)
* release candidate v2.0.0-rc.1

* fix linter error

(cherry picked from commit c12a1c6898)

* Roles now emit events in construction and when renouncing.

(cherry picked from commit 21198bf1c1)
2018-09-26 12:14:34 -03:00
aa6a44bb20 convert PullPayment to initializers 2018-09-25 19:38:15 -03:00
10642d14ea convert Escrow to initializers 2018-09-25 19:33:58 -03:00
6ac45333fe convert Secondary to initializers 2018-09-25 19:31:59 -03:00
0962b9e5e6 convert ERC20Pausable to initializers 2018-09-25 18:53:24 -03:00
c630cb4016 convert Pausable to initializers 2018-09-25 18:51:19 -03:00
21e016378c convert PauserRole to initializers 2018-09-25 18:48:18 -03:00
7cee6df3f7 convert ERC20Capped to initializers 2018-09-25 18:41:19 -03:00
57325f51ff convert ERC20Burnable to initializers 2018-09-25 18:23:20 -03:00
20a2aa4274 adjust name in package.json 2018-09-25 17:59:28 -03:00
5c1c43d2e1 convert ERC721Mintable to initializers 2018-09-25 17:56:44 -03:00
f3a0a6a463 convert ERC721Full, ERC721Enumerable, ERC721Metadata to initializers 2018-09-25 17:51:28 -03:00
416c4ced2c convert ERC721 to initializers 2018-09-25 17:46:16 -03:00
3f51d342d1 convert ERC20Mintable 2018-09-25 17:42:50 -03:00
1f54c72d1d add Initializable to MinterRoleMock 2018-09-25 17:42:50 -03:00
f90fd5330e convert ERC20Detailed 2018-09-25 17:34:19 -03:00
653b154b0e convert ERC20 2018-09-25 17:32:54 -03:00
6e0ace1914 make initializer modifier check if running in constructor 2018-09-24 20:39:14 -03:00
5b8d5eb5e9 convert ERC165 to initializers 2018-09-24 20:36:32 -03:00
3a3d2b154f transform MinterRole to initializers 2018-09-24 10:34:13 -03:00
f3606e3e21 transform Ownable to initializers 2018-09-24 10:30:07 -03:00
9c16ffcaf4 add Initializable 2018-09-21 17:36:51 -03:00
4c319a1072 Merge branch 'master' into release-v2.0.0 2018-09-21 11:18:24 -03:00
dac5bccf80 release candidate v2.0.0-rc.2 2018-09-18 19:22:04 -03:00
f22adbb742 Fixed relative imports. (#1321)
(cherry picked from commit 225b492109)
2018-09-18 18:11:55 -03:00
35d92fddaa update Math.sol path (#1319)
(cherry picked from commit d8cbd5554f)
2018-09-18 18:10:11 -03:00
fa739d8af0 Move BreakInvariantBounty to drafts (#1334)
* move BreakInvariantBounty to drafts

* fix bad imports
2018-09-18 18:05:47 -03:00
6c36bc71a7 Changes to Counter (#1332)
* rename Index.currentId to current

* use += operator for clarity

* rename Counter.Index to Counter.Counter

* move Counter to drafts

(cherry picked from commit 3e55408cb5)
2018-09-18 17:44:57 -03:00
658af64edd Rename AutoIncrementing to Counter (#1307)
(cherry picked from commit b4f87bb8fc)
2018-09-18 17:44:43 -03:00
ed84f3fcf3 fix linter error
(cherry picked from commit c12a1c6898)
2018-09-17 11:49:13 -03:00
5f7e43f170 update Math.sol path
To use openzeppelin-zos Math.sol
2018-09-11 16:04:13 +07:00
a23d42fc04 1.9.4 2018-08-27 19:08:43 -03:00
2a2519414b Update zos files for 1.9.4 2018-08-27 19:08:24 -03:00
c46f0353d1 Update ERC721 to latest 1.11.0 from OpenZeppelin-solidity (#11)
* Update ERC721 to latest 1.11.0 from OpenZeppelin-solidity

* Hardcode supported interfaces instead of using lookup table. This avoids shifting storage when extending supports interface.

* Update build artifacts

* Fix linter errors
2018-08-27 18:42:21 -03:00
8f4610e007 1.9.3 2018-08-23 14:59:46 -03:00
63ca200016 Upgrade to 1.9.3 2018-08-23 14:59:30 -03:00
d87e833310 feat: add indexed _tokenId on Approval event for ERC721 (#9) 2018-08-23 14:25:24 -03:00
198dbf348c 1.9.2 2018-08-23 12:05:55 -03:00
094677f179 Bump zos version to 1.9.2 2018-08-23 12:05:05 -03:00
e6167f1c0b Add build artifacts to version control 2018-08-23 11:45:35 -03:00
23ddc9db2a Update zos version 2018-08-23 11:28:20 -03:00
8443df3826 feat: indexed _tokenId on Transfer Event for ERC721 (#6) 2018-08-23 11:04:44 -03:00
6e5596e80c fix package.json repository links 2018-07-20 17:45:11 -03:00
f00d13125b modify readme for zos 2018-07-20 17:20:07 -03:00
3af2f8ad7c 1.9.1 2018-05-22 21:01:54 -03:00
59afaca753 remove distribution and kernel from zos.ropsten.json 2018-05-22 20:06:15 -03:00
f35eeed0eb freeze rinkeby version 2018-05-22 19:28:38 -03:00
8b19e3c215 fix linter errors 2018-05-22 19:21:52 -03:00
dca62efba9 add correct zos.ropsten.json 2018-05-22 19:11:41 -03:00
923bbb44a8 add zos files to npm package 2018-05-22 18:43:38 -03:00
d4c455c180 rename livenet to mainnet 2018-05-22 18:43:16 -03:00
5ac618681a add zos.rinkeby.json 2018-05-22 18:30:55 -03:00
d191247505 add full zos.livenet.json 2018-05-22 17:30:14 -03:00
9b55e96fa0 add partial zos.livenet.json 2018-05-22 17:30:14 -03:00
8868c0b6d3 update to zos-cli 0.8.0 2018-05-22 16:27:45 -03:00
534ff92ba5 add zos-lib as peerdependency 2018-05-22 16:09:41 -03:00
31ec824aef Revert "add workaround because truffle doesn't support transitive dependencies"
This reverts commit 48a7cd4e60.
2018-05-22 16:07:27 -03:00
b732b6417e bump to 1.9.0 2018-05-22 14:57:33 -03:00
998b5f43fb update zos to 0.7.0 2018-05-21 18:46:32 -03:00
ff31995104 update zos-lib to latest version 2018-05-21 15:58:05 -03:00
48a7cd4e60 add workaround because truffle doesn't support transitive dependencies 2018-05-21 15:54:35 -03:00
acd34a9372 fix bug in DetailedPremintedToken 2018-05-21 15:26:44 -03:00
2ce67a25ef add more contracts from openzeppelin-solidity 2018-05-21 15:26:44 -03:00
700b811813 fix linter errors and warnings 2018-05-21 15:26:44 -03:00
16f04b13d7 revert truffle-config.js changes from 95fdc7b 2018-05-21 15:26:44 -03:00
e3ad4a5e14 remove unnecessary sender arguments 2018-05-21 15:26:28 -03:00
579446d5d9 Fixed MintableToken's initialize not being called. 2018-05-19 01:02:12 -03:00
fc07f7a0ff RBACWithAdmin now has an initialize function instead of a constructor. 2018-05-19 00:58:52 -03:00
dd6054efeb remove unnecessary sender arguments 2018-05-18 21:45:45 -03:00
27a6a15d66 add explicit initializers 2018-05-18 21:45:34 -03:00
32e93579fa added package.zos files 2018-05-18 21:44:56 -03:00
c8719ce418 fix initialize versions 2018-05-18 21:44:08 -03:00
39fe05dfad add more openzeppelin-solidity library contracts 2018-05-18 21:44:08 -03:00
be101154fa update to newer zos.json format 2018-05-18 21:21:37 -03:00
c329fc0a5f update zos to latest version 2018-05-18 21:01:23 -03:00
e55dbc9681 update to latest zos and zos-lib 2018-05-18 19:07:15 -03:00
6f1c67af0d commit new package-lock.json format generated by npm 6 2018-05-18 18:55:24 -03:00
5284a6df88 update nan 2.6.2 -> 2.10.0 for node 10 compatibility 2018-05-18 18:19:15 -03:00
8bce0a4f2e update sha3 1.2.0 -> 1.2.2 for node 10 compatibility 2018-05-18 18:19:12 -03:00
11d2bbc092 Merge tag 'v1.9.0' into zos-release
1.9.0
2018-05-17 20:04:00 -03:00
ff69c54497 move zos (cli) to devDependency 2018-04-20 22:47:38 -03:00
6669f3fcee Merge branch 'zos-release' of github.com:OpenZeppelin/zeppelin-solidity into zos-release 2018-04-20 21:37:28 -03:00
18e16a5db0 added package.zos 2018-04-20 20:38:23 -03:00
95fdc7bd8a update contracts and config 2018-04-20 19:58:16 -03:00
27d696aa7d add deployable erc20 contracts 2018-04-20 13:31:27 -03:00
ff6a565452 bump version 2018-04-20 13:31:27 -03:00
5f079c8605 add prepack step to build contracts 2018-04-20 13:31:27 -03:00
ea335ebc64 ignore everything but official contracts for npm 2018-04-20 13:31:27 -03:00
b1a801566c fix initializers and tests 2018-04-20 13:31:26 -03:00
2eac2a79b7 add mintable erc721 token 2018-04-20 13:30:22 -03:00
f9fc8d2e96 adapt contracts for upgradeability 2018-04-20 13:29:50 -03:00
89c32f5dd7 delete contracts and tests not yet in zos 2018-04-20 12:18:08 -03:00
eff3d7ca8e bump version 2018-04-20 11:38:48 -03:00
85225ef6ae add mintable erc721 token 2018-04-20 11:38:48 -03:00
2010c6b464 add prepack step to build contracts 2018-04-19 12:32:56 -03:00
03891b00a7 ignore everything but official contracts for npm 2018-04-19 12:26:30 -03:00
d0ec491b1f adapt contracts for upgradeability 2018-04-18 18:10:53 -03:00
38536f42f4 delete contracts and tests not yet in zos 2018-04-18 18:10:53 -03:00
146 changed files with 10774 additions and 773 deletions

View File

@ -14,4 +14,4 @@ Fixes #
- [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](../blob/master/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 and fixed any issues (`npm run lint:all:fix`).
- [ ] 🎨 I've run the JS/Solidity linters and fixed any issues (`npm run lint:fix`).

2
.gitignore vendored
View File

@ -37,3 +37,5 @@ build/
# truffle
.node-xmlhttprequest-*
.zos.session

View File

@ -6,7 +6,7 @@
"indentation": ["error", 2],
"lbrace": "off",
"linebreak-style": ["error", "unix"],
"max-len": ["error", 79],
"max-len": ["error", 120],
"no-constant": ["error"],
"no-empty-blocks": "off",
"quotes": ["error", "double"],

View File

@ -18,6 +18,11 @@ jobs:
- env: SOLIDITY_COVERAGE=true
- env: SOLC_NIGHTLY=true
include:
- stage: install
script: true
install:
- npm install
- npx npm-install-peers
# Run the unit test suite three times in parallel.
# The first one gets results faster and is the only one required to pass.
# The second one generates the coverage report.
@ -25,18 +30,22 @@ jobs:
# upcoming solidity release.
- stage: tests
name: "unit tests"
install: npx npm-install-peers
script: npm run test
- stage: tests
name: "unit tests with coverage"
install: npx npm-install-peers
script: npm run test
env: SOLIDITY_COVERAGE=true
- stage: tests
name: "unit tests with solc nightly"
install: npx npm-install-peers
script: npm run test
env: SOLC_NIGHTLY=true
# solidity and javascript style tests.
- stage: tests
name: "static tests"
install: npx npm-install-peers
script: npm run lint
- stage: update docs
if: tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$

View File

@ -1,54 +1,30 @@
# <img src="logo.png" alt="OpenZeppelin" width="400px">
[![NPM Package](https://img.shields.io/npm/v/openzeppelin-solidity.svg?style=flat-square)](https://www.npmjs.org/package/openzeppelin-solidity)
[![Build Status](https://img.shields.io/travis/OpenZeppelin/openzeppelin-solidity.svg?branch=master&style=flat-square)](https://travis-ci.org/OpenZeppelin/openzeppelin-solidity)
[![Coverage Status](https://img.shields.io/coveralls/github/OpenZeppelin/openzeppelin-solidity/master.svg?style=flat-square)](https://coveralls.io/github/OpenZeppelin/openzeppelin-solidity?branch=master)
# OpenZeppelin EVM Package
[![NPM Package](https://img.shields.io/npm/v/openzeppelin-eth.svg?style=flat-square)](https://www.npmjs.org/package/openzeppelin-eth)
[![Build Status](https://img.shields.io/travis/OpenZeppelin/openzeppelin-eth.svg?branch=master&style=flat-square)](https://travis-ci.org/OpenZeppelin/openzeppelin-eth)
**OpenZeppelin is a library for secure smart contract development.** It provides implementations of standards like ERC20 and ERC721 which you can deploy as-is or extend to suit your needs, as well as Solidity components to build custom contracts and more complex decentralized systems.
This fork of OpenZeppelin is set up as a **reusable EVM Package**. It is deployed to the kovan, rinkeby, and ropsten test networks, as well as to the main Ethereum network. You can reuse any of the pre-deployed on-chain contracts by simply linking to them using [ZeppelinOS](https://github.com/zeppelinos/zos), or reuse their Solidity source code as with the vanilla version of OpenZeppelin.
## Install
```
npm install openzeppelin-solidity
npm install openzeppelin-eth
```
## Usage
## Pre-deployed contracts
To write your custom contracts, import ours and extend them through inheritance.
```solidity
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721.sol';
import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol';
contract MyNFT is ERC721, ERC721Mintable {
}
```
> You need an ethereum development framework for the above import statements to work! Check out these guides for [Truffle] or [Embark].
On our site you will find a few [guides] to learn about the diferent parts of OpenZeppelin, as well as [documentation for the API][API docs]. Keep in mind that the API docs are work in progress, and dont hesitate to ask questions in [our Slack][Slack].
## Security
OpenZeppelin the project is maintained by [Zeppelin] the company, and developed following our high standards for code quality and security. OpenZeppelin is meant to provide 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 problems you might experience.
The core development principles and strategies that OpenZeppelin is based on include: security in depth, simple and modular code, clarity-driven naming conventions, comprehensive unit testing, pre-and-post-condition sanity checks, code consistency, and regular audits.
Please report any security issues you find to security@openzeppelin.org.
## Contribute
OpenZeppelin exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the [contribution guide]!
- StandaloneERC20
- StandaloneERC721
- TokenVesting
- PaymentSplitter
## License
OpenZeppelin is released under the [MIT License](LICENSE).
[API docs]: https://openzeppelin.org/api/docs/token_ERC721_ERC721BasicToken.html
[guides]: https://openzeppelin.org/api/docs/get-started.html
[Slack]: https://slack.openzeppelin.org
[Zeppelin]: https://zeppelin.solutions
[contribution guide]: CONTRIBUTING.md
[Truffle]: https://truffleframework.com/docs/truffle/quickstart
[Embark]: https://embark.status.im/docs/quick_start.html

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../Roles.sol";
contract CapperRole {
contract CapperRole is Initializable {
using Roles for Roles.Role;
event CapperAdded(address indexed account);
@ -11,8 +12,10 @@ contract CapperRole {
Roles.Role private cappers;
constructor() public {
cappers.add(msg.sender);
function initialize(address sender) public initializer {
if (!isCapper(sender)) {
_addCapper(sender);
}
}
modifier onlyCapper() {
@ -25,16 +28,22 @@ contract CapperRole {
}
function addCapper(address account) public onlyCapper {
cappers.add(account);
emit CapperAdded(account);
_addCapper(account);
}
function renounceCapper() public {
cappers.remove(msg.sender);
_removeCapper(msg.sender);
}
function _addCapper(address account) internal {
cappers.add(account);
emit CapperAdded(account);
}
function _removeCapper(address account) internal {
cappers.remove(account);
emit CapperRemoved(account);
}
uint256[50] private ______gap;
}

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../Roles.sol";
contract MinterRole {
contract MinterRole is Initializable {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
@ -11,8 +12,10 @@ contract MinterRole {
Roles.Role private minters;
constructor() public {
minters.add(msg.sender);
function initialize(address sender) public initializer {
if (!isMinter(sender)) {
_addMinter(sender);
}
}
modifier onlyMinter() {
@ -25,16 +28,22 @@ contract MinterRole {
}
function addMinter(address account) public onlyMinter {
minters.add(account);
emit MinterAdded(account);
_addMinter(account);
}
function renounceMinter() public {
minters.remove(msg.sender);
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
minters.remove(account);
emit MinterRemoved(account);
}
uint256[50] private ______gap;
}

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../Roles.sol";
contract PauserRole {
contract PauserRole is Initializable {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
@ -11,8 +12,10 @@ contract PauserRole {
Roles.Role private pausers;
constructor() public {
pausers.add(msg.sender);
function initialize(address sender) public initializer {
if (!isPauser(sender)) {
_addPauser(sender);
}
}
modifier onlyPauser() {
@ -25,16 +28,22 @@ contract PauserRole {
}
function addPauser(address account) public onlyPauser {
pausers.add(account);
emit PauserAdded(account);
_addPauser(account);
}
function renouncePauser() public {
pausers.remove(msg.sender);
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
pausers.remove(account);
emit PauserRemoved(account);
}
uint256[50] private ______gap;
}

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../Roles.sol";
contract SignerRole {
contract SignerRole is Initializable {
using Roles for Roles.Role;
event SignerAdded(address indexed account);
@ -11,8 +12,10 @@ contract SignerRole {
Roles.Role private signers;
constructor() public {
signers.add(msg.sender);
function initialize(address sender) public initializer {
if (!isSigner(sender)) {
_addSigner(sender);
}
}
modifier onlySigner() {
@ -25,16 +28,22 @@ contract SignerRole {
}
function addSigner(address account) public onlySigner {
signers.add(account);
emit SignerAdded(account);
_addSigner(account);
}
function renounceSigner() public {
signers.remove(msg.sender);
_removeSigner(msg.sender);
}
function _addSigner(address account) internal {
signers.add(account);
emit SignerAdded(account);
}
function _removeSigner(address account) internal {
signers.remove(account);
emit SignerRemoved(account);
}
uint256[50] private ______gap;
}

View File

@ -1,87 +0,0 @@
pragma solidity ^0.4.24;
import "../payment/PullPayment.sol";
import "../ownership/Ownable.sol";
/**
* @title BreakInvariantBounty
* @dev This bounty will pay out to a researcher if they break invariant logic of the contract.
*/
contract BreakInvariantBounty is PullPayment, Ownable {
bool private _claimed;
mapping(address => address) private _researchers;
event TargetCreated(address createdAddress);
/**
* @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed.
*/
function() external payable {
require(!_claimed);
}
/**
* @dev Determine if the bounty was claimed.
* @return true if the bounty was claimed, false otherwise.
*/
function claimed() public view returns(bool) {
return _claimed;
}
/**
* @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;
emit TargetCreated(target);
return target;
}
/**
* @dev Transfers the contract funds to the researcher that proved the contract is broken.
* @param target contract
*/
function claim(Target target) public {
address researcher = _researchers[target];
require(researcher != address(0));
// Check Target contract invariants
require(!target.checkInvariant());
_asyncTransfer(researcher, address(this).balance);
_claimed = true;
}
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() public onlyOwner {
selfdestruct(owner());
}
/**
* @dev Internal function to deploy the target contract.
* @return A target contract address
*/
function _deployContract() internal returns(address);
}
/**
* @title Target
* @dev Your main contract should inherit from this class and implement the checkInvariant method.
*/
contract Target {
/**
* @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,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../token/ERC20/IERC20.sol";
import "../math/SafeMath.sol";
import "../token/ERC20/SafeERC20.sol";
@ -17,7 +18,7 @@ import "../token/ERC20/SafeERC20.sol";
* the methods to add functionality. Consider using 'super' where appropriate to concatenate
* behavior.
*/
contract Crowdsale {
contract Crowdsale is Initializable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
@ -58,7 +59,7 @@ contract Crowdsale {
* @param wallet Address where collected funds will be forwarded to
* @param token Address of the token being sold
*/
constructor(uint256 rate, address wallet, IERC20 token) public {
function initialize(uint256 rate, address wallet, IERC20 token) public initializer {
require(rate > 0);
require(wallet != address(0));
require(token != address(0));
@ -140,6 +141,10 @@ contract Crowdsale {
// Internal interface (extensible)
// -----------------------------------------
function _hasBeenInitialized() internal view returns (bool) {
return ((_rate > 0) && (_wallet != address(0)) && (_token != address(0)));
}
/**
* @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. Use `super` in contracts that inherit from Crowdsale to extend their validations.
* Example from CappedCrowdsale.sol's _preValidatePurchase method:
@ -231,4 +236,6 @@ contract Crowdsale {
function _forwardFunds() internal {
_wallet.transfer(msg.value);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../../math/SafeMath.sol";
import "../validation/TimedCrowdsale.sol";
@ -9,7 +10,7 @@ import "../validation/TimedCrowdsale.sol";
* @dev Extension of Crowdsale with a one-off finalization action, where one
* can do extra work after finishing.
*/
contract FinalizableCrowdsale is TimedCrowdsale {
contract FinalizableCrowdsale is Initializable, TimedCrowdsale {
using SafeMath for uint256;
bool private _finalized = false;
@ -45,4 +46,6 @@ contract FinalizableCrowdsale is TimedCrowdsale {
function _finalization() internal {
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../validation/TimedCrowdsale.sol";
import "../../token/ERC20/IERC20.sol";
import "../../math/SafeMath.sol";
@ -9,7 +10,7 @@ import "../../math/SafeMath.sol";
* @title PostDeliveryCrowdsale
* @dev Crowdsale that locks tokens from withdrawal until it ends.
*/
contract PostDeliveryCrowdsale is TimedCrowdsale {
contract PostDeliveryCrowdsale is Initializable, TimedCrowdsale {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
@ -47,4 +48,6 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
_balances[beneficiary] = _balances[beneficiary].add(tokenAmount);
}
uint256[50] private ______gap;
}

View File

@ -1,6 +1,7 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../../math/SafeMath.sol";
import "./FinalizableCrowdsale.sol";
import "../../payment/RefundEscrow.sol";
@ -11,7 +12,7 @@ import "../../payment/RefundEscrow.sol";
* @dev Extension of Crowdsale contract that adds a funding goal, and
* the possibility of users getting a refund if goal is not met.
*/
contract RefundableCrowdsale is FinalizableCrowdsale {
contract RefundableCrowdsale is Initializable, FinalizableCrowdsale {
using SafeMath for uint256;
// minimum amount of funds to be raised in weis
@ -24,9 +25,18 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @dev Constructor, creates RefundEscrow.
* @param goal Funding goal
*/
constructor(uint256 goal) public {
function initialize(uint256 goal) public initializer {
// FinalizableCrowdsale depends on TimedCrowdsale
assert(TimedCrowdsale._hasBeenInitialized());
require(goal > 0);
_escrow = new RefundEscrow(wallet());
// conditional added to make initializer idempotent in case of diamond inheritance
if (address(_escrow) == address(0)) {
_escrow = new RefundEscrow();
_escrow.initialize(wallet(), address(this));
}
_goal = goal;
}
@ -77,4 +87,6 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
_escrow.deposit.value(msg.value)(msg.sender);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../Crowdsale.sol";
import "../../token/ERC20/IERC20.sol";
import "../../token/ERC20/SafeERC20.sol";
@ -10,7 +11,7 @@ import "../../math/SafeMath.sol";
* @title AllowanceCrowdsale
* @dev Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale.
*/
contract AllowanceCrowdsale is Crowdsale {
contract AllowanceCrowdsale is Initializable, Crowdsale {
using SafeMath for uint256;
using SafeERC20 for IERC20;
@ -20,7 +21,9 @@ contract AllowanceCrowdsale is Crowdsale {
* @dev Constructor, takes token wallet address.
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
*/
constructor(address tokenWallet) public {
function initialize(address tokenWallet) public initializer {
assert(Crowdsale._hasBeenInitialized());
require(tokenWallet != address(0));
_tokenWallet = tokenWallet;
}
@ -53,4 +56,6 @@ contract AllowanceCrowdsale is Crowdsale {
{
token().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../Crowdsale.sol";
import "../../token/ERC20/ERC20Mintable.sol";
@ -9,7 +10,7 @@ import "../../token/ERC20/ERC20Mintable.sol";
* @dev Extension of Crowdsale contract whose tokens are minted in each purchase.
* Token ownership should be transferred to MintedCrowdsale for minting.
*/
contract MintedCrowdsale is Crowdsale {
contract MintedCrowdsale is Initializable, Crowdsale {
/**
* @dev Overrides delivery by minting tokens upon purchase.
@ -26,4 +27,6 @@ contract MintedCrowdsale is Crowdsale {
require(
ERC20Mintable(address(token())).mint(beneficiary, tokenAmount));
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
@ -10,7 +11,7 @@ import "../../math/SafeMath.sol";
* Note that what should be provided to the constructor is the initial and final _rates_, that is,
* the amount of tokens per wei contributed. Thus, the initial rate must be greater than the final rate.
*/
contract IncreasingPriceCrowdsale is TimedCrowdsale {
contract IncreasingPriceCrowdsale is Initializable, TimedCrowdsale {
using SafeMath for uint256;
uint256 private _initialRate;
@ -21,7 +22,9 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
* @param initialRate Number of tokens a buyer gets per wei at the start of the crowdsale
* @param finalRate Number of tokens a buyer gets per wei at the end of the crowdsale
*/
constructor(uint256 initialRate, uint256 finalRate) public {
function initialize(uint256 initialRate, uint256 finalRate) public initializer {
assert(TimedCrowdsale._hasBeenInitialized());
require(finalRate > 0);
require(initialRate >= finalRate);
_initialRate = initialRate;
@ -67,4 +70,6 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
return currentRate.mul(weiAmount);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
@ -8,7 +9,7 @@ import "../Crowdsale.sol";
* @title CappedCrowdsale
* @dev Crowdsale with a limit for total contributions.
*/
contract CappedCrowdsale is Crowdsale {
contract CappedCrowdsale is Initializable, Crowdsale {
using SafeMath for uint256;
uint256 private _cap;
@ -17,7 +18,9 @@ contract CappedCrowdsale is Crowdsale {
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
* @param cap Max amount of wei to be contributed
*/
constructor(uint256 cap) public {
function initialize(uint256 cap) public initializer {
assert(Crowdsale._hasBeenInitialized());
require(cap > 0);
_cap = cap;
}
@ -52,4 +55,6 @@ contract CappedCrowdsale is Crowdsale {
require(weiRaised().add(weiAmount) <= _cap);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
import "../../access/roles/CapperRole.sol";
@ -9,12 +10,18 @@ import "../../access/roles/CapperRole.sol";
* @title IndividuallyCappedCrowdsale
* @dev Crowdsale with per-beneficiary caps.
*/
contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
contract IndividuallyCappedCrowdsale is Initializable, Crowdsale, CapperRole {
using SafeMath for uint256;
mapping(address => uint256) private _contributions;
mapping(address => uint256) private _caps;
function initialize(address sender) public initializer {
assert(Crowdsale._hasBeenInitialized());
CapperRole.initialize(sender);
}
/**
* @dev Sets a specific beneficiary's maximum contribution.
* @param beneficiary Address to be capped
@ -76,4 +83,6 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
weiAmount);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
@ -8,7 +9,7 @@ import "../Crowdsale.sol";
* @title TimedCrowdsale
* @dev Crowdsale accepting contributions only within a time frame.
*/
contract TimedCrowdsale is Crowdsale {
contract TimedCrowdsale is Initializable, Crowdsale {
using SafeMath for uint256;
uint256 private _openingTime;
@ -27,7 +28,9 @@ contract TimedCrowdsale is Crowdsale {
* @param openingTime Crowdsale opening time
* @param closingTime Crowdsale closing time
*/
constructor(uint256 openingTime, uint256 closingTime) public {
function initialize(uint256 openingTime, uint256 closingTime) public initializer {
assert(Crowdsale._hasBeenInitialized());
// solium-disable-next-line security/no-block-members
require(openingTime >= block.timestamp);
require(closingTime >= openingTime);
@ -67,6 +70,10 @@ contract TimedCrowdsale is Crowdsale {
return block.timestamp > _closingTime;
}
function _hasBeenInitialized() internal view returns (bool) {
return ((_openingTime > 0) && (_closingTime > 0));
}
/**
* @dev Extend parent behavior requiring to be within contributing period
* @param beneficiary Token purchaser
@ -82,4 +89,6 @@ contract TimedCrowdsale is Crowdsale {
super._preValidatePurchase(beneficiary, weiAmount);
}
uint256[50] private ______gap;
}

View File

@ -2,28 +2,28 @@ pragma solidity ^0.4.24;
/**
* @title AutoIncrementing
* @title Counter
* @author Matt Condon (@shrugs)
* @dev Provides an auto-incrementing uint256 id acquired by the `Counter#nextId` getter.
* @dev Provides an incrementing uint256 id acquired by the `Counter#next` getter.
* Use this for issuing ERC721 ids or keeping track of request ids, anything you want, really.
*
* Include with `using AutoIncrementing for AutoIncrementing.Counter;`
* Include with `using Counter for Counter.Counter;`
* @notice Does not allow an Id of 0, which is popularly used to signify a null state in solidity.
* Does not protect from overflows, but if you have 2^256 ids, you have other problems.
* (But actually, it's generally impossible to increment a counter this many times, energy wise
* so it's not something you have to worry about.)
*/
library AutoIncrementing {
library Counter {
struct Counter {
uint256 prevId; // default: 0
uint256 current; // default: 0
}
function nextId(Counter storage counter)
function next(Counter storage index)
internal
returns (uint256)
{
counter.prevId = counter.prevId + 1;
return counter.prevId;
index.current += 1;
return index.current;
}
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../../token/ERC20/IERC20.sol";
@ -9,16 +10,19 @@ import "../../token/ERC20/IERC20.sol";
* @dev tokenURI must respond with a URI that implements https://eips.ethereum.org/EIPS/eip-1047
* @dev TODO - update https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC721/IERC721.sol#L17 when 1046 is finalized
*/
contract ERC20TokenMetadata is IERC20 {
contract ERC20TokenMetadata is Initializable, IERC20 {
function tokenURI() external view returns (string);
uint256[50] private ______gap;
}
contract ERC20WithMetadata is ERC20TokenMetadata {
contract ERC20WithMetadata is Initializable, ERC20TokenMetadata {
string private _tokenURI = "";
constructor(string tokenURI)
function initialize(string tokenURI)
public
initializer
{
_tokenURI = tokenURI;
}
@ -26,4 +30,6 @@ contract ERC20WithMetadata is ERC20TokenMetadata {
function tokenURI() external view returns (string) {
return _tokenURI;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/ERC20Mintable.sol";
import "../token/ERC20/SafeERC20.sol";
@ -32,7 +33,7 @@ import "../math/Math.sol";
* await migrator.beginMigration(newToken.address);
* ```
*/
contract ERC20Migrator {
contract ERC20Migrator is Initializable {
using SafeERC20 for IERC20;
/// Address of the old token contract
@ -44,7 +45,7 @@ contract ERC20Migrator {
/**
* @param legacyToken address of the old token contract
*/
constructor(IERC20 legacyToken) public {
function initialize(IERC20 legacyToken) public initializer {
require(legacyToken != address(0));
_legacyToken = legacyToken;
}
@ -98,4 +99,6 @@ contract ERC20Migrator {
uint256 amount = Math.min(balance, allowance);
migrate(account, amount);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../access/roles/SignerRole.sol";
import "../cryptography/ECDSA.sol";
@ -28,7 +29,7 @@ import "../cryptography/ECDSA.sol";
* Also non fixed sized parameters make constructing the data in the signature
* much more complex. See https://ethereum.stackexchange.com/a/50616 for more details.
*/
contract SignatureBouncer is SignerRole {
contract SignatureBouncer is Initializable, SignerRole {
using ECDSA for bytes32;
// Function selectors are 4 bytes long, as documented in
@ -64,6 +65,10 @@ contract SignatureBouncer is SignerRole {
_;
}
function initialize(address sender) public initializer {
SignerRole.initialize(sender);
}
/**
* @dev is the signature of `this + sender` from a signer?
* @return bool
@ -135,4 +140,6 @@ contract SignatureBouncer is SignerRole {
return signer != address(0) && isSigner(signer);
}
uint256[50] private ______gap;
}

View File

@ -2,6 +2,7 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../token/ERC20/SafeERC20.sol";
import "../ownership/Ownable.sol";
import "../math/SafeMath.sol";
@ -13,7 +14,7 @@ import "../math/SafeMath.sol";
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Ownable {
contract TokenVesting is Initializable, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
@ -42,15 +43,19 @@ contract TokenVesting is Ownable {
* @param duration duration in seconds of the period in which the tokens will vest
* @param revocable whether the vesting is revocable or not
*/
constructor(
function initialize(
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration,
bool revocable
bool revocable,
address sender
)
public
initializer
{
Ownable.initialize(sender);
require(beneficiary != address(0));
require(cliffDuration <= duration);
@ -171,4 +176,6 @@ contract TokenVesting is Ownable {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
}
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
import "../crowdsale/emission/MintedCrowdsale.sol";
@ -11,11 +12,21 @@ import "../token/ERC20/ERC20Mintable.sol";
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a crowdsale contract.
*/
contract SampleCrowdsaleToken is ERC20Mintable {
contract SampleCrowdsaleToken is Initializable, ERC20Mintable {
string public constant name = "Sample Crowdsale Token";
string public constant symbol = "SCT";
uint8 public constant decimals = 18;
string public name;
string public symbol;
uint8 public decimals;
function initialize(address sender) public initializer {
ERC20Mintable.initialize(sender);
name = "Sample Crowdsale Token";
symbol = "SCT";
decimals = 18;
}
uint256[50] private ______gap;
}
@ -35,9 +46,9 @@ contract SampleCrowdsaleToken is ERC20Mintable {
// https://github.com/duaraghav8/Solium/issues/205
// --elopio - 2018-05-10
// solium-disable-next-line max-len
contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
contract SampleCrowdsale is Initializable, Crowdsale, CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
constructor(
function initialize(
uint256 openingTime,
uint256 closingTime,
uint256 rate,
@ -47,13 +58,17 @@ contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsal
uint256 goal
)
public
Crowdsale(rate, wallet, token)
CappedCrowdsale(cap)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
initializer
{
Crowdsale.initialize(rate, wallet, token);
CappedCrowdsale.initialize(cap);
TimedCrowdsale.initialize(openingTime, closingTime);
RefundableCrowdsale.initialize(goal);
//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);
}
uint256[50] private ______gap;
}

View File

@ -1,6 +1,7 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../token/ERC20/ERC20.sol";
@ -10,7 +11,7 @@ import "../token/ERC20/ERC20.sol";
* Note they can later distribute these tokens as they wish using `transfer` and other
* `ERC20` functions.
*/
contract SimpleToken is ERC20 {
contract SimpleToken is Initializable, ERC20 {
string public constant name = "SimpleToken";
string public constant symbol = "SIM";
@ -19,10 +20,12 @@ contract SimpleToken is ERC20 {
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
* @dev Constructor that gives sender all of existing tokens.
*/
constructor() public {
_mint(msg.sender, INITIAL_SUPPLY);
function initialize(address sender) public initializer {
_mint(sender, INITIAL_SUPPLY);
}
uint256[50] private ______gap;
}

View File

@ -0,0 +1,42 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../token/ERC20/ERC20Detailed.sol";
import "../token/ERC20/ERC20Mintable.sol";
import "../token/ERC20/ERC20Pausable.sol";
/**
* @title Standard ERC20 token, with minting and pause functionality.
*
*/
contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
function initialize(
string name, string symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
address[] minters, address[] pausers
) public initializer {
ERC20Detailed.initialize(name, symbol, decimals);
// Mint the initial supply
if (initialSupply > 0) { // To allow passing a null address when not doing any initial supply
_mint(initialHolder, initialSupply);
}
// Initialize the minter and pauser roles, and renounce them
ERC20Mintable.initialize(address(this));
renounceMinter();
ERC20Pausable.initialize(address(this));
renouncePauser();
// Add the requested minters and pausers (this can be done after renouncing since
// these are the internal calls)
for (uint256 i = 0; i < minters.length; ++i) {
_addMinter(minters[i]);
}
for (i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./IERC165.sol";
@ -8,7 +9,7 @@ import "./IERC165.sol";
* @author Matt Condon (@shrugs)
* @dev Implements ERC165 using a lookup table.
*/
contract ERC165 is IERC165 {
contract ERC165 is Initializable, IERC165 {
bytes4 private constant _InterfaceId_ERC165 = 0x01ffc9a7;
/**
@ -25,8 +26,9 @@ contract ERC165 is IERC165 {
* @dev A contract implementing SupportsInterfaceWithLookup
* implement ERC165 itself
*/
constructor()
function initialize()
public
initializer
{
_registerInterface(_InterfaceId_ERC165);
}
@ -35,7 +37,7 @@ contract ERC165 is IERC165 {
* @dev implement supportsInterface(bytes4) using a lookup table
*/
function supportsInterface(bytes4 interfaceId)
external
public
view
returns (bool)
{
@ -51,4 +53,6 @@ contract ERC165 is IERC165 {
require(interfaceId != 0xffffffff);
_supportedInterfaces[interfaceId] = true;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../access/roles/PauserRole.sol";
@ -7,12 +8,15 @@ import "../access/roles/PauserRole.sol";
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is PauserRole {
contract Pausable is Initializable, PauserRole {
event Paused();
event Unpaused();
bool private _paused = false;
function initialize(address sender) public initializer {
PauserRole.initialize(sender);
}
/**
* @return true if the contract is paused, false otherwise.
@ -52,4 +56,6 @@ contract Pausable is PauserRole {
_paused = false;
emit Unpaused();
}
uint256[50] private ______gap;
}

View File

@ -13,9 +13,9 @@ contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
address tokenWallet
)
public
Crowdsale(rate, wallet, token)
AllowanceCrowdsale(tokenWallet)
{
Crowdsale.initialize(rate, wallet, token);
AllowanceCrowdsale.initialize(tokenWallet);
}
}

View File

@ -1,21 +0,0 @@
pragma solidity ^0.4.24;
import "../utils/AutoIncrementing.sol";
contract AutoIncrementingImpl {
using AutoIncrementing for AutoIncrementing.Counter;
uint256 public theId;
// use whatever key you want to track your counters
mapping(string => AutoIncrementing.Counter) private _counters;
function doThing(string key)
public
returns (uint256)
{
theId = _counters[key].nextId();
return theId;
}
}

View File

@ -13,9 +13,9 @@ contract CappedCrowdsaleImpl is CappedCrowdsale {
uint256 cap
)
public
Crowdsale(rate, wallet, token)
CappedCrowdsale(cap)
{
Crowdsale.initialize(rate, wallet, token);
CappedCrowdsale.initialize(cap);
}
}

View File

@ -4,6 +4,10 @@ import "../access/roles/CapperRole.sol";
contract CapperRoleMock is CapperRole {
constructor() public {
CapperRole.initialize(msg.sender);
}
function removeCapper(address account) public {
_removeCapper(account);
}

View File

@ -1,6 +1,5 @@
pragma solidity ^0.4.24;
import "../payment/ConditionalEscrow.sol";
@ -8,6 +7,10 @@ import "../payment/ConditionalEscrow.sol";
contract ConditionalEscrowMock is ConditionalEscrow {
mapping(address => bool) private _allowed;
constructor() public {
ConditionalEscrow.initialize(msg.sender);
}
function setAllowed(address payee, bool allowed) public {
_allowed[payee] = allowed;
}

View File

@ -0,0 +1,21 @@
pragma solidity ^0.4.24;
import "../drafts/Counter.sol";
contract CounterImpl {
using Counter for Counter.Counter;
uint256 public theId;
// use whatever key you want to track your counters
mapping(string => Counter.Counter) private _counters;
function doThing(string key)
public
returns (uint256)
{
theId = _counters[key].next();
return theId;
}
}

View File

@ -0,0 +1,10 @@
pragma solidity ^0.4.24;
import "../crowdsale/Crowdsale.sol";
contract CrowdsaleMock is Crowdsale {
constructor(uint256 rate, address wallet, IERC20 token) public {
Crowdsale.initialize(rate, wallet, token);
}
}

View File

@ -10,7 +10,8 @@ contract ERC20DetailedMock is ERC20, ERC20Detailed {
string symbol,
uint8 decimals
)
ERC20Detailed(name, symbol, decimals)
public
{}
{
ERC20Detailed.initialize(name, symbol, decimals);
}
}

View File

@ -1,6 +1,5 @@
pragma solidity ^0.4.24;
import "../cryptography/ECDSA.sol";

View File

@ -4,6 +4,10 @@ import "../introspection/ERC165.sol";
contract ERC165Mock is ERC165 {
constructor() public {
ERC165.initialize();
}
function registerInterface(bytes4 interfaceId)
public
{

View File

@ -0,0 +1,13 @@
pragma solidity ^0.4.24;
import "../token/ERC20/ERC20Capped.sol";
import "./MinterRoleMock.sol";
contract ERC20CappedMock is ERC20Capped, MinterRoleMock {
constructor(uint256 cap) public {
ERC20Capped.initialize(cap, msg.sender);
}
}

View File

@ -0,0 +1,12 @@
pragma solidity ^0.4.24;
import "../drafts/ERC20Migrator.sol";
contract ERC20MigratorMock is ERC20Migrator {
constructor(IERC20 legacyToken) public {
ERC20Migrator.initialize(legacyToken);
}
}

View File

@ -5,4 +5,8 @@ import "./MinterRoleMock.sol";
contract ERC20MintableMock is ERC20Mintable, MinterRoleMock {
constructor() public {
ERC20Mintable.initialize(msg.sender);
}
}

View File

@ -8,6 +8,8 @@ import "./PauserRoleMock.sol";
contract ERC20PausableMock is ERC20Pausable, PauserRoleMock {
constructor(address initialAccount, uint initialBalance) public {
ERC20Pausable.initialize(msg.sender);
_mint(initialAccount, initialBalance);
}

View File

@ -5,8 +5,7 @@ import "../drafts/ERC1046/TokenMetadata.sol";
contract ERC20WithMetadataMock is ERC20, ERC20WithMetadata {
constructor(string tokenURI) public
ERC20WithMetadata(tokenURI)
{
constructor(string tokenURI) public {
ERC20WithMetadata.initialize(tokenURI);
}
}

View File

@ -2,19 +2,24 @@ pragma solidity ^0.4.24;
import "../token/ERC721/ERC721Full.sol";
import "../token/ERC721/ERC721Mintable.sol";
import "../token/ERC721/ERC721MetadataMintable.sol";
import "../token/ERC721/ERC721Burnable.sol";
/**
* @title ERC721Mock
* @title ERC721FullMock
* This mock just provides a public mint and burn functions for testing purposes,
* and a public setter for metadata URI
*/
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721Burnable {
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor(string name, string symbol) public
ERC721Mintable()
ERC721Full(name, symbol)
{}
{
ERC721.initialize();
ERC721Metadata.initialize(name, symbol);
ERC721Enumerable.initialize();
ERC721Mintable.initialize(msg.sender);
ERC721MetadataMintable.initialize(msg.sender);
}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);

View File

@ -2,6 +2,7 @@ pragma solidity ^0.4.24;
import "../token/ERC721/ERC721Full.sol";
import "../token/ERC721/ERC721Mintable.sol";
import "../token/ERC721/ERC721MetadataMintable.sol";
import "../token/ERC721/ERC721Burnable.sol";
@ -9,12 +10,15 @@ import "../token/ERC721/ERC721Burnable.sol";
* @title ERC721MintableBurnableImpl
*/
contract ERC721MintableBurnableImpl
is ERC721Full, ERC721Mintable, ERC721Burnable {
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor()
ERC721Mintable()
ERC721Full("Test", "TEST")
public
{
ERC721.initialize();
ERC721Metadata.initialize("Test", "TEST");
ERC721Enumerable.initialize();
ERC721Mintable.initialize(msg.sender);
ERC721MetadataMintable.initialize(msg.sender);
}
}

View File

@ -8,6 +8,10 @@ import "../token/ERC721/ERC721.sol";
* This mock just provides a public mint and burn functions for testing purposes
*/
contract ERC721Mock is ERC721 {
constructor() public {
ERC721.initialize();
}
function mint(address to, uint256 tokenId) public {
_mint(to, tokenId);
}

View File

@ -9,6 +9,11 @@ import "./PauserRoleMock.sol";
* This mock just provides a public mint, burn and exists functions for testing purposes
*/
contract ERC721PausableMock is ERC721Pausable, PauserRoleMock {
constructor() {
ERC721.initialize();
ERC721Pausable.initialize(msg.sender);
}
function mint(address to, uint256 tokenId) public {
super._mint(to, tokenId);
}

View File

@ -0,0 +1,9 @@
pragma solidity ^0.4.24;
import "../payment/Escrow.sol";
contract EscrowMock is Escrow {
constructor() public {
Escrow.initialize(msg.sender);
}
}

View File

@ -14,9 +14,9 @@ contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
IERC20 token
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
{
Crowdsale.initialize(rate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);
}
}

View File

@ -15,10 +15,10 @@ contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
uint256 finalRate
)
public
Crowdsale(initialRate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
IncreasingPriceCrowdsale(initialRate, finalRate)
{
Crowdsale.initialize(initialRate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);
IncreasingPriceCrowdsale.initialize(initialRate, finalRate);
}
}

View File

@ -6,7 +6,7 @@ import "./CapperRoleMock.sol";
contract IndividuallyCappedCrowdsaleImpl
is IndividuallyCappedCrowdsale, CapperRoleMock {
is Crowdsale, IndividuallyCappedCrowdsale, CapperRoleMock {
constructor(
uint256 rate,
@ -14,7 +14,8 @@ contract IndividuallyCappedCrowdsaleImpl
IERC20 token
)
public
Crowdsale(rate, wallet, token)
{
Crowdsale.initialize(rate, wallet, token);
IndividuallyCappedCrowdsale.initialize(msg.sender);
}
}

View File

@ -1,20 +0,0 @@
pragma solidity ^0.4.24;
// When this line is split, truffle parsing fails.
// See: https://github.com/ethereum/solidity/issues/4871
// solium-disable-next-line max-len
import {BreakInvariantBounty, Target} from "../../contracts/bounties/BreakInvariantBounty.sol";
contract InsecureInvariantTargetMock is Target {
function checkInvariant() public returns(bool) {
return false;
}
}
contract InsecureInvariantTargetBounty is BreakInvariantBounty {
function _deployContract() internal returns (address) {
return new InsecureInvariantTargetMock();
}
}

View File

@ -1,7 +1,7 @@
pragma solidity ^0.4.24;
import "../../contracts/math/Math.sol";
import "../math/Math.sol";
contract MathMock {

View File

@ -12,8 +12,8 @@ contract MintedCrowdsaleImpl is MintedCrowdsale {
ERC20Mintable token
)
public
Crowdsale(rate, wallet, token)
{
Crowdsale.initialize(rate, wallet, token);
}
}

View File

@ -4,6 +4,10 @@ import "../access/roles/MinterRole.sol";
contract MinterRoleMock is MinterRole {
constructor() public {
MinterRole.initialize(msg.sender);
}
function removeMinter(address account) public {
_removeMinter(account);
}

View File

@ -0,0 +1,9 @@
pragma solidity ^0.4.24;
import { Ownable } from "../ownership/Ownable.sol";
contract OwnableMock is Ownable {
constructor() {
Ownable.initialize(msg.sender);
}
}

View File

@ -1,6 +1,5 @@
pragma solidity ^0.4.24;
import "../lifecycle/Pausable.sol";
import "./PauserRoleMock.sol";
@ -11,6 +10,8 @@ contract PausableMock is Pausable, PauserRoleMock {
uint256 public count;
constructor() public {
Pausable.initialize(msg.sender);
drasticMeasureTaken = false;
count = 0;
}

View File

@ -4,6 +4,10 @@ import "../access/roles/PauserRole.sol";
contract PauserRoleMock is PauserRole {
constructor() public {
PauserRole.initialize(msg.sender);
}
function removePauser(address account) public {
_removePauser(account);
}

View File

@ -14,9 +14,9 @@ contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
IERC20 token
)
public
TimedCrowdsale(openingTime, closingTime)
Crowdsale(rate, wallet, token)
{
Crowdsale.initialize(rate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);
}
}

View File

@ -7,7 +7,9 @@ import "../payment/PullPayment.sol";
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
constructor() public payable { }
constructor() public payable {
PullPayment.initialize();
}
// test helper function to call asyncTransfer
function callTransfer(address dest, uint256 amount) public {

View File

@ -9,6 +9,7 @@ contract ReentrancyMock is ReentrancyGuard {
uint256 public counter;
constructor() public {
ReentrancyGuard.initialize();
counter = 0;
}

View File

@ -0,0 +1,9 @@
pragma solidity ^0.4.24;
import "../payment/RefundEscrow.sol";
contract RefundEscrowMock is RefundEscrow {
constructor(address beneficiary) public {
RefundEscrow.initialize(beneficiary, msg.sender);
}
}

View File

@ -4,7 +4,7 @@ import "../token/ERC20/ERC20Mintable.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
contract RefundableCrowdsaleImpl is RefundableCrowdsale {
contract RefundableCrowdsaleImpl is Crowdsale, TimedCrowdsale, RefundableCrowdsale {
constructor (
uint256 openingTime,
@ -15,10 +15,10 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale {
uint256 goal
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
RefundableCrowdsale(goal)
{
Crowdsale.initialize(rate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);
RefundableCrowdsale.initialize(goal);
}
}

View File

@ -0,0 +1,26 @@
pragma solidity ^0.4.24;
import "../examples/SampleCrowdsale.sol";
contract SampleCrowdsaleTokenMock is SampleCrowdsaleToken {
constructor() public {
SampleCrowdsaleToken.initialize(msg.sender);
}
}
contract SampleCrowdsaleMock is SampleCrowdsale {
constructor(
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
uint256 cap,
ERC20Mintable token,
uint256 goal
)
public
{
SampleCrowdsale.initialize(openingTime, closingTime, rate, wallet, cap, token, goal);
}
}

View File

@ -4,6 +4,10 @@ import "../ownership/Secondary.sol";
contract SecondaryMock is Secondary {
constructor() public {
Secondary.initialize(msg.sender);
}
function onlyPrimaryMock() public view onlyPrimary {
}
}

View File

@ -1,20 +0,0 @@
pragma solidity ^0.4.24;
// When this line is split, truffle parsing fails.
// See: https://github.com/ethereum/solidity/issues/4871
// solium-disable-next-line max-len
import {BreakInvariantBounty, Target} from "../../contracts/bounties/BreakInvariantBounty.sol";
contract SecureInvariantTargetMock is Target {
function checkInvariant() public returns(bool) {
return true;
}
}
contract SecureInvariantTargetBounty is BreakInvariantBounty {
function _deployContract() internal returns (address) {
return new SecureInvariantTargetMock();
}
}

View File

@ -5,6 +5,10 @@ import "./SignerRoleMock.sol";
contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
constructor() public {
SignatureBouncer.initialize(msg.sender);
}
function checkValidSignature(address account, bytes signature)
public
view
@ -64,4 +68,11 @@ contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
{
}
function tooShortMsgData()
public
onlyValidSignatureAndData("")
view
{
}
}

View File

@ -4,6 +4,10 @@ import "../access/roles/SignerRole.sol";
contract SignerRoleMock is SignerRole {
constructor() public {
SignerRole.initialize(msg.sender);
}
function removeSigner(address account) public {
_removeSigner(account);
}

View File

@ -0,0 +1,9 @@
pragma solidity ^0.4.24;
import "../examples/SimpleToken.sol";
contract SimpleTokenMock is SimpleToken {
constructor() public {
SimpleToken.initialize(msg.sender);
}
}

View File

@ -0,0 +1,9 @@
pragma solidity ^0.4.24;
import "../payment/SplitPayment.sol";
contract SplitPaymentMock is SplitPayment {
constructor(address[] payees, uint256[] shares) public {
SplitPayment.initialize(payees, shares);
}
}

View File

@ -14,9 +14,9 @@ contract TimedCrowdsaleImpl is TimedCrowdsale {
IERC20 token
)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
{
Crowdsale.initialize(rate, wallet, token);
TimedCrowdsale.initialize(openingTime, closingTime);
}
}

View File

@ -0,0 +1,13 @@
pragma solidity ^0.4.24;
import "../token/ERC20/TokenTimelock.sol";
contract TokenTimelockMock is TokenTimelock {
constructor(
IERC20 token,
address beneficiary,
uint256 releaseTime
) public {
TokenTimelock.initialize(token, beneficiary, releaseTime);
}
}

View File

@ -0,0 +1,22 @@
pragma solidity ^0.4.24;
import "../drafts/TokenVesting.sol";
contract TokenVestingMock is TokenVesting {
constructor(
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration,
bool revocable
) public {
TokenVesting.initialize(
beneficiary,
start,
cliffDuration,
duration,
revocable,
msg.sender
);
}
}

View File

@ -1,12 +1,13 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
/**
* @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 {
contract Ownable is Initializable {
address private _owner;
@ -21,8 +22,8 @@ contract Ownable {
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
_owner = msg.sender;
function initialize(address sender) public initializer {
_owner = sender;
}
/**
@ -75,4 +76,6 @@ contract Ownable {
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[50] private ______gap;
}

View File

@ -1,18 +1,19 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
/**
* @title Secondary
* @dev A Secondary contract can only be used by its primary account (the one that created it)
*/
contract Secondary {
contract Secondary is Initializable {
address private _primary;
/**
* @dev Sets the primary account to the one that is creating the Secondary contract.
*/
constructor() public {
_primary = msg.sender;
function initialize(address sender) public initializer {
_primary = sender;
}
/**
@ -32,4 +33,6 @@ contract Secondary {
_primary = recipient;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./Escrow.sol";
@ -7,7 +8,11 @@ import "./Escrow.sol";
* @title ConditionalEscrow
* @dev Base abstract escrow to only allow withdrawal if a condition is met.
*/
contract ConditionalEscrow is Escrow {
contract ConditionalEscrow is Initializable, Escrow {
function initialize(address sender) public initializer {
Escrow.initialize(sender);
}
/**
* @dev Returns whether an address is allowed to withdraw their funds. To be
* implemented by derived contracts.
@ -19,4 +24,6 @@ contract ConditionalEscrow is Escrow {
require(withdrawalAllowed(payee));
super.withdraw(payee);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../math/SafeMath.sol";
import "../ownership/Secondary.sol";
@ -11,7 +12,7 @@ import "../ownership/Secondary.sol";
* should be its primary, and provide public methods redirecting to the escrow's
* deposit and withdraw.
*/
contract Escrow is Secondary {
contract Escrow is Initializable, Secondary {
using SafeMath for uint256;
event Deposited(address indexed payee, uint256 weiAmount);
@ -19,6 +20,10 @@ contract Escrow is Secondary {
mapping(address => uint256) private _deposits;
function initialize(address sender) public initializer {
Secondary.initialize(sender);
}
function depositsOf(address payee) public view returns (uint256) {
return _deposits[payee];
}
@ -40,7 +45,6 @@ contract Escrow is Secondary {
*/
function withdraw(address payee) public onlyPrimary {
uint256 payment = _deposits[payee];
assert(address(this).balance >= payment);
_deposits[payee] = 0;
@ -48,4 +52,6 @@ contract Escrow is Secondary {
emit Withdrawn(payee, payment);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./Escrow.sol";
@ -8,11 +9,15 @@ import "./Escrow.sol";
* @dev Base contract supporting async send for pull payments. Inherit from this
* contract and use _asyncTransfer instead of send or transfer.
*/
contract PullPayment {
contract PullPayment is Initializable {
Escrow private _escrow;
constructor() public {
_escrow = new Escrow();
function initialize() public initializer {
// conditional added to make initializer idempotent in case of diamond inheritance
if (address(_escrow) == address(0)) {
_escrow = new Escrow();
_escrow.initialize(address(this));
}
}
/**
@ -39,4 +44,6 @@ contract PullPayment {
function _asyncTransfer(address dest, uint256 amount) internal {
_escrow.deposit.value(amount)(dest);
}
uint256[50] private ______gap;
}

View File

@ -1,7 +1,7 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ConditionalEscrow.sol";
import "../ownership/Secondary.sol";
/**
@ -10,7 +10,7 @@ import "../ownership/Secondary.sol";
* The primary account may close the deposit period, and allow for either withdrawal
* by the beneficiary, or refunds to the depositors.
*/
contract RefundEscrow is Secondary, ConditionalEscrow {
contract RefundEscrow is Initializable, ConditionalEscrow {
enum State { Active, Refunding, Closed }
event Closed();
@ -23,7 +23,9 @@ contract RefundEscrow is Secondary, ConditionalEscrow {
* @dev Constructor.
* @param beneficiary The beneficiary of the deposits.
*/
constructor(address beneficiary) public {
function initialize(address beneficiary, address sender) public initializer {
ConditionalEscrow.initialize(sender);
require(beneficiary != address(0));
_beneficiary = beneficiary;
_state = State.Active;
@ -85,4 +87,6 @@ contract RefundEscrow is Secondary, ConditionalEscrow {
function withdrawalAllowed(address payee) public view returns (bool) {
return _state == State.Refunding;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../math/SafeMath.sol";
@ -8,11 +9,11 @@ import "../math/SafeMath.sol";
* @dev This contract can be used when payments need to be received by a group
* of people and split proportionately to some number of shares they own.
*/
contract SplitPayment {
contract SplitPayment is Initializable {
using SafeMath for uint256;
uint256 private _totalShares = 0;
uint256 private _totalReleased = 0;
uint256 private _totalShares;
uint256 private _totalReleased;
mapping(address => uint256) private _shares;
mapping(address => uint256) private _released;
@ -21,7 +22,7 @@ contract SplitPayment {
/**
* @dev Constructor
*/
constructor(address[] payees, uint256[] shares) public payable {
function initialize(address[] payees, uint256[] shares) public payable initializer {
require(payees.length == shares.length);
require(payees.length > 0);
@ -85,7 +86,6 @@ contract SplitPayment {
);
require(payment != 0);
assert(address(this).balance >= payment);
_released[account] = _released[account].add(payment);
_totalReleased = _totalReleased.add(payment);
@ -107,4 +107,6 @@ contract SplitPayment {
_shares[account] = shares_;
_totalShares = _totalShares.add(shares_);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
@ -11,7 +12,7 @@ import "../../math/SafeMath.sol";
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ERC20 is IERC20 {
contract ERC20 is Initializable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
@ -59,12 +60,7 @@ contract ERC20 is IERC20 {
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(msg.sender, to, value);
_transfer(msg.sender, to, value);
return true;
}
@ -99,14 +95,10 @@ contract ERC20 is IERC20 {
public
returns (bool)
{
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
emit Transfer(from, to, value);
_transfer(from, to, value);
return true;
}
@ -158,6 +150,21 @@ contract ERC20 is IERC20 {
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
@ -203,4 +210,6 @@ contract ERC20 is IERC20 {
amount);
_burn(account, amount);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC20.sol";
@ -7,7 +8,7 @@ import "./ERC20.sol";
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
contract ERC20Burnable is Initializable, ERC20 {
/**
* @dev Burns a specific amount of tokens.
@ -26,11 +27,5 @@ contract ERC20Burnable is ERC20 {
_burnFrom(from, value);
}
/**
* @dev Overrides ERC20._burn in order for burn and burnFrom to emit
* an additional Burn event.
*/
function _burn(address who, uint256 value) internal {
super._burn(who, value);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC20Mintable.sol";
@ -7,13 +8,16 @@ import "./ERC20Mintable.sol";
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract ERC20Capped is ERC20Mintable {
contract ERC20Capped is Initializable, ERC20Mintable {
uint256 private _cap;
constructor(uint256 cap)
function initialize(uint256 cap, address sender)
public
initializer
{
ERC20Mintable.initialize(sender);
require(cap > 0);
_cap = cap;
}
@ -43,4 +47,6 @@ contract ERC20Capped is ERC20Mintable {
return super.mint(to, amount);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./IERC20.sol";
@ -9,12 +10,12 @@ import "./IERC20.sol";
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract ERC20Detailed is IERC20 {
contract ERC20Detailed is Initializable, IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string name, string symbol, uint8 decimals) public {
function initialize(string name, string symbol, uint8 decimals) public initializer {
_name = name;
_symbol = symbol;
_decimals = decimals;
@ -40,4 +41,6 @@ contract ERC20Detailed is IERC20 {
function decimals() public view returns(uint8) {
return _decimals;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC20.sol";
import "../../access/roles/MinterRole.sol";
@ -8,21 +9,9 @@ import "../../access/roles/MinterRole.sol";
* @title ERC20Mintable
* @dev ERC20 minting logic
*/
contract ERC20Mintable is ERC20, MinterRole {
event MintingFinished();
bool private _mintingFinished = false;
modifier onlyBeforeMintingFinished() {
require(!_mintingFinished);
_;
}
/**
* @return true if the minting is finished.
*/
function mintingFinished() public view returns(bool) {
return _mintingFinished;
contract ERC20Mintable is Initializable, ERC20, MinterRole {
function initialize(address sender) public initializer {
MinterRole.initialize(sender);
}
/**
@ -37,25 +26,11 @@ contract ERC20Mintable is ERC20, MinterRole {
)
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
{
_mint(to, amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting()
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
{
_mintingFinished = true;
emit MintingFinished();
return true;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC20.sol";
import "../../lifecycle/Pausable.sol";
@ -8,7 +9,11 @@ import "../../lifecycle/Pausable.sol";
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20, Pausable {
contract ERC20Pausable is Initializable, ERC20, Pausable {
function initialize(address sender) public initializer {
Pausable.initialize(sender);
}
function transfer(
address to,
@ -65,4 +70,6 @@ contract ERC20Pausable is ERC20, Pausable {
{
return super.decreaseAllowance(spender, subtractedValue);
}
uint256[50] private ______gap;
}

View File

@ -0,0 +1,65 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC20Detailed.sol";
import "./ERC20Mintable.sol";
import "./ERC20Pausable.sol";
/**
* @title Standard ERC20 token, with minting and pause functionality.
*
*/
contract StandaloneERC20 is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
function initialize(
string name, string symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
address[] minters, address[] pausers
) public initializer {
require(initialSupply > 0);
ERC20Detailed.initialize(name, symbol, decimals);
// Mint the initial supply
_mint(initialHolder, initialSupply);
// Initialize the minter and pauser roles, and renounce them
ERC20Mintable.initialize(address(this));
renounceMinter();
ERC20Pausable.initialize(address(this));
renouncePauser();
// Add the requested minters and pausers (this can be done after renouncing since
// these are the internal calls)
for (uint256 i = 0; i < minters.length; ++i) {
_addMinter(minters[i]);
}
for (i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}
function initialize(
string name, string symbol, uint8 decimals, address[] minters, address[] pausers
) public initializer {
ERC20Detailed.initialize(name, symbol, decimals);
// Initialize the minter and pauser roles, and renounce them
ERC20Mintable.initialize(address(this));
renounceMinter();
ERC20Pausable.initialize(address(this));
renouncePauser();
// Add the requested minters and pausers (this can be done after renouncing since
// these are the internal calls)
for (uint256 i = 0; i < minters.length; ++i) {
_addMinter(minters[i]);
}
for (i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./SafeERC20.sol";
@ -8,7 +9,7 @@ import "./SafeERC20.sol";
* @dev TokenTimelock is a token holder contract that will allow a
* beneficiary to extract the tokens after a given release time
*/
contract TokenTimelock {
contract TokenTimelock is Initializable {
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
@ -20,12 +21,13 @@ contract TokenTimelock {
// timestamp when token release is enabled
uint256 private _releaseTime;
constructor(
function initialize(
IERC20 token,
address beneficiary,
uint256 releaseTime
)
public
initializer
{
// solium-disable-next-line security/no-block-members
require(releaseTime > block.timestamp);
@ -67,4 +69,6 @@ contract TokenTimelock {
_token.safeTransfer(_beneficiary, amount);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "../../math/SafeMath.sol";
@ -11,7 +12,7 @@ import "../../introspection/ERC165.sol";
* @title ERC721 Non-Fungible Token Standard basic implementation
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721 is ERC165, IERC721 {
contract ERC721 is Initializable, ERC165, IERC721 {
using SafeMath for uint256;
using Address for address;
@ -46,13 +47,20 @@ contract ERC721 is ERC165, IERC721 {
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
*/
constructor()
function initialize()
public
initializer
{
ERC165.initialize();
// register the supported interfaces to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721);
}
function _hasBeenInitialized() internal view returns (bool) {
return supportsInterface(_InterfaceId_ERC721);
}
/**
* @dev Gets the balance of the specified address
* @param owner address to query the balance of
@ -323,4 +331,6 @@ contract ERC721 is ERC165, IERC721 {
msg.sender, from, tokenId, _data);
return (retval == _ERC721_RECEIVED);
}
uint256[50] private ______gap;
}

View File

@ -1,13 +1,16 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC721.sol";
contract ERC721Burnable is ERC721 {
contract ERC721Burnable is Initializable, ERC721 {
function burn(uint256 tokenId)
public
{
require(_isApprovedOrOwner(msg.sender, tokenId));
_burn(ownerOf(tokenId), tokenId);
}
uint256[50] private ______gap;
}

View File

@ -1,11 +1,12 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./IERC721Enumerable.sol";
import "./ERC721.sol";
import "../../introspection/ERC165.sol";
contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
contract ERC721Enumerable is Initializable, ERC165, ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => uint256[]) private _ownedTokens;
@ -29,11 +30,17 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
/**
* @dev Constructor function
*/
constructor() public {
function initialize() public initializer {
require(ERC721._hasBeenInitialized());
// register the supported interface to conform to ERC721 via ERC165
_registerInterface(_InterfaceId_ERC721Enumerable);
}
function _hasBeenInitialized() internal view returns (bool) {
return supportsInterface(_InterfaceId_ERC721Enumerable);
}
/**
* @dev Gets the token ID at a given index of the tokens list of the requested owner
* @param owner address owning the tokens list to be accessed
@ -143,4 +150,6 @@ contract ERC721Enumerable is ERC165, ERC721, IERC721Enumerable {
_allTokensIndex[tokenId] = 0;
_allTokensIndex[lastToken] = tokenIndex;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
import "./ERC721Metadata.sol";
@ -11,9 +12,6 @@ import "./ERC721Metadata.sol";
* Moreover, it includes approve all functionality using operator terminology
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
constructor(string name, string symbol) ERC721Metadata(name, symbol)
public
{
}
contract ERC721Full is Initializable, ERC721, ERC721Enumerable, ERC721Metadata {
uint256[50] private ______gap;
}

View File

@ -1,9 +1,10 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./IERC721Receiver.sol";
contract ERC721Holder is IERC721Receiver {
contract ERC721Holder is Initializable, IERC721Receiver {
function onERC721Received(
address,
address,
@ -15,4 +16,6 @@ contract ERC721Holder is IERC721Receiver {
{
return this.onERC721Received.selector;
}
uint256[50] private ______gap;
}

View File

@ -1,11 +1,12 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC721.sol";
import "./IERC721Metadata.sol";
import "../../introspection/ERC165.sol";
contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
contract ERC721Metadata is Initializable, ERC165, ERC721, IERC721Metadata {
// Token name
string internal _name;
@ -26,7 +27,9 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
/**
* @dev Constructor function
*/
constructor(string name, string symbol) public {
function initialize(string name, string symbol) public initializer {
require(ERC721._hasBeenInitialized());
_name = name;
_symbol = symbol;
@ -34,6 +37,10 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
_registerInterface(InterfaceId_ERC721Metadata);
}
function _hasBeenInitialized() internal view returns (bool) {
return supportsInterface(InterfaceId_ERC721Metadata);
}
/**
* @dev Gets the token name
* @return string representing the token name
@ -85,4 +92,6 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
delete _tokenURIs[tokenId];
}
}
uint256[50] private ______gap;
}

View File

@ -0,0 +1,41 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC721Metadata.sol";
import "../../access/roles/MinterRole.sol";
/**
* @title ERC721MetadataMintable
* @dev ERC721 minting logic with metadata
*/
contract ERC721MetadataMintable is Initializable, ERC721, ERC721Metadata, MinterRole {
function initialize(address sender) public initializer {
require(ERC721._hasBeenInitialized());
require(ERC721Metadata._hasBeenInitialized());
MinterRole.initialize(sender);
}
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param tokenId The token id to mint.
* @param tokenURI The token URI of the minted token.
* @return A boolean that indicates if the operation was successful.
*/
function mintWithTokenURI(
address to,
uint256 tokenId,
string tokenURI
)
public
onlyMinter
returns (bool)
{
_mint(to, tokenId);
_setTokenURI(tokenId, tokenURI);
return true;
}
uint256[50] private ______gap;
}

View File

@ -1,6 +1,7 @@
pragma solidity ^0.4.24;
import "./ERC721Full.sol";
import "zos-lib/contracts/Initializable.sol";
import "./ERC721.sol";
import "../../access/roles/MinterRole.sol";
@ -8,21 +9,10 @@ import "../../access/roles/MinterRole.sol";
* @title ERC721Mintable
* @dev ERC721 minting logic
*/
contract ERC721Mintable is ERC721Full, MinterRole {
event MintingFinished();
bool private _mintingFinished = false;
modifier onlyBeforeMintingFinished() {
require(!_mintingFinished);
_;
}
/**
* @return true if the minting is finished.
*/
function mintingFinished() public view returns(bool) {
return _mintingFinished;
contract ERC721Mintable is Initializable, ERC721, MinterRole {
function initialize(address sender) public initializer {
require(ERC721._hasBeenInitialized());
MinterRole.initialize(sender);
}
/**
@ -37,40 +27,11 @@ contract ERC721Mintable is ERC721Full, MinterRole {
)
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
{
_mint(to, tokenId);
return true;
}
function mintWithTokenURI(
address to,
uint256 tokenId,
string tokenURI
)
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
{
mint(to, tokenId);
_setTokenURI(tokenId, tokenURI);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting()
public
onlyMinter
onlyBeforeMintingFinished
returns (bool)
{
_mintingFinished = true;
emit MintingFinished();
return true;
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "./ERC721.sol";
import "../../lifecycle/Pausable.sol";
@ -8,7 +9,12 @@ import "../../lifecycle/Pausable.sol";
* @title ERC721 Non-Fungible Pausable token
* @dev ERC721 modified with pausable transfers.
**/
contract ERC721Pausable is ERC721, Pausable {
contract ERC721Pausable is Initializable, ERC721, Pausable {
function initialize(address sender) public initializer {
require(ERC721._hasBeenInitialized());
Pausable.initialize(sender);
}
function approve(
address to,
uint256 tokenId
@ -39,4 +45,6 @@ contract ERC721Pausable is ERC721, Pausable {
{
super.transferFrom(from, to, tokenId);
}
uint256[50] private ______gap;
}

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.24;
import "zos-lib/contracts/Initializable.sol";
import "../../introspection/IERC165.sol";
@ -7,7 +8,7 @@ import "../../introspection/IERC165.sol";
* @title ERC721 Non-Fungible Token Standard basic interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract IERC721 is IERC165 {
contract IERC721 is Initializable, IERC165 {
event Transfer(
address indexed from,

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