Compare commits

..

208 Commits

Author SHA1 Message Date
41e79d7887 Use caret for peer dependency 2019-07-22 12:22:05 -03:00
f245f233b3 Release 2.2.1 2019-07-22 12:19:52 -03:00
7ac0502c50 Rename to @openzeppelin/contracts-ethereum-package (#54)
* Change import path from zos-lib to upgrades in all contracts

* Update readme with new naming

* Update package and deps names

* Change path to initializable in AST of networks.jsons

* Migrate manifest version

* Use new oz file locations

* Rename in ERC20Migrator comments

* Update SDK install instructions in README

* Update gitignore to use new session file name

* trigger CI

* Fixes to readme and package version

* Use 2.5.0 release of OpenZeppelin SDK
2019-07-20 13:37:41 -03:00
dee9a2b897 Update README.md 2019-07-19 18:46:02 -03:00
64cf73d646 Merge pull request #53 from abcoathup/patch-1
Documentation: update README links
2019-06-12 01:39:55 -03:00
c4ccdc182f Update README.md
Co-Authored-By: Nicolás Venturo <nicolas.venturo@gmail.com>
2019-06-12 10:52:47 +10:00
e592627578 Changed docs.openzeppelin.org versions to 2.3.0 2019-06-11 16:07:01 +10:00
24416fc208 Update README using referenced links 2019-06-11 16:02:50 +10:00
09dee513ed push to mainnet 2019-06-10 20:31:14 -03:00
906b18f144 add updated zos files except for mainnet deployment 2019-06-06 11:55:12 -03:00
eb6b5b6631 Bump handlebars from 4.0.12 to 4.1.2 (#51)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.12 to 4.1.2.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.0.12...v4.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2019-06-05 20:27:04 -03:00
7d0c6280f3 Bump js-yaml from 3.6.1 to 3.13.1 (#50)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.6.1 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.6.1...3.13.1)
2019-06-05 17:14:06 -03:00
56b7d0713b update package-lock.json 2019-05-30 16:06:05 -03:00
a7d5c72fdc add gap to erc20snapshot 2019-05-30 16:03:15 -03:00
7050b73a89 fix use of msg.sender in example 2019-05-28 18:08:52 -03:00
2b9dc9ae87 Merge tag 'v2.2.0' of github.com:OpenZeppelin/openzeppelin-solidity
v2.2.0
2019-05-28 18:08:44 -03:00
f18fd17355 Merge pull request #48 from OpenZeppelin/docs/update-readme
Add more usage instructions to README
2019-02-13 12:22:16 -03:00
3dbf651b8e Add more usage instructions to README 2019-02-13 12:04:37 -03:00
6bf2ae8229 Merge pull request #46 from ZumZoom/linter
Fix identation and some linter warnings
2019-02-11 18:24:18 -03:00
644b121677 Merge branch 'master' into linter 2019-02-11 01:00:27 +03:00
453e3dd454 Merge pull request #39 from OpenZeppelin/fix/remove-ethpm
Remove ethpm.json
2019-02-06 12:34:52 -03:00
e8e6dd52a5 Remove ethpm.json
The package is not registered in ethpm at the moment. This file was an
artifact leftover from vanilla openzeppelin. This PR removes it, until
we decide to register openzeppelin-eth on ethpm.
2019-02-06 12:34:04 -03:00
105b927b62 Merge pull request #45 from ZumZoom/patch-2
Fix example in README.md
2019-02-06 12:31:11 -03:00
0b1e1810b1 Release v2.1.3 2019-01-29 02:15:39 -03:00
2eb0de4cd2 remove added sender argument 2019-01-28 19:31:03 -03:00
3fd5195573 remove StandardToken (unnecessary duplicate effort) 2019-01-28 19:31:03 -03:00
491fb5acd9 Merge pull request #44 from ZumZoom/patch-1
Remove initialize from ERC721Full
2019-01-28 19:07:46 -03:00
05c7d8c861 fix identation and some linter warnings 2019-01-28 22:04:50 +03:00
d032ca62e2 Fix example in README.md 2019-01-28 19:44:32 +03:00
b306c41525 Remove initialize from ERC721Full
Following d75ba162 ERC721 should not initialize their parents.
2019-01-28 19:39:29 +03:00
b39f3c2055 publish evm package to blockchains 2019-01-24 19:17:18 -03:00
4e026cd4c7 remove new gap 2019-01-24 17:49:30 -03:00
c08d63c118 rename PaymentSplitter in zos.json 2019-01-24 16:50:32 -03:00
e357592208 fix linter errors 2019-01-24 13:18:09 -03:00
f3635e1517 add missing gaps and Initializables 2019-01-23 19:38:00 -03:00
04186e2cf6 fix missing helper 2019-01-22 17:42:48 -03:00
cff2509c63 fix all tests for 2.1.2 2019-01-22 17:35:47 -03:00
dd433c41bb update package-lock.json 2019-01-21 20:07:10 -03:00
4952240620 Merge tag 'v2.1.2' of github.com:OpenZeppelin/openzeppelin-solidity into merge-v2.1
v2.1.2
2019-01-21 19:42:09 -03:00
00f7c19d02 fix remaining tests 2019-01-21 19:28:37 -03:00
5eafd1dec2 fix remaining tests in standalone contracts 2019-01-21 19:28:34 -03:00
f84278433d fix old helpers 2019-01-18 17:53:35 -03:00
73a34f96a7 fix roles initialization bug 2019-01-18 17:53:35 -03:00
877f07f0a9 fix all compilation errors 2019-01-18 17:14:53 -03:00
e808a64649 rename internal initializers 2019-01-18 16:38:26 -03:00
a221c17fb2 Merge tag 'v2.1.1' of github.com:OpenZeppelin/openzeppelin-solidity
v2.1.1
2019-01-18 15:33:51 -03:00
bce2d68e7f convert 2 spaces to 4 spaces 2019-01-17 18:02:50 -03:00
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
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
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
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
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
753 changed files with 28402 additions and 74244 deletions

View File

@ -1,12 +0,0 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "OpenZeppelin/openzeppelin-contracts"
}
],
"commit": false,
"access": "public",
"baseBranch": "master"
}

View File

@ -1,12 +0,0 @@
comment: off
github_checks:
annotations: false
coverage:
status:
patch:
default:
target: 95%
only_pulls: true
project:
default:
threshold: 1%

View File

@ -6,16 +6,7 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = false
max_line_length = 120
[*.sol]
indent_size = 4
[*.js]
indent_size = 2
[*.{adoc,md}]
max_line_length = 0
trim_trailing_whitespace = true

View File

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

1
.gitattributes vendored Normal file
View File

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

View File

@ -1,16 +1,16 @@
---
name: Bug report
about: Report a bug in OpenZeppelin Contracts
about: Report a bug in OpenZeppelin
---
<!-- Briefly describe the issue you're experiencing. 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 Community Forum: https://forum.openzeppelin.com/. -->
<!-- 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**
<!-- Tell us what version of OpenZeppelin Contracts you're using, and how you're using it: Truffle, Remix, etc. -->
<!-- Tell us what version of OpenZeppelin you're using, and how you're using it: Truffle, Remix, etc. -->
**📝 Details**

View File

@ -1,4 +0,0 @@
contact_links:
- name: Questions & Support Requests
url: https://forum.openzeppelin.com/c/support/contracts/18
about: Ask in the OpenZeppelin Forum

View File

@ -1,6 +1,6 @@
---
name: Feature request
about: Suggest an idea for OpenZeppelin Contracts
about: Suggest an idea for OpenZeppelin
---
@ -10,5 +10,5 @@ about: Suggest an idea for OpenZeppelin Contracts
**📝 Details**
<!-- Please describe your feature request in detail. -->
<!-- Make sure that you have reviewed the OpenZeppelin Contracts Contributor Guidelines. -->
<!-- https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/CONTRIBUTING.md -->
<!-- Make sure that you have reviewed the OpenZeppelin Contributor Guidelines. -->
<!-- https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CONTRIBUTING.md -->

View File

@ -1,20 +1,22 @@
<!-- Thank you for your interest in contributing to OpenZeppelin! -->
<!-- 0. 🎉 Thank you for submitting a PR! -->
<!-- Consider opening an issue for discussion prior to submitting a PR. -->
<!-- New features will be merged faster if they were first discussed and designed with the team. -->
<!-- 1. Does this close any open issues? Please list them below. -->
Fixes #???? <!-- Fill in with issue number -->
<!-- Keep in mind that new features have a better chance of being merged fast if
they were first discussed and designed with the maintainers. If there is no
corresponding issue, please consider opening one for discussion first! -->
<!-- Describe the changes introduced in this pull request. -->
<!-- Include any context necessary for understanding the PR's purpose. -->
Fixes #
<!-- 2. Describe the changes introduced in this pull request. -->
<!-- Include any context necessary for understanding the PR's purpose. -->
#### PR Checklist
<!-- Before merging the pull request all of the following must be complete. -->
<!-- Feel free to submit a PR or Draft PR even if some items are pending. -->
<!-- Some of the items may not apply. -->
- [ ] Tests
- [ ] Documentation
- [ ] Changeset entry (run `npx changeset add`)
<!-- 3. Before submitting, please make sure that you have:
- reviewed the OpenZeppelin Contributor Guidelines
(https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CONTRIBUTING.md),
- added tests where applicable to test new functionality,
- made sure that your contracts are well-documented,
- run the Solidity linter (`npm run lint:sol`) and fixed any issues,
- run the JS linter and fixed any issues (`npm run lint:fix`), and
- updated the changelog, if applicable.
-->

View File

@ -1,49 +0,0 @@
name: Compare gas costs
inputs:
token:
description: github token
required: true
report:
description: report to read from
required: false
default: gasReporterOutput.json
out_report:
description: report to read
required: false
default: ${{ github.ref_name }}.gasreport.json
ref_report:
description: report to read from
required: false
default: ${{ github.base_ref }}.gasreport.json
runs:
using: composite
steps:
- name: Download reference report
if: github.event_name == 'pull_request'
run: |
RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'`
gh run download ${RUN_ID} --repo ${{ github.repository }} -n gasreport
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
continue-on-error: true
id: reference
- name: Compare reports
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
run: |
node scripts/checks/compareGasReports.js ${{ inputs.report }} ${{ inputs.ref_report }} >> $GITHUB_STEP_SUMMARY
env:
STYLE: markdown
shell: bash
- name: Rename report for upload
if: github.event_name != 'pull_request'
run: |
mv ${{ inputs.report }} ${{ inputs.out_report }}
shell: bash
- name: Save report
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: gasreport
path: ${{ inputs.out_report }}

View File

@ -1,21 +0,0 @@
name: Setup
runs:
using: composite
steps:
- uses: actions/setup-node@v3
with:
node-version: 16.x
- uses: actions/cache@v3
id: cache
with:
path: '**/node_modules'
key: npm-v3-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

View File

@ -1,55 +0,0 @@
name: Compare storage layouts
inputs:
token:
description: github token
required: true
buildinfo:
description: compilation artifacts
required: false
default: artifacts/build-info/*.json
layout:
description: extracted storage layout
required: false
default: HEAD.layout.json
out_layout:
description: storage layout to upload
required: false
default: ${{ github.ref_name }}.layout.json
ref_layout:
description: storage layout for the reference branch
required: false
default: ${{ github.base_ref }}.layout.json
runs:
using: composite
steps:
- name: Extract layout
run: |
node scripts/checks/extract-layout.js ${{ inputs.buildinfo }} > ${{ inputs.layout }}
shell: bash
- name: Download reference
if: github.event_name == 'pull_request'
run: |
RUN_ID=`gh run list --repo ${{ github.repository }} --branch ${{ github.base_ref }} --workflow ${{ github.workflow }} --limit 100 --json 'conclusion,databaseId,event' --jq 'map(select(.conclusion=="success" and .event!="pull_request"))[0].databaseId'`
gh run download ${RUN_ID} --repo ${{ github.repository }} -n layout
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
continue-on-error: true
id: reference
- name: Compare layouts
if: steps.reference.outcome == 'success' && github.event_name == 'pull_request'
run: |
node scripts/checks/compare-layout.js --head ${{ inputs.layout }} --ref ${{ inputs.ref_layout }}
shell: bash
- name: Rename artifacts for upload
if: github.event_name != 'pull_request'
run: |
mv ${{ inputs.layout }} ${{ inputs.out_layout }}
shell: bash
- name: Save artifacts
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: layout
path: ${{ inputs.out_layout }}

View File

@ -1,18 +0,0 @@
name: lint workflows
on:
pull_request:
paths:
- '.github/**/*.ya?ml'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add problem matchers
run: |
# https://github.com/rhysd/actionlint/blob/3a2f2c7/docs/usage.md#problem-matchers
curl -LO https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json
echo "::add-matcher::actionlint-matcher.json"
- uses: docker://rhysd/actionlint:latest

View File

@ -1,28 +0,0 @@
name: changeset
on:
pull_request:
branches:
- master
types:
- opened
- synchronize
- labeled
- unlabeled
concurrency:
group: changeset-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-changeset') }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Include history so Changesets finds merge-base
- name: Set up environment
uses: ./.github/actions/setup
- name: Check changeset
run: npx changeset status --since=origin/${{ github.base_ref }}

View File

@ -1,118 +0,0 @@
name: checks
on:
push:
branches:
- master
- next-v*
- release-v*
pull_request: {}
workflow_dispatch: {}
concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: true
env:
NODE_OPTIONS: --max_old_space_size=5120
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- run: npm run lint
tests:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
GAS: true
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests and generate gas report
run: npm run test
- name: Check linearisation of the inheritance graph
run: npm run test:inheritance
- name: Check proceduraly generated contracts are up-to-date
run: npm run test:generation
- name: Compare gas costs
uses: ./.github/actions/gas-compare
if: github.base_ref == 'master'
with:
token: ${{ github.token }}
tests-upgradeable:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Include history so patch conflicts are resolved automatically
- name: Set up environment
uses: ./.github/actions/setup
- name: Copy non-upgradeable contracts as dependency
run: |
mkdir -p lib/openzeppelin-contracts
cp -rnT contracts lib/openzeppelin-contracts/contracts
- name: Transpile to upgradeable
run: bash scripts/upgradeable/transpile.sh
- name: Run tests
run: npm run test
- name: Check linearisation of the inheritance graph
run: npm run test:inheritance
- name: Check storage layout
uses: ./.github/actions/storage-layout
if: github.base_ref == 'master'
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change') }}
with:
token: ${{ github.token }}
tests-foundry:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up environment
uses: ./.github/actions/setup
- name: Run tests
run: forge test -vv
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- run: npm run coverage
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
slither:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- run: rm foundry.toml
- uses: crytic/slither-action@v0.3.0
with:
node-version: 18.15
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run CodeSpell
uses: codespell-project/actions-codespell@v2.0
with:
check_hidden: true
check_filenames: true
skip: package-lock.json,*.pdf

View File

@ -1,19 +0,0 @@
name: Build Docs
on:
push:
branches: [release-v*]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- run: bash scripts/git-user-config.sh
- run: node scripts/update-docs-branch.js
- run: git push --all origin

View File

@ -1,68 +0,0 @@
name: formal verification
on:
pull_request:
types:
- opened
- reopened
- synchronize
- labeled
workflow_dispatch: {}
env:
PIP_VERSION: '3.10'
JAVA_VERSION: '11'
SOLC_VERSION: '0.8.20'
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
apply-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Apply patches
run: make -C certora apply
verify:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'formal-verification')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up environment
uses: ./.github/actions/setup
- name: identify specs that need to be run
id: arguments
run: |
if [[ ${{ github.event_name }} = 'pull_request' ]];
then
RESULT=$(git diff ${{ github.event.pull_request.head.sha }}..${{ github.event.pull_request.base.sha }} --name-only certora/specs/*.spec | while IFS= read -r file; do [[ -f $file ]] && basename "${file%.spec}"; done | tr "\n" " ")
else
RESULT='--all'
fi
echo "result=$RESULT" >> "$GITHUB_OUTPUT"
- name: Install python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PIP_VERSION }}
cache: 'pip'
- name: Install python packages
run: pip install -r requirements.txt
- name: Install java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v${{ env.SOLC_VERSION }}/solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc
chmod +x /usr/local/bin/solc
- name: Verify specification
run: |
make -C certora apply
node certora/run.js ${{ steps.arguments.outputs.result }} >> "$GITHUB_STEP_SUMMARY"
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}

View File

@ -1,214 +0,0 @@
# D: Manual Dispatch
# M: Merge release PR
# C: Commit
# ┌───────────┐ ┌─────────────┐ ┌────────────────┐
# │Development├──D──►RC-Unreleased│ ┌──►Final-Unreleased│
# └───────────┘ └─┬─────────▲─┘ │ └─┬────────────▲─┘
# │ │ │ │ │
# M C D M C
# │ │ │ │ │
# ┌▼─────────┴┐ │ ┌▼────────────┴┐
# │RC-Released├───┘ │Final-Released│
# └───────────┘ └──────────────┘
name: Release Cycle
on:
push:
branches:
- release-v*
workflow_dispatch: {}
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
state:
name: Check state
permissions:
pull-requests: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- id: state
name: Get state
uses: actions/github-script@v6
env:
TRIGGERING_ACTOR: ${{ github.triggering_actor }}
with:
result-encoding: string
script: await require('./scripts/release/workflow/state.js')({ github, context, core })
outputs:
# Job Flags
start: ${{ steps.state.outputs.start }}
changesets: ${{ steps.state.outputs.changesets }}
promote: ${{ steps.state.outputs.promote }}
publish: ${{ steps.state.outputs.publish }}
merge: ${{ steps.state.outputs.merge }}
# Global variables
is_prerelease: ${{ steps.state.outputs.is_prerelease }}
start:
needs: state
name: Start new release candidate
permissions:
contents: write
actions: write
if: needs.state.outputs.start == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- run: bash scripts/git-user-config.sh
- id: start
name: Create branch with release candidate
run: bash scripts/release/workflow/start.sh
- name: Re-run workflow
uses: actions/github-script@v6
env:
REF: ${{ steps.start.outputs.branch }}
with:
script: await require('./scripts/release/workflow/rerun.js')({ github, context })
promote:
needs: state
name: Promote to final release
permissions:
contents: write
actions: write
if: needs.state.outputs.promote == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- run: bash scripts/git-user-config.sh
- name: Exit prerelease state
if: needs.state.outputs.is_prerelease == 'true'
run: bash scripts/release/workflow/exit-prerelease.sh
- name: Re-run workflow
uses: actions/github-script@v6
with:
script: await require('./scripts/release/workflow/rerun.js')({ github, context })
changesets:
needs: state
name: Update PR to release
permissions:
contents: write
pull-requests: write
if: needs.state.outputs.changesets == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # To get all tags
- name: Set up environment
uses: ./.github/actions/setup
- name: Set release title
uses: actions/github-script@v6
with:
result-encoding: string
script: await require('./scripts/release/workflow/set-changesets-pr-title.js')({ core })
- name: Create PR
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
with:
version: npm run version
title: ${{ env.TITLE }}
commit: ${{ env.TITLE }}
body: | # Wait for support on this https://github.com/changesets/action/pull/250
This is an automated PR for releasing ${{ github.repository }}
Check [CHANGELOG.md](${{ github.repository }}/CHANGELOG.md)
publish:
needs: state
name: Publish to npm
environment: npm
permissions:
contents: write
if: needs.state.outputs.publish == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- id: pack
name: Pack
run: bash scripts/release/workflow/pack.sh
env:
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
- name: Upload tarball artifact
uses: actions/upload-artifact@v3
with:
name: ${{ github.ref_name }}
path: ${{ steps.pack.outputs.tarball }}
- name: Publish
run: bash scripts/release/workflow/publish.sh
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
TARBALL: ${{ steps.pack.outputs.tarball }}
TAG: ${{ steps.pack.outputs.tag }}
- name: Create Github Release
uses: actions/github-script@v6
env:
PRERELEASE: ${{ needs.state.outputs.is_prerelease }}
with:
script: await require('./scripts/release/workflow/github-release.js')({ github, context })
outputs:
tarball_name: ${{ steps.pack.outputs.tarball_name }}
integrity_check:
needs: publish
name: Tarball Integrity Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download tarball artifact
id: artifact
# Replace with actions/upload-artifact@v3 when
# https://github.com/actions/download-artifact/pull/194 gets released
uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b
with:
name: ${{ github.ref_name }}
- name: Check integrity
run: bash scripts/release/workflow/integrity-check.sh
env:
TARBALL: ${{ steps.artifact.outputs.download-path }}/${{ needs.publish.outputs.tarball_name }}
merge:
needs: state
name: Create PR back to master
permissions:
contents: write
pull-requests: write
if: needs.state.outputs.merge == 'true'
runs-on: ubuntu-latest
env:
MERGE_BRANCH: merge/${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # All branches
- name: Set up environment
uses: ./.github/actions/setup
- run: bash scripts/git-user-config.sh
- name: Create branch to merge
run: |
git checkout -B "$MERGE_BRANCH" "$GITHUB_REF_NAME"
git push -f origin "$MERGE_BRANCH"
- name: Create PR back to master
uses: actions/github-script@v6
with:
script: |
await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
head: process.env.MERGE_BRANCH,
base: 'master',
title: '${{ format('Merge {0} branch', github.ref_name) }}'
});

View File

@ -1,34 +0,0 @@
name: transpile upgradeable
on:
push:
branches:
- master
- release-v*
jobs:
transpile:
environment: push-upgradeable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: OpenZeppelin/openzeppelin-contracts-upgradeable
fetch-depth: 0
token: ${{ secrets.GH_TOKEN_UPGRADEABLE }}
- name: Fetch current non-upgradeable branch
run: |
git fetch "$REMOTE" master # Fetch default branch first for patch to apply cleanly
git fetch "$REMOTE" "$REF"
git checkout FETCH_HEAD
env:
REF: ${{ github.ref }}
REMOTE: https://github.com/${{ github.repository }}.git
- name: Set up environment
uses: ./.github/actions/setup
- run: bash scripts/git-user-config.sh
- name: Transpile to upgradeable
run: bash scripts/upgradeable/transpile-onto.sh ${{ github.ref_name }} origin/${{ github.ref_name }}
env:
SUBMODULE_REMOTE: https://github.com/${{ github.repository }}.git
- run: git push origin ${{ github.ref_name }}

32
.gitignore vendored
View File

@ -38,35 +38,7 @@ build/
# truffle
.node-xmlhttprequest-*
.openzeppelin/.session
# IntelliJ IDE
.idea
# docs artifacts
docs/modules/api
# only used to package @openzeppelin/contracts
contracts/build/
contracts/README.md
# temporary artifact from solidity-coverage
allFiredEvents
.coverage_artifacts
.coverage_cache
.coverage_contracts
# hardat-exposed
contracts-exposed
# Hardhat
/cache
/artifacts
# Foundry
/out
/cache_forge
# Certora
.certora*
.last_confs
certora_*
.zip-output-url.txt

7
.gitmodules vendored
View File

@ -1,7 +0,0 @@
[submodule "lib/forge-std"]
branch = v1
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/erc4626-tests"]
path = lib/erc4626-tests
url = https://github.com/a16z/erc4626-tests.git

View File

@ -1,4 +0,0 @@
module.exports = {
require: 'hardhat/register',
timeout: 4000,
};

945
.openzeppelin/kovan.json Normal file
View File

@ -0,0 +1,945 @@
{
"contracts": {
"TokenVesting": {
"address": "0x17d2e73611a9ec10ab4751c514a539ec820b953c",
"constructorCode": "608060405234801561001057600080fd5b50611c6c806100206000396000f3fe",
"bodyBytecodeHash": "ba0eade6a19e4b485aca3478c8755d2a6041a2b39a7aa1a0a73253a782c4a065",
"localBytecodeHash": "94b5eed89a6bab268326a5010e52000ff74d40d96c83811c9d455d7c8b54f447",
"deployedBytecodeHash": "94b5eed89a6bab268326a5010e52000ff74d40d96c83811c9d455d7c8b54f447",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "_owner",
"astId": 8198,
"type": "t_address",
"src": "472:22:108"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "______gap",
"astId": 8311,
"type": "t_array:50<t_uint256>",
"src": "2415:29:108"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_beneficiary",
"astId": 3576,
"type": "t_address",
"src": "1133:28:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_cliff",
"astId": 3578,
"type": "t_uint256",
"src": "1263:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_start",
"astId": 3580,
"type": "t_uint256",
"src": "1291:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_duration",
"astId": 3582,
"type": "t_uint256",
"src": "1319:25:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revocable",
"astId": 3584,
"type": "t_bool",
"src": "1351:23:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_released",
"astId": 3588,
"type": "t_mapping<t_uint256>",
"src": "1381:46:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revoked",
"astId": 3592,
"type": "t_mapping<t_bool>",
"src": "1433:42:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "______gap",
"astId": 3941,
"type": "t_array:50<t_uint256>",
"src": "6226:29:28"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [],
"storageDiff": []
}
},
"PaymentSplitter": {
"address": "0xf1e274980871d7c4aaab8d646c17728ed263e747",
"constructorCode": "608060405234801561001057600080fd5b506110a4806100206000396000f3fe",
"bodyBytecodeHash": "fe0f9da480efb9ef366284126f8d9dccff6f19f8ee0183449035b37c1f5103d8",
"localBytecodeHash": "d9901040952d3add936b2939fb694875bdfd7b513c877bc1942d36a5e4190873",
"deployedBytecodeHash": "d9901040952d3add936b2939fb694875bdfd7b513c877bc1942d36a5e4190873",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_array:dyn<t_address>": {
"id": "t_array:dyn<t_address>",
"valueType": "t_address",
"length": "dyn",
"kind": "array",
"label": "address[]"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalShares",
"astId": 8418,
"type": "t_uint256",
"src": "1176:28:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalReleased",
"astId": 8420,
"type": "t_uint256",
"src": "1210:30:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_shares",
"astId": 8424,
"type": "t_mapping<t_uint256>",
"src": "1247:43:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_released",
"astId": 8428,
"type": "t_mapping<t_uint256>",
"src": "1296:45:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_payees",
"astId": 8431,
"type": "t_array:dyn<t_address>",
"src": "1347:25:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "______gap",
"astId": 8684,
"type": "t_array:50<t_uint256>",
"src": "5158:29:110"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [],
"storageDiff": []
}
},
"StandaloneERC20": {
"address": "0x2a79d89665d22ee56cc0efd102169fa41f27b065",
"constructorCode": "608060405234801561001057600080fd5b50613153806100206000396000f3fe",
"bodyBytecodeHash": "ad8d45945d6a4f088a61fd605c38cdf2f40171624bca2a7c3b2d4e95b068eb3d",
"localBytecodeHash": "bca15bc1a7aa87c603c9b185aab38e0d72b8adc6347426bb66954cef39e88a74",
"deployedBytecodeHash": "bca15bc1a7aa87c603c9b185aab38e0d72b8adc6347426bb66954cef39e88a74",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_uint8": {
"id": "t_uint8",
"kind": "elementary",
"label": "uint8"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_name",
"astId": 9641,
"type": "t_string",
"src": "209:20:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_symbol",
"astId": 9643,
"type": "t_string",
"src": "235:22:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_decimals",
"astId": 9645,
"type": "t_uint8",
"src": "263:23:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "______gap",
"astId": 9697,
"type": "t_array:50<t_uint256>",
"src": "1645:29:118"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_balances",
"astId": 9129,
"type": "t_mapping<t_uint256>",
"src": "1357:46:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowances",
"astId": 9135,
"type": "t_mapping<t_uint256>",
"src": "1410:69:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_totalSupply",
"astId": 9137,
"type": "t_uint256",
"src": "1486:28:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "______gap",
"astId": 9516,
"type": "t_array:50<t_uint256>",
"src": "7875:29:115"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 319,
"type": "t_array:50<t_uint256>",
"src": "1133:29:2"
},
{
"contract": "ERC20Mintable",
"path": "contracts/token/ERC20/ERC20Mintable.sol",
"label": "______gap",
"astId": 9746,
"type": "t_array:50<t_uint256>",
"src": "816:29:119"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 439,
"type": "t_array:50<t_uint256>",
"src": "1133:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4481,
"type": "t_bool",
"src": "855:20:37"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4564,
"type": "t_array:50<t_uint256>",
"src": "2105:29:37"
},
{
"contract": "ERC20Pausable",
"path": "contracts/token/ERC20/ERC20Pausable.sol",
"label": "______gap",
"astId": 9869,
"type": "t_array:50<t_uint256>",
"src": "1178:29:120"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
}
],
"storageDiff": [
{
"action": "rename",
"updated": {
"index": 8,
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowances",
"astId": 9135,
"type": "t_mapping<t_uint256>",
"src": "1410:69:115"
},
"original": {
"index": 8,
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowed",
"astId": 8173,
"type": "t_mapping<t_uint256>",
"src": "827:66:110"
}
}
]
}
},
"StandaloneERC721": {
"address": "0x61e5b805911ba82de487e13de1e375a6130004f0",
"constructorCode": "608060405234801561001057600080fd5b50614299806100206000396000f3fe",
"bodyBytecodeHash": "9113153cb4b2b62f720cb12960ba3b4a7b9a5f3329e34a4a3ece0212d130ae53",
"localBytecodeHash": "5dca693db1fee9a4ce973e49d6665a8770b823c36ba2c7e64f37d81046672074",
"deployedBytecodeHash": "5dca693db1fee9a4ce973e49d6665a8770b823c36ba2c7e64f37d81046672074",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_address>": {
"id": "t_mapping<t_address>",
"valueType": "t_address",
"label": "mapping(key => address)",
"kind": "mapping"
},
"t_struct<Counters.Counter>": {
"id": "t_struct<Counters.Counter>",
"kind": "struct",
"label": "Counters.Counter",
"members": [
{
"label": "_value",
"astId": 2533,
"type": "t_uint256",
"src": "1022:14:22"
}
]
},
"t_mapping<t_struct<Counters.Counter>>": {
"id": "t_mapping<t_struct<Counters.Counter>>",
"valueType": "t_struct<Counters.Counter>",
"label": "mapping(key => Counters.Counter)",
"kind": "mapping"
},
"t_array:dyn<t_uint256>": {
"id": "t_array:dyn<t_uint256>",
"valueType": "t_uint256",
"length": "dyn",
"kind": "array",
"label": "uint256[]"
},
"t_mapping<t_array:dyn<t_uint256>>": {
"id": "t_mapping<t_array:dyn<t_uint256>>",
"valueType": "t_array:dyn<t_uint256>",
"label": "mapping(key => uint256[])",
"kind": "mapping"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_mapping<t_string>": {
"id": "t_mapping<t_string>",
"valueType": "t_string",
"label": "mapping(key => string)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "_supportedInterfaces",
"astId": 4117,
"type": "t_mapping<t_bool>",
"src": "550:52:31"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "______gap",
"astId": 4162,
"type": "t_array:50<t_uint256>",
"src": "1714:29:31"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenOwner",
"astId": 10508,
"type": "t_mapping<t_address>",
"src": "829:48:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenApprovals",
"astId": 10512,
"type": "t_mapping<t_address>",
"src": "933:52:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10516,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_operatorApprovals",
"astId": 10522,
"type": "t_mapping<t_bool>",
"src": "1161:73:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "______gap",
"astId": 11065,
"type": "t_array:50<t_uint256>",
"src": "12696:29:125"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokens",
"astId": 11117,
"type": "t_mapping<t_array:dyn<t_uint256>>",
"src": "445:50:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokensIndex",
"astId": 11121,
"type": "t_mapping<t_uint256>",
"src": "565:53:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokens",
"astId": 11124,
"type": "t_array:dyn<t_uint256>",
"src": "679:28:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokensIndex",
"astId": 11128,
"type": "t_mapping<t_uint256>",
"src": "778:51:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "______gap",
"astId": 11459,
"type": "t_array:50<t_uint256>",
"src": "8994:29:127"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_name",
"astId": 11526,
"type": "t_string",
"src": "266:20:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_symbol",
"astId": 11528,
"type": "t_string",
"src": "313:22:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_tokenURIs",
"astId": 11532,
"type": "t_mapping<t_string>",
"src": "381:45:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "______gap",
"astId": 11663,
"type": "t_array:50<t_uint256>",
"src": "3029:29:130"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 319,
"type": "t_array:50<t_uint256>",
"src": "1133:29:2"
},
{
"contract": "ERC721MetadataMintable",
"path": "contracts/token/ERC721/ERC721MetadataMintable.sol",
"label": "______gap",
"astId": 11733,
"type": "t_array:50<t_uint256>",
"src": "1042:29:131"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 439,
"type": "t_array:50<t_uint256>",
"src": "1133:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4481,
"type": "t_bool",
"src": "855:20:37"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4564,
"type": "t_array:50<t_uint256>",
"src": "2105:29:37"
},
{
"contract": "ERC721Pausable",
"path": "contracts/token/ERC721/ERC721Pausable.sol",
"label": "______gap",
"astId": 11878,
"type": "t_array:50<t_uint256>",
"src": "850:29:133"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10516,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:125"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
}
],
"storageDiff": [
{
"action": "typechange",
"updated": {
"index": 7,
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10516,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:125"
},
"original": {
"index": 7,
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 9505,
"type": "t_mapping<t_uint256>",
"src": "988:54:120"
}
}
]
}
}
},
"solidityLibs": {},
"proxies": {},
"manifestVersion": "2.2",
"frozen": true,
"app": {
"address": "0xf5829d56998ccc1405b7eabccac78164af270d39"
},
"package": {
"address": "0xb6f8f11b166d526932ee04ffe4d25b810f619e34"
},
"provider": {
"address": "0x200194fd3013c88ab2b3c84e2c885aba42a3df5d"
},
"version": "2.2.0"
}

851
.openzeppelin/mainnet.json Normal file
View File

@ -0,0 +1,851 @@
{
"contracts": {
"StandaloneERC721": {
"address": "0x8c9900276e5eD54C104d743a6E01B7041acab40f",
"constructorCode": "608060405234801561001057600080fd5b506136c6806100206000396000f3fe",
"bodyBytecodeHash": "1f3ce589a0ba1fad4f98754bd97f051852e7dbb5522d49a7185defb3e377d347",
"localBytecodeHash": "84a5a6731b4686c34ef5acfcf4474af2e61b3e4e0b10ea96418e4b7bd1074cbc",
"deployedBytecodeHash": "84a5a6731b4686c34ef5acfcf4474af2e61b3e4e0b10ea96418e4b7bd1074cbc",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_address>": {
"id": "t_mapping<t_address>",
"valueType": "t_address",
"label": "mapping(key => address)",
"kind": "mapping"
},
"t_struct<Counters.Counter>": {
"id": "t_struct<Counters.Counter>",
"kind": "struct",
"label": "Counters.Counter",
"members": [
{
"label": "_value",
"astId": 2415,
"type": "t_uint256",
"src": "1021:14:22"
}
]
},
"t_mapping<t_struct<Counters.Counter>>": {
"id": "t_mapping<t_struct<Counters.Counter>>",
"valueType": "t_struct<Counters.Counter>",
"label": "mapping(key => Counters.Counter)",
"kind": "mapping"
},
"t_array:dyn<t_uint256>": {
"id": "t_array:dyn<t_uint256>",
"valueType": "t_uint256",
"length": "dyn",
"kind": "array",
"label": "uint256[]"
},
"t_mapping<t_array:dyn<t_uint256>>": {
"id": "t_mapping<t_array:dyn<t_uint256>>",
"valueType": "t_array:dyn<t_uint256>",
"label": "mapping(key => uint256[])",
"kind": "mapping"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_mapping<t_string>": {
"id": "t_mapping<t_string>",
"valueType": "t_string",
"label": "mapping(key => string)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 11836,
"type": "t_bool",
"src": "757:24:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 11838,
"type": "t_bool",
"src": "876:25:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 11887,
"type": "t_array:50<t_uint256>",
"src": "1891:29:140"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "_supportedInterfaces",
"astId": 3974,
"type": "t_mapping<t_bool>",
"src": "496:52:31"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "______gap",
"astId": 4018,
"type": "t_array:50<t_uint256>",
"src": "1229:29:31"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenOwner",
"astId": 10031,
"type": "t_mapping<t_address>",
"src": "829:48:122"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenApprovals",
"astId": 10035,
"type": "t_mapping<t_address>",
"src": "933:52:122"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10039,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:122"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_operatorApprovals",
"astId": 10045,
"type": "t_mapping<t_bool>",
"src": "1161:73:122"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "______gap",
"astId": 10568,
"type": "t_array:50<t_uint256>",
"src": "11658:29:122"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokens",
"astId": 10619,
"type": "t_mapping<t_array:dyn<t_uint256>>",
"src": "445:50:124"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokensIndex",
"astId": 10623,
"type": "t_mapping<t_uint256>",
"src": "565:53:124"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokens",
"astId": 10626,
"type": "t_array:dyn<t_uint256>",
"src": "679:28:124"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokensIndex",
"astId": 10630,
"type": "t_mapping<t_uint256>",
"src": "778:51:124"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "______gap",
"astId": 10959,
"type": "t_array:50<t_uint256>",
"src": "8801:29:124"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_name",
"astId": 11026,
"type": "t_string",
"src": "266:20:127"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_symbol",
"astId": 11028,
"type": "t_string",
"src": "313:22:127"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_tokenURIs",
"astId": 11032,
"type": "t_mapping<t_string>",
"src": "381:45:127"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "______gap",
"astId": 11161,
"type": "t_array:50<t_uint256>",
"src": "2834:29:127"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 231,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 330,
"type": "t_array:50<t_uint256>",
"src": "1081:29:2"
},
{
"contract": "ERC721MetadataMintable",
"path": "contracts/token/ERC721/ERC721MetadataMintable.sol",
"label": "______gap",
"astId": 11231,
"type": "t_array:50<t_uint256>",
"src": "1040:29:128"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 350,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 449,
"type": "t_array:50<t_uint256>",
"src": "1081:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4184,
"type": "t_bool",
"src": "352:20:34"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4265,
"type": "t_array:50<t_uint256>",
"src": "1429:29:34"
},
{
"contract": "ERC721Pausable",
"path": "contracts/token/ERC721/ERC721Pausable.sol",
"label": "______gap",
"astId": 11376,
"type": "t_array:50<t_uint256>",
"src": "850:29:130"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
},
"StandaloneERC20": {
"address": "0xe95Ca7dE499b425FBbdFD08C4021448FAB91cB0D",
"constructorCode": "608060405234801561001057600080fd5b50612904806100206000396000f3fe",
"bodyBytecodeHash": "68b813a3c2b5407b02238fdd29abedd7efa8d2e88e3aecea30ca59ad3cafa465",
"localBytecodeHash": "ffcdfe04a4bf5020bb4661355d65a2d6da2938f1070399f417f8fc8d301ea692",
"deployedBytecodeHash": "ffcdfe04a4bf5020bb4661355d65a2d6da2938f1070399f417f8fc8d301ea692",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_uint8": {
"id": "t_uint8",
"kind": "elementary",
"label": "uint8"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 11836,
"type": "t_bool",
"src": "757:24:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 11838,
"type": "t_bool",
"src": "876:25:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 11887,
"type": "t_array:50<t_uint256>",
"src": "1891:29:140"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_name",
"astId": 9171,
"type": "t_string",
"src": "382:20:115"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_symbol",
"astId": 9173,
"type": "t_string",
"src": "408:22:115"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_decimals",
"astId": 9175,
"type": "t_uint8",
"src": "436:23:115"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "______gap",
"astId": 9227,
"type": "t_array:50<t_uint256>",
"src": "1097:29:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_balances",
"astId": 8675,
"type": "t_mapping<t_uint256>",
"src": "752:46:112"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowed",
"astId": 8681,
"type": "t_mapping<t_uint256>",
"src": "805:66:112"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_totalSupply",
"astId": 8683,
"type": "t_uint256",
"src": "878:28:112"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "______gap",
"astId": 9048,
"type": "t_array:50<t_uint256>",
"src": "7714:29:112"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 231,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 330,
"type": "t_array:50<t_uint256>",
"src": "1081:29:2"
},
{
"contract": "ERC20Mintable",
"path": "contracts/token/ERC20/ERC20Mintable.sol",
"label": "______gap",
"astId": 9276,
"type": "t_array:50<t_uint256>",
"src": "745:29:116"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 350,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 449,
"type": "t_array:50<t_uint256>",
"src": "1081:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4184,
"type": "t_bool",
"src": "352:20:34"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4265,
"type": "t_array:50<t_uint256>",
"src": "1429:29:34"
},
{
"contract": "ERC20Pausable",
"path": "contracts/token/ERC20/ERC20Pausable.sol",
"label": "______gap",
"astId": 9399,
"type": "t_array:50<t_uint256>",
"src": "1194:29:117"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
},
"PaymentSplitter": {
"address": "0xb3E46068440Ebd9AD43A3347eDFfC63697B84544",
"constructorCode": "608060405234801561001057600080fd5b50610c17806100206000396000f3fe",
"bodyBytecodeHash": "34c5c6011ba90548e55bf061f25c0847894d8882e4fa691726bf5d70bfadfd70",
"localBytecodeHash": "d2ee04ff44581e396d308fb7e8f6ff66680f1eda86ee165873c4c16a65b4269d",
"deployedBytecodeHash": "d2ee04ff44581e396d308fb7e8f6ff66680f1eda86ee165873c4c16a65b4269d",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_array:dyn<t_address>": {
"id": "t_array:dyn<t_address>",
"valueType": "t_address",
"length": "dyn",
"kind": "array",
"label": "address[]"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 11836,
"type": "t_bool",
"src": "757:24:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 11838,
"type": "t_bool",
"src": "876:25:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 11887,
"type": "t_array:50<t_uint256>",
"src": "1891:29:140"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalShares",
"astId": 7977,
"type": "t_uint256",
"src": "540:28:107"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalReleased",
"astId": 7979,
"type": "t_uint256",
"src": "574:30:107"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_shares",
"astId": 7983,
"type": "t_mapping<t_uint256>",
"src": "611:43:107"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_released",
"astId": 7987,
"type": "t_mapping<t_uint256>",
"src": "660:45:107"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_payees",
"astId": 7990,
"type": "t_array:dyn<t_address>",
"src": "711:25:107"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "______gap",
"astId": 8236,
"type": "t_array:50<t_uint256>",
"src": "3236:29:107"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
},
"TokenVesting": {
"address": "0xF0fcf1a5aaf25CDe77cb6ef95717323FAEfE492d",
"constructorCode": "608060405234801561001057600080fd5b50611559806100206000396000f3fe",
"bodyBytecodeHash": "01f22f428367f86242e342322247e732d645b5cfdd40a9411cb3a10842ee2bac",
"localBytecodeHash": "f5eb9bf4cd80d75f1e0928674f0436601837641bdbc0196a89f8ea392097a282",
"deployedBytecodeHash": "f5eb9bf4cd80d75f1e0928674f0436601837641bdbc0196a89f8ea392097a282",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 11836,
"type": "t_bool",
"src": "757:24:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 11838,
"type": "t_bool",
"src": "876:25:140"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 11887,
"type": "t_array:50<t_uint256>",
"src": "1891:29:140"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "_owner",
"astId": 7761,
"type": "t_address",
"src": "302:22:105"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "______gap",
"astId": 7872,
"type": "t_array:50<t_uint256>",
"src": "2262:29:105"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_beneficiary",
"astId": 3441,
"type": "t_address",
"src": "1133:28:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_cliff",
"astId": 3443,
"type": "t_uint256",
"src": "1263:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_start",
"astId": 3445,
"type": "t_uint256",
"src": "1291:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_duration",
"astId": 3447,
"type": "t_uint256",
"src": "1319:25:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revocable",
"astId": 3449,
"type": "t_bool",
"src": "1351:23:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_released",
"astId": 3453,
"type": "t_mapping<t_uint256>",
"src": "1381:46:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revoked",
"astId": 3457,
"type": "t_mapping<t_bool>",
"src": "1433:42:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "______gap",
"astId": 3799,
"type": "t_array:50<t_uint256>",
"src": "5837:29:28"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
}
},
"solidityLibs": {},
"proxies": {},
"manifestVersion": "2.2",
"frozen": true,
"app": {
"address": "0x2Ba1a8C7352a5B5Ea3ea3408F89e1bA7920d36CE"
},
"package": {
"address": "0x778dddF23Ec1B5Cb18394c6C110480CaaDB3B0f6"
},
"provider": {
"address": "0xdd3e0B83e5462FD4Ba012FF05A57f709FA050458"
},
"version": "2.2.0"
}

View File

@ -0,0 +1,12 @@
{
"manifestVersion": "2.2",
"name": "@openzeppelin/contracts-ethereum-package",
"publish": true,
"version": "2.2.0",
"contracts": {
"StandaloneERC20": "StandaloneERC20",
"StandaloneERC721": "StandaloneERC721",
"TokenVesting": "TokenVesting",
"PaymentSplitter": "PaymentSplitter"
}
}

945
.openzeppelin/rinkeby.json Normal file
View File

@ -0,0 +1,945 @@
{
"contracts": {
"PaymentSplitter": {
"address": "0x29d58ac2407f62caf9b1e00f0d7088d8c8590703",
"constructorCode": "608060405234801561001057600080fd5b506110a4806100206000396000f3fe",
"bodyBytecodeHash": "fe0f9da480efb9ef366284126f8d9dccff6f19f8ee0183449035b37c1f5103d8",
"localBytecodeHash": "d9901040952d3add936b2939fb694875bdfd7b513c877bc1942d36a5e4190873",
"deployedBytecodeHash": "d9901040952d3add936b2939fb694875bdfd7b513c877bc1942d36a5e4190873",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_array:dyn<t_address>": {
"id": "t_array:dyn<t_address>",
"valueType": "t_address",
"length": "dyn",
"kind": "array",
"label": "address[]"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalShares",
"astId": 8418,
"type": "t_uint256",
"src": "1176:28:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalReleased",
"astId": 8420,
"type": "t_uint256",
"src": "1210:30:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_shares",
"astId": 8424,
"type": "t_mapping<t_uint256>",
"src": "1247:43:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_released",
"astId": 8428,
"type": "t_mapping<t_uint256>",
"src": "1296:45:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_payees",
"astId": 8431,
"type": "t_array:dyn<t_address>",
"src": "1347:25:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "______gap",
"astId": 8684,
"type": "t_array:50<t_uint256>",
"src": "5158:29:110"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [],
"storageDiff": []
}
},
"TokenVesting": {
"address": "0x142e4ad09777e6f3068e630a085a4739614d1e76",
"constructorCode": "608060405234801561001057600080fd5b50611c6c806100206000396000f3fe",
"bodyBytecodeHash": "ba0eade6a19e4b485aca3478c8755d2a6041a2b39a7aa1a0a73253a782c4a065",
"localBytecodeHash": "94b5eed89a6bab268326a5010e52000ff74d40d96c83811c9d455d7c8b54f447",
"deployedBytecodeHash": "94b5eed89a6bab268326a5010e52000ff74d40d96c83811c9d455d7c8b54f447",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "_owner",
"astId": 8198,
"type": "t_address",
"src": "472:22:108"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "______gap",
"astId": 8311,
"type": "t_array:50<t_uint256>",
"src": "2415:29:108"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_beneficiary",
"astId": 3576,
"type": "t_address",
"src": "1133:28:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_cliff",
"astId": 3578,
"type": "t_uint256",
"src": "1263:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_start",
"astId": 3580,
"type": "t_uint256",
"src": "1291:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_duration",
"astId": 3582,
"type": "t_uint256",
"src": "1319:25:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revocable",
"astId": 3584,
"type": "t_bool",
"src": "1351:23:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_released",
"astId": 3588,
"type": "t_mapping<t_uint256>",
"src": "1381:46:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revoked",
"astId": 3592,
"type": "t_mapping<t_bool>",
"src": "1433:42:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "______gap",
"astId": 3941,
"type": "t_array:50<t_uint256>",
"src": "6226:29:28"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [],
"storageDiff": []
}
},
"StandaloneERC20": {
"address": "0xa17887b5aacc4d3b04ae375178d8e0971d84434a",
"constructorCode": "608060405234801561001057600080fd5b50613153806100206000396000f3fe",
"bodyBytecodeHash": "ad8d45945d6a4f088a61fd605c38cdf2f40171624bca2a7c3b2d4e95b068eb3d",
"localBytecodeHash": "bca15bc1a7aa87c603c9b185aab38e0d72b8adc6347426bb66954cef39e88a74",
"deployedBytecodeHash": "bca15bc1a7aa87c603c9b185aab38e0d72b8adc6347426bb66954cef39e88a74",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_uint8": {
"id": "t_uint8",
"kind": "elementary",
"label": "uint8"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_name",
"astId": 9641,
"type": "t_string",
"src": "209:20:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_symbol",
"astId": 9643,
"type": "t_string",
"src": "235:22:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_decimals",
"astId": 9645,
"type": "t_uint8",
"src": "263:23:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "______gap",
"astId": 9697,
"type": "t_array:50<t_uint256>",
"src": "1645:29:118"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_balances",
"astId": 9129,
"type": "t_mapping<t_uint256>",
"src": "1357:46:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowances",
"astId": 9135,
"type": "t_mapping<t_uint256>",
"src": "1410:69:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_totalSupply",
"astId": 9137,
"type": "t_uint256",
"src": "1486:28:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "______gap",
"astId": 9516,
"type": "t_array:50<t_uint256>",
"src": "7875:29:115"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 319,
"type": "t_array:50<t_uint256>",
"src": "1133:29:2"
},
{
"contract": "ERC20Mintable",
"path": "contracts/token/ERC20/ERC20Mintable.sol",
"label": "______gap",
"astId": 9746,
"type": "t_array:50<t_uint256>",
"src": "816:29:119"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 439,
"type": "t_array:50<t_uint256>",
"src": "1133:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4481,
"type": "t_bool",
"src": "855:20:37"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4564,
"type": "t_array:50<t_uint256>",
"src": "2105:29:37"
},
{
"contract": "ERC20Pausable",
"path": "contracts/token/ERC20/ERC20Pausable.sol",
"label": "______gap",
"astId": 9869,
"type": "t_array:50<t_uint256>",
"src": "1178:29:120"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
}
],
"storageDiff": [
{
"action": "rename",
"updated": {
"index": 8,
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowances",
"astId": 9135,
"type": "t_mapping<t_uint256>",
"src": "1410:69:115"
},
"original": {
"index": 8,
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowed",
"astId": 8173,
"type": "t_mapping<t_uint256>",
"src": "827:66:110"
}
}
]
}
},
"StandaloneERC721": {
"address": "0x27787a3b782897021eaffb8f1d52e71d74cea0b0",
"constructorCode": "608060405234801561001057600080fd5b50614299806100206000396000f3fe",
"bodyBytecodeHash": "9113153cb4b2b62f720cb12960ba3b4a7b9a5f3329e34a4a3ece0212d130ae53",
"localBytecodeHash": "5dca693db1fee9a4ce973e49d6665a8770b823c36ba2c7e64f37d81046672074",
"deployedBytecodeHash": "5dca693db1fee9a4ce973e49d6665a8770b823c36ba2c7e64f37d81046672074",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_address>": {
"id": "t_mapping<t_address>",
"valueType": "t_address",
"label": "mapping(key => address)",
"kind": "mapping"
},
"t_struct<Counters.Counter>": {
"id": "t_struct<Counters.Counter>",
"kind": "struct",
"label": "Counters.Counter",
"members": [
{
"label": "_value",
"astId": 2533,
"type": "t_uint256",
"src": "1022:14:22"
}
]
},
"t_mapping<t_struct<Counters.Counter>>": {
"id": "t_mapping<t_struct<Counters.Counter>>",
"valueType": "t_struct<Counters.Counter>",
"label": "mapping(key => Counters.Counter)",
"kind": "mapping"
},
"t_array:dyn<t_uint256>": {
"id": "t_array:dyn<t_uint256>",
"valueType": "t_uint256",
"length": "dyn",
"kind": "array",
"label": "uint256[]"
},
"t_mapping<t_array:dyn<t_uint256>>": {
"id": "t_mapping<t_array:dyn<t_uint256>>",
"valueType": "t_array:dyn<t_uint256>",
"label": "mapping(key => uint256[])",
"kind": "mapping"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_mapping<t_string>": {
"id": "t_mapping<t_string>",
"valueType": "t_string",
"label": "mapping(key => string)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "_supportedInterfaces",
"astId": 4117,
"type": "t_mapping<t_bool>",
"src": "550:52:31"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "______gap",
"astId": 4162,
"type": "t_array:50<t_uint256>",
"src": "1714:29:31"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenOwner",
"astId": 10508,
"type": "t_mapping<t_address>",
"src": "829:48:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenApprovals",
"astId": 10512,
"type": "t_mapping<t_address>",
"src": "933:52:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10516,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_operatorApprovals",
"astId": 10522,
"type": "t_mapping<t_bool>",
"src": "1161:73:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "______gap",
"astId": 11065,
"type": "t_array:50<t_uint256>",
"src": "12696:29:125"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokens",
"astId": 11117,
"type": "t_mapping<t_array:dyn<t_uint256>>",
"src": "445:50:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokensIndex",
"astId": 11121,
"type": "t_mapping<t_uint256>",
"src": "565:53:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokens",
"astId": 11124,
"type": "t_array:dyn<t_uint256>",
"src": "679:28:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokensIndex",
"astId": 11128,
"type": "t_mapping<t_uint256>",
"src": "778:51:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "______gap",
"astId": 11459,
"type": "t_array:50<t_uint256>",
"src": "8994:29:127"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_name",
"astId": 11526,
"type": "t_string",
"src": "266:20:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_symbol",
"astId": 11528,
"type": "t_string",
"src": "313:22:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_tokenURIs",
"astId": 11532,
"type": "t_mapping<t_string>",
"src": "381:45:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "______gap",
"astId": 11663,
"type": "t_array:50<t_uint256>",
"src": "3029:29:130"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 319,
"type": "t_array:50<t_uint256>",
"src": "1133:29:2"
},
{
"contract": "ERC721MetadataMintable",
"path": "contracts/token/ERC721/ERC721MetadataMintable.sol",
"label": "______gap",
"astId": 11733,
"type": "t_array:50<t_uint256>",
"src": "1042:29:131"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 439,
"type": "t_array:50<t_uint256>",
"src": "1133:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4481,
"type": "t_bool",
"src": "855:20:37"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4564,
"type": "t_array:50<t_uint256>",
"src": "2105:29:37"
},
{
"contract": "ERC721Pausable",
"path": "contracts/token/ERC721/ERC721Pausable.sol",
"label": "______gap",
"astId": 11878,
"type": "t_array:50<t_uint256>",
"src": "850:29:133"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": [],
"storageUncheckedVars": [
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10516,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:125"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
}
],
"storageDiff": [
{
"action": "typechange",
"updated": {
"index": 7,
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10516,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:125"
},
"original": {
"index": 7,
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 9505,
"type": "t_mapping<t_uint256>",
"src": "988:54:120"
}
}
]
}
}
},
"solidityLibs": {},
"proxies": {},
"manifestVersion": "2.2",
"frozen": true,
"app": {
"address": "0x291439e6444daec9e47ae359aa79fd1811a42679"
},
"package": {
"address": "0xa44bb80b290de8a465d17b14269df53cf0b9bf4f"
},
"provider": {
"address": "0x20b96704e5cab368fc05d8729b9d2c4c830f9338"
},
"version": "2.2.0"
}

851
.openzeppelin/ropsten.json Normal file
View File

@ -0,0 +1,851 @@
{
"contracts": {
"TokenVesting": {
"address": "0x37b52342e1e8eca924c69e49797e8b1a80251a88",
"constructorCode": "608060405234801561001057600080fd5b50611c6c806100206000396000f3fe",
"bodyBytecodeHash": "ba0eade6a19e4b485aca3478c8755d2a6041a2b39a7aa1a0a73253a782c4a065",
"localBytecodeHash": "94b5eed89a6bab268326a5010e52000ff74d40d96c83811c9d455d7c8b54f447",
"deployedBytecodeHash": "94b5eed89a6bab268326a5010e52000ff74d40d96c83811c9d455d7c8b54f447",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "_owner",
"astId": 8198,
"type": "t_address",
"src": "472:22:108"
},
{
"contract": "Ownable",
"path": "contracts/ownership/Ownable.sol",
"label": "______gap",
"astId": 8311,
"type": "t_array:50<t_uint256>",
"src": "2415:29:108"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_beneficiary",
"astId": 3576,
"type": "t_address",
"src": "1133:28:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_cliff",
"astId": 3578,
"type": "t_uint256",
"src": "1263:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_start",
"astId": 3580,
"type": "t_uint256",
"src": "1291:22:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_duration",
"astId": 3582,
"type": "t_uint256",
"src": "1319:25:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revocable",
"astId": 3584,
"type": "t_bool",
"src": "1351:23:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_released",
"astId": 3588,
"type": "t_mapping<t_uint256>",
"src": "1381:46:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "_revoked",
"astId": 3592,
"type": "t_mapping<t_bool>",
"src": "1433:42:28"
},
{
"contract": "TokenVesting",
"path": "contracts/drafts/TokenVesting.sol",
"label": "______gap",
"astId": 3941,
"type": "t_array:50<t_uint256>",
"src": "6226:29:28"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
},
"PaymentSplitter": {
"address": "0xee1ff7edb4d1dee795497dc715a8173c9ddda440",
"constructorCode": "608060405234801561001057600080fd5b506110a4806100206000396000f3fe",
"bodyBytecodeHash": "fe0f9da480efb9ef366284126f8d9dccff6f19f8ee0183449035b37c1f5103d8",
"localBytecodeHash": "d9901040952d3add936b2939fb694875bdfd7b513c877bc1942d36a5e4190873",
"deployedBytecodeHash": "d9901040952d3add936b2939fb694875bdfd7b513c877bc1942d36a5e4190873",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_array:dyn<t_address>": {
"id": "t_array:dyn<t_address>",
"valueType": "t_address",
"length": "dyn",
"kind": "array",
"label": "address[]"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalShares",
"astId": 8418,
"type": "t_uint256",
"src": "1176:28:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_totalReleased",
"astId": 8420,
"type": "t_uint256",
"src": "1210:30:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_shares",
"astId": 8424,
"type": "t_mapping<t_uint256>",
"src": "1247:43:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_released",
"astId": 8428,
"type": "t_mapping<t_uint256>",
"src": "1296:45:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "_payees",
"astId": 8431,
"type": "t_array:dyn<t_address>",
"src": "1347:25:110"
},
{
"contract": "PaymentSplitter",
"path": "contracts/payment/PaymentSplitter.sol",
"label": "______gap",
"astId": 8684,
"type": "t_array:50<t_uint256>",
"src": "5158:29:110"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
},
"StandaloneERC20": {
"address": "0x2ed7f08736297d10dfa04a9b272dffc03615644f",
"constructorCode": "608060405234801561001057600080fd5b50613153806100206000396000f3fe",
"bodyBytecodeHash": "ad8d45945d6a4f088a61fd605c38cdf2f40171624bca2a7c3b2d4e95b068eb3d",
"localBytecodeHash": "bca15bc1a7aa87c603c9b185aab38e0d72b8adc6347426bb66954cef39e88a74",
"deployedBytecodeHash": "bca15bc1a7aa87c603c9b185aab38e0d72b8adc6347426bb66954cef39e88a74",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_uint8": {
"id": "t_uint8",
"kind": "elementary",
"label": "uint8"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_name",
"astId": 9641,
"type": "t_string",
"src": "209:20:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_symbol",
"astId": 9643,
"type": "t_string",
"src": "235:22:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "_decimals",
"astId": 9645,
"type": "t_uint8",
"src": "263:23:118"
},
{
"contract": "ERC20Detailed",
"path": "contracts/token/ERC20/ERC20Detailed.sol",
"label": "______gap",
"astId": 9697,
"type": "t_array:50<t_uint256>",
"src": "1645:29:118"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_balances",
"astId": 9129,
"type": "t_mapping<t_uint256>",
"src": "1357:46:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_allowances",
"astId": 9135,
"type": "t_mapping<t_uint256>",
"src": "1410:69:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "_totalSupply",
"astId": 9137,
"type": "t_uint256",
"src": "1486:28:115"
},
{
"contract": "ERC20",
"path": "contracts/token/ERC20/ERC20.sol",
"label": "______gap",
"astId": 9516,
"type": "t_array:50<t_uint256>",
"src": "7875:29:115"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 319,
"type": "t_array:50<t_uint256>",
"src": "1133:29:2"
},
{
"contract": "ERC20Mintable",
"path": "contracts/token/ERC20/ERC20Mintable.sol",
"label": "______gap",
"astId": 9746,
"type": "t_array:50<t_uint256>",
"src": "816:29:119"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 439,
"type": "t_array:50<t_uint256>",
"src": "1133:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4481,
"type": "t_bool",
"src": "855:20:37"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4564,
"type": "t_array:50<t_uint256>",
"src": "2105:29:37"
},
{
"contract": "ERC20Pausable",
"path": "contracts/token/ERC20/ERC20Pausable.sol",
"label": "______gap",
"astId": 9869,
"type": "t_array:50<t_uint256>",
"src": "1178:29:120"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
},
"StandaloneERC721": {
"address": "0xf43fe8b882b9821b3d648fb9f4d99d2fd736368c",
"constructorCode": "608060405234801561001057600080fd5b50614299806100206000396000f3fe",
"bodyBytecodeHash": "9113153cb4b2b62f720cb12960ba3b4a7b9a5f3329e34a4a3ece0212d130ae53",
"localBytecodeHash": "5dca693db1fee9a4ce973e49d6665a8770b823c36ba2c7e64f37d81046672074",
"deployedBytecodeHash": "5dca693db1fee9a4ce973e49d6665a8770b823c36ba2c7e64f37d81046672074",
"types": {
"t_bool": {
"id": "t_bool",
"kind": "elementary",
"label": "bool"
},
"t_uint256": {
"id": "t_uint256",
"kind": "elementary",
"label": "uint256"
},
"t_array:50<t_uint256>": {
"id": "t_array:50<t_uint256>",
"valueType": "t_uint256",
"length": "50",
"kind": "array",
"label": "uint256[50]"
},
"t_mapping<t_bool>": {
"id": "t_mapping<t_bool>",
"valueType": "t_bool",
"label": "mapping(key => bool)",
"kind": "mapping"
},
"t_address": {
"id": "t_address",
"kind": "elementary",
"label": "address"
},
"t_mapping<t_address>": {
"id": "t_mapping<t_address>",
"valueType": "t_address",
"label": "mapping(key => address)",
"kind": "mapping"
},
"t_struct<Counters.Counter>": {
"id": "t_struct<Counters.Counter>",
"kind": "struct",
"label": "Counters.Counter",
"members": [
{
"label": "_value",
"astId": 2533,
"type": "t_uint256",
"src": "1022:14:22"
}
]
},
"t_mapping<t_struct<Counters.Counter>>": {
"id": "t_mapping<t_struct<Counters.Counter>>",
"valueType": "t_struct<Counters.Counter>",
"label": "mapping(key => Counters.Counter)",
"kind": "mapping"
},
"t_array:dyn<t_uint256>": {
"id": "t_array:dyn<t_uint256>",
"valueType": "t_uint256",
"length": "dyn",
"kind": "array",
"label": "uint256[]"
},
"t_mapping<t_array:dyn<t_uint256>>": {
"id": "t_mapping<t_array:dyn<t_uint256>>",
"valueType": "t_array:dyn<t_uint256>",
"label": "mapping(key => uint256[])",
"kind": "mapping"
},
"t_mapping<t_uint256>": {
"id": "t_mapping<t_uint256>",
"valueType": "t_uint256",
"label": "mapping(key => uint256)",
"kind": "mapping"
},
"t_string": {
"id": "t_string",
"kind": "elementary",
"label": "string"
},
"t_mapping<t_string>": {
"id": "t_mapping<t_string>",
"valueType": "t_string",
"label": "mapping(key => string)",
"kind": "mapping"
},
"t_struct<Roles.Role>": {
"id": "t_struct<Roles.Role>",
"kind": "struct",
"label": "Roles.Role",
"members": [
{
"label": "bearer",
"astId": 5,
"type": "t_mapping<t_bool>",
"src": "150:32:0"
}
]
}
},
"storage": [
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initialized",
"astId": 13503,
"type": "t_bool",
"src": "757:24:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "initializing",
"astId": 13505,
"type": "t_bool",
"src": "876:25:147"
},
{
"contract": "Initializable",
"path": "@openzeppelin/upgrades/contracts/Initializable.sol",
"label": "______gap",
"astId": 13554,
"type": "t_array:50<t_uint256>",
"src": "1891:29:147"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "_supportedInterfaces",
"astId": 4117,
"type": "t_mapping<t_bool>",
"src": "550:52:31"
},
{
"contract": "ERC165",
"path": "contracts/introspection/ERC165.sol",
"label": "______gap",
"astId": 4162,
"type": "t_array:50<t_uint256>",
"src": "1714:29:31"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenOwner",
"astId": 10508,
"type": "t_mapping<t_address>",
"src": "829:48:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_tokenApprovals",
"astId": 10512,
"type": "t_mapping<t_address>",
"src": "933:52:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_ownedTokensCount",
"astId": 10516,
"type": "t_mapping<t_struct<Counters.Counter>>",
"src": "1043:63:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "_operatorApprovals",
"astId": 10522,
"type": "t_mapping<t_bool>",
"src": "1161:73:125"
},
{
"contract": "ERC721",
"path": "contracts/token/ERC721/ERC721.sol",
"label": "______gap",
"astId": 11065,
"type": "t_array:50<t_uint256>",
"src": "12696:29:125"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokens",
"astId": 11117,
"type": "t_mapping<t_array:dyn<t_uint256>>",
"src": "445:50:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_ownedTokensIndex",
"astId": 11121,
"type": "t_mapping<t_uint256>",
"src": "565:53:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokens",
"astId": 11124,
"type": "t_array:dyn<t_uint256>",
"src": "679:28:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "_allTokensIndex",
"astId": 11128,
"type": "t_mapping<t_uint256>",
"src": "778:51:127"
},
{
"contract": "ERC721Enumerable",
"path": "contracts/token/ERC721/ERC721Enumerable.sol",
"label": "______gap",
"astId": 11459,
"type": "t_array:50<t_uint256>",
"src": "8994:29:127"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_name",
"astId": 11526,
"type": "t_string",
"src": "266:20:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_symbol",
"astId": 11528,
"type": "t_string",
"src": "313:22:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "_tokenURIs",
"astId": 11532,
"type": "t_mapping<t_string>",
"src": "381:45:130"
},
{
"contract": "ERC721Metadata",
"path": "contracts/token/ERC721/ERC721Metadata.sol",
"label": "______gap",
"astId": 11663,
"type": "t_array:50<t_uint256>",
"src": "3029:29:130"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "_minters",
"astId": 219,
"type": "t_struct<Roles.Role>",
"src": "271:27:2"
},
{
"contract": "MinterRole",
"path": "contracts/access/roles/MinterRole.sol",
"label": "______gap",
"astId": 319,
"type": "t_array:50<t_uint256>",
"src": "1133:29:2"
},
{
"contract": "ERC721MetadataMintable",
"path": "contracts/token/ERC721/ERC721MetadataMintable.sol",
"label": "______gap",
"astId": 11733,
"type": "t_array:50<t_uint256>",
"src": "1042:29:131"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "_pausers",
"astId": 339,
"type": "t_struct<Roles.Role>",
"src": "271:27:3"
},
{
"contract": "PauserRole",
"path": "contracts/access/roles/PauserRole.sol",
"label": "______gap",
"astId": 439,
"type": "t_array:50<t_uint256>",
"src": "1133:29:3"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "_paused",
"astId": 4481,
"type": "t_bool",
"src": "855:20:37"
},
{
"contract": "Pausable",
"path": "contracts/lifecycle/Pausable.sol",
"label": "______gap",
"astId": 4564,
"type": "t_array:50<t_uint256>",
"src": "2105:29:37"
},
{
"contract": "ERC721Pausable",
"path": "contracts/token/ERC721/ERC721Pausable.sol",
"label": "______gap",
"astId": 11878,
"type": "t_array:50<t_uint256>",
"src": "850:29:133"
}
],
"warnings": {
"hasConstructor": false,
"hasSelfDestruct": false,
"hasDelegateCall": false,
"hasInitialValuesInDeclarations": false,
"uninitializedBaseContracts": []
}
}
},
"solidityLibs": {},
"proxies": {},
"manifestVersion": "2.2",
"frozen": true,
"app": {
"address": "0x27a09abca2c4d9f914dbc7bea164b0e6b74ce7a9"
},
"package": {
"address": "0x2a9e7b63514438906a83a1e320dbbd814d417002"
},
"provider": {
"address": "0xb818f726ea886a73dc4105252f0e7c10b6309cae"
},
"version": "2.2.0"
}

View File

@ -1,15 +0,0 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"overrides": [
{
"files": "*.sol",
"options": {
"singleQuote": false
}
}
],
"plugins": ["prettier-plugin-solidity"]
}

View File

@ -1,13 +1,9 @@
module.exports = {
norpc: true,
testCommand: 'npm test',
compileCommand: 'npm run compile',
skipFiles: ['mocks'],
providerOptions: {
default_balance_ether: '10000000000000000000000000',
},
mocha: {
fgrep: '[skip-on-coverage]',
invert: true,
},
};
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'
]
}

11
.solhint.json Normal file
View File

@ -0,0 +1,11 @@
{
"extends": "default",
"rules": {
"indent": ["error", 4],
"bracket-align": false,
"compiler-fixed": false,
"no-simple-event-func-name": false,
"two-lines-top-level-separator": false
}
}

53
.travis.yml Normal file
View File

@ -0,0 +1,53 @@
dist: trusty
sudo: false
group: beta
language: node_js
node_js:
- "8"
cache:
directories:
- node_modules
jobs:
# XXX fast_finish doesn't work with stages yet. See
# https://github.com/travis-ci/travis-ci/issues/8425
# --elopio - 20180531
fast_finish: true
allow_failures:
- env: SOLC_NIGHTLY=true
include:
- stage: tests
name: "Linter"
script: npm run lint
- stage: tests
name: "Unit tests"
script: npm run test
- stage: tests
name: "Unit tests with coverage report"
script: npm run test
env: SOLIDITY_COVERAGE=true
- stage: tests
name: "Unit tests using solc nightly"
script: npm run test
env: SOLC_NIGHTLY=true
- stage: update docs
if: tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
addons:
apt:
packages:
- curl
script:
- ./scripts/ci/trigger_docs_update "${TRAVIS_TAG}"
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

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at contact@openzeppelin.com. All
reported by contacting the project team at maintainers@openzeppelin.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

63
CODE_STYLE.md Normal file
View File

@ -0,0 +1,63 @@
# Code Style
We value clean code and consistency, and those are prerequisites for us to
include new code in the repository. Before proposing a change, please read this
document and take some time to familiarize yourself with the style of the
existing codebase.
## Solidity code
In order to be consistent with all the other Solidity projects, we follow the
[official recommendations documented in the Solidity style guide](http://solidity.readthedocs.io/en/latest/style-guide.html).
Any exception or additions specific to our project are documented below.
### Naming
* Try to avoid acronyms and abbreviations.
* All state variables should be private.
* Private state variables should have an underscore prefix.
```
contract TestContract {
uint256 private _privateVar;
uint256 internal _internalVar;
}
```
* Parameters must not be prefixed with an underscore.
```
function test(uint256 testParameter1, uint256 testParameter2) {
...
}
```
* Internal and private functions should have an underscore prefix.
```
function _testInternal() internal {
...
}
```
```
function _testPrivate() private {
...
}
```
* Events should be emitted immediately after the state change that they
represent, and consequently they should be named in past tense.
```
function _burn(address _who, uint256 _value) internal {
super._burn(_who, _value);
emit TokensBurned(_who, _value);
}
```
Some standards (e.g. ERC20) use present tense, and in those cases the
standard specification prevails.

View File

@ -1,36 +1,58 @@
# Contributing Guidelines
Contributing to OpenZeppelin
=======
There are many ways to contribute to OpenZeppelin Contracts.
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.
## Troubleshooting
## Contribution guidelines
You can help other users in the community to solve their smart contract issues in the [OpenZeppelin Forum].
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/openzeppelin-solidity/wiki/Contribution-guidelines).
[OpenZeppelin Forum]: https://forum.openzeppelin.com/
## Creating Pull Requests (PRs)
## Opening an issue
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.
You can [open an issue] to suggest a feature or report a minor bug. For serious bugs please do not open an issue, instead refer to our [security policy] for appropriate steps.
*IMPORTANT*
* Please see ["Git flow wiki entry"](https://github.com/OpenZeppelin/openzeppelin-solidity/wiki/Git-flow) for understanding how to use branches in this repository.
If you believe your issue may be due to user error and not a problem in the library, consider instead posting a question on the [OpenZeppelin Forum].
## A typical workflow
Before opening an issue, be sure to search through the existing open and closed issues, and consider posting a comment in one of those instead.
1) Make sure your fork is up to date with the main repository:
When requesting a new feature, include as many details as you can, especially around the use cases that motivate it. Features are prioritized according to the impact they may have on the ecosystem, so we appreciate information showing that the impact could be high.
```
cd openzeppelin-solidity
git remote add upstream https://github.com/OpenZeppelin/openzeppelin-solidity.git
git fetch upstream
git pull --rebase upstream master
```
NOTE: The directory `openzeppelin-solidity` represents your fork's local copy.
[security policy]: https://github.com/OpenZeppelin/openzeppelin-contracts/security
[open an issue]: https://github.com/OpenZeppelin/openzeppelin-contracts/issues/new/choose
2) Branch out from `master` 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
```
## Submitting a pull request
3) Make your changes, add your files, commit and push to your fork.
If you would like to contribute code or documentation you may do so by forking the repository and submitting a pull request.
```
git add SomeFile.js
git commit "Fix some bug #123"
git push origin fix/some-bug-#123
```
Any non-trivial code contribution must be first discussed with the maintainers in an issue (see [Opening an issue](#opening-an-issue)). Only very minor changes are accepted without prior discussion.
4) Go to [github.com/OpenZeppelin/openzeppelin-solidity](https://github.com/OpenZeppelin/zeppelin-solidity) in your web browser and issue a new pull request.
Make sure to read and follow the [engineering guidelines](./GUIDELINES.md). Run linter and tests to make sure your pull request is good before submitting it.
*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.
Changelog entries should be added to each pull request by using [Changesets](https://github.com/changesets/changesets/).
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.
When opening the pull request you will be presented with a template and a series of instructions. Read through it carefully and follow all the steps. Expect a review and feedback from the maintainers afterwards.
*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're looking for a good place to start, look for issues labelled ["good first issue"](https://github.com/OpenZeppelin/openzeppelin-contracts/labels/good%20first%20issue)!
## All set!
If you have any questions feel free to post them to github.com/OpenZeppelin/openzeppelin-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/openzeppelin-solidity/labels/good%20first%20issue).
Thanks for your time and code!

View File

@ -1,148 +0,0 @@
# Engineering Guidelines
## Testing
Code must be thoroughly tested with quality unit tests.
We defer to the [Moloch Testing Guide](https://github.com/MolochVentures/moloch/tree/master/test#readme) for specific recommendations, though not all of it is relevant here. Note the introduction:
> Tests should be written, not only to verify correctness of the target code, but to be comprehensively reviewed by other programmers. Therefore, for mission critical Solidity code, the quality of the tests are just as important (if not more so) than the code itself, and should be written with the highest standards of clarity and elegance.
Every addition or change to the code must come with relevant and comprehensive tests.
Refactors should avoid simultaneous changes to tests.
Flaky tests are not acceptable.
The test suite should run automatically for every change in the repository, and in pull requests tests must pass before merging.
The test suite coverage must be kept as close to 100% as possible, enforced in pull requests.
In some cases unit tests may be insufficient and complementary techniques should be used:
1. Property-based tests (aka. fuzzing) for math-heavy code.
2. Formal verification for state machines.
## Code style
Solidity code should be written in a consistent format enforced by a linter, following the official [Solidity Style Guide](https://docs.soliditylang.org/en/latest/style-guide.html). See below for further [Solidity Conventions](#solidity-conventions).
The code should be simple and straightforward, prioritizing readability and understandability. Consistency and predictability should be maintained across the codebase. In particular, this applies to naming, which should be systematic, clear, and concise.
Sometimes these guidelines may be broken if doing so brings significant efficiency gains, but explanatory comments should be added.
Modularity should be pursued, but not at the cost of the above priorities.
## Documentation
For contributors, project guidelines and processes must be documented publicly.
For users, features must be abundantly documented. Documentation should include answers to common questions, solutions to common problems, and recommendations for critical decisions that the user may face.
All changes to the core codebase (excluding tests, auxiliary scripts, etc.) must be documented in a changelog, except for purely cosmetic or documentation changes.
## Peer review
All changes must be submitted through pull requests and go through peer code review.
The review must be approached by the reviewer in a similar way as if it was an audit of the code in question (but importantly it is not a substitute for and should not be considered an audit).
Reviewers should enforce code and project guidelines.
External contributions must be reviewed separately by multiple maintainers.
## Automation
Automation should be used as much as possible to reduce the possibility of human error and forgetfulness.
Automations that make use of sensitive credentials must use secure secret management, and must be strengthened against attacks such as [those on GitHub Actions worklows](https://github.com/nikitastupin/pwnhub).
Some other examples of automation are:
- Looking for common security vulnerabilities or errors in our code (eg. reentrancy analysis).
- Keeping dependencies up to date and monitoring for vulnerable dependencies.
## Pull requests
Pull requests are squash-merged to keep the `master` branch history clean. The title of the pull request becomes the commit message, so it should be written in a consistent format:
1) Begin with a capital letter.
2) Do not end with a period.
3) Write in the imperative: "Add feature X" and not "Adds feature X" or "Added feature X".
This repository does not follow conventional commits, so do not prefix the title with "fix:" or "feat:".
Work in progress pull requests should be submitted as Drafts and should not be prefixed with "WIP:".
Branch names don't matter, and commit messages within a pull request mostly don't matter either, although they can help the review process.
# Solidity Conventions
In addition to the official Solidity Style Guide we have a number of other conventions that must be followed.
* All state variables should be private.
Changes to state should be accompanied by events, and in some cases it is not correct to arbitrarily set state. Encapsulating variables as private and only allowing modification via setters enables us to ensure that events and other rules are followed reliably and prevents this kind of user error.
* Internal or private state variables or functions should have an underscore prefix.
```solidity
contract TestContract {
uint256 private _privateVar;
uint256 internal _internalVar;
function _testInternal() internal { ... }
function _testPrivate() private { ... }
}
```
* Functions should be declared virtual, with few exceptions listed below. The
contract logic should be written considering that these functions may be
overridden by developers, e.g. getting a value using an internal getter rather
than reading directly from a state variable.
If function A is an "alias" of function B, i.e. it invokes function B without
significant additional logic, then function A should not be virtual so that
any user overrides are implemented on B, preventing inconsistencies.
* Events should generally be emitted immediately after the state change that they
represent, and should be named in the past tense. Some exceptions may be made for gas
efficiency if the result doesn't affect observable ordering of events.
```solidity
function _burn(address who, uint256 value) internal {
super._burn(who, value);
emit TokensBurned(who, value);
}
```
Some standards (e.g. ERC20) use present tense, and in those cases the
standard specification is used.
* Interface names should have a capital I prefix.
```solidity
interface IERC777 {
```
* Contracts not intended to be used standalone should be marked abstract
so they are required to be inherited to other contracts.
```solidity
abstract contract AccessControl is ..., {
```
* Unchecked arithmetic blocks should contain comments explaining why overflow is guaranteed not to happen. If the reason is immediately apparent from the line above the unchecked block, the comment may be omitted.
* Custom errors should be declared following the [EIP-6093](https://eips.ethereum.org/EIPS/eip-6093) rationale whenever reasonable. Also, consider the following:
* The domain prefix should be picked in the following order:
1. Use `ERC<number>` if the error is a violation of an ERC specification.
2. Use the name of the underlying component where it belongs (eg. `Governor`, `ECDSA`, or `Timelock`).
* The location of custom errors should be decided in the following order:
1. Take the errors from their underlying ERCs if they're already defined.
2. Declare the errors in the underlying interface/library if the error makes sense in its context.
3. Declare the error in the implementation if the underlying interface/library is not suitable to do so (eg. interface/library already specified in an ERC).
4. Declare the error in an extension if the error only happens in such extension or child contracts.
* Custom error names should not be declared twice along the library to avoid duplicated identifier declarations when inheriting from multiple contracts.

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2016-2023 zOS Global Limited and contributors
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

141
README.md
View File

@ -1,107 +1,112 @@
# <img src="logo.svg" alt="OpenZeppelin" height="40px">
# <img src="logo.png" alt="OpenZeppelin" width="400px">
[![NPM Package](https://img.shields.io/npm/v/@openzeppelin/contracts.svg)](https://www.npmjs.org/package/@openzeppelin/contracts)
[![Coverage Status](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts/graph/badge.svg)](https://codecov.io/gh/OpenZeppelin/openzeppelin-contracts)
[![GitPOAPs](https://public-api.gitpoap.io/v1/repo/OpenZeppelin/openzeppelin-contracts/badge)](https://www.gitpoap.io/gh/OpenZeppelin/openzeppelin-contracts)
[![Docs](https://img.shields.io/badge/docs-%F0%9F%93%84-yellow)](https://docs.openzeppelin.com/contracts)
[![Forum](https://img.shields.io/badge/forum-%F0%9F%92%AC-yellow)](https://docs.openzeppelin.com/contracts)
# OpenZeppelin Contracts Ethereum Package
**A library for secure smart contract development.** Build on a solid foundation of community-vetted code.
[![NPM Package](https://img.shields.io/npm/v/openzeppelin-contracts-ethereum-package.svg?style=flat-square)](https://www.npmjs.org/package/@openzeppelin/contracts-ethereum-package)
[![Build Status](https://img.shields.io/travis/OpenZeppelin/openzeppelin-contracts-ethereum-package.svg?branch=master&style=flat-square)](https://travis-ci.org/OpenZeppelin/openzeppelin-contracts-ethereum-package)
* Implementations of standards like [ERC20](https://docs.openzeppelin.com/contracts/erc20) and [ERC721](https://docs.openzeppelin.com/contracts/erc721).
* Flexible [role-based permissioning](https://docs.openzeppelin.com/contracts/access-control) scheme.
* Reusable [Solidity components](https://docs.openzeppelin.com/contracts/utilities) to build custom contracts and complex decentralized systems.
**OpenZeppelin Contracts 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.
:mage: **Not sure how to get started?** Check out [Contracts Wizard](https://wizard.openzeppelin.com/) — an interactive smart contract generator.
This fork of OpenZeppelin is set up as a **reusable Ethereum 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 the [OpenZeppelin SDK](https://github.com/openzeppelin/openzeppelin-sdk), or reuse their Solidity source code as with the [vanilla version of OpenZeppelin Contracts](https://github.com/OpenZeppelin/openzeppelin-contracts).
:building_construction: **Want to scale your decentralized application?** Check out [OpenZeppelin Defender](https://openzeppelin.com/defender) — a secure platform for automating and monitoring your operations.
## Differences with openzeppelin-contracts
> [!IMPORTANT]
> OpenZeppelin Contracts uses semantic versioning to communicate backwards compatibility of its API and storage layout. For upgradeable contracts, the storage layout of different major versions should be assumed incompatible, for example, it is unsafe to upgrade from 4.9.3 to 5.0.0. Learn more at [Backwards Compatibility](https://docs.openzeppelin.com/contracts/backwards-compatibility).
This package contains the same contracts as the vanilla [openzeppelin-contracts](https://github.com/openZeppelin/openzeppelin-contracts). The main difference is that _all contracts in this package are potentially upgradeable_: you will notice that no contracts have constructors defined, but use [initializer functions](https://docs.zeppelinos.org/docs/writing_contracts.html#initializers) instead. Also, this package is set up as an Ethereum package, and provides a small set of pre-deployed logic contracts that can be used directly via the OpenZeppelin SDK, without needing to deploy them again.
## Overview
All in all, **you should use this package instead of openzeppelin-solidity if you are managing your project via the OpenZeppelin CLI**.
### Installation
#### Hardhat, Truffle (npm)
## Install
```
$ npm install @openzeppelin/contracts
npm install @openzeppelin/contracts-ethereum-package
```
#### Foundry (git)
## Deployed logic contracts
> [!WARNING]
> When installing via git, it is a common error to use the `master` branch. This is a development branch that should be avoided in favor of tagged releases. The release process involves security measures that the `master` branch does not guarantee.
- [StandaloneERC20](contracts/token/ERC20/StandaloneERC20.sol): ERC20 token implementation, optionally mintable and pausable.
- [StandaloneERC721](contracts/token/ERC721/StandaloneERC721.sol): ERC721 non-fungible token implementation with metadata and enumerable extensions, optionally mintable and pausable.
- [TokenVesting](contracts/drafts/TokenVesting.sol): tToken holder contract that can release its token balance gradually like a typical vesting scheme, with a cliff and vesting period, optionally revocable.
- [PaymentSplitter](contracts/payment/PaymentSplitter.sol): Splits payments among a group of addresses proportionately to some number of shares they own.
> [!WARNING]
> Foundry installs the latest version initially, but subsequent `forge update` commands will use the `master` branch.
## Using via the OpenZeppelin CLI
```
$ forge install OpenZeppelin/openzeppelin-contracts
You can easily create upgradeable instances of any of the logic contracts listed above using the OpenZeppelin CLI. This will rely on the pre-deployed instances in mainnet, kovan, ropsten, or rinkeby, greatly reducing your gas deployment costs. To do this, just [create a new OpenZeppelin SDK project](https://docs.zeppelinos.org/docs/deploying.html) and [link to this package](https://docs.zeppelinos.org/docs/linking.html).
```bash
$ npm install -g @openzeppelin/cli
$ openzeppelin init
$ openzeppelin link @openzeppelin/contracts-ethereum-package
> Installing...
$ openzeppelin create @openzeppelin/contracts-ethereum-package/StandaloneERC20
> Creating...
```
Add `@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/` in `remappings.txt.`
To create an instance of a contract, use the `openzeppelin create` command. As an example, you can run the following to create an upgradeable ERC20 named MyToken, with symbol TKN and 8 decimals, and an initial supply of 100 tokens assigned to the address HOLDER, with a MINTER and a PAUSER. Remember to replace $HOLDER, $MINTER, and $PAUSER with actual addresses when you run this command; you can specify more than one (or none at all) minters and pausers.
### Usage
```
$ openzeppelin create
? Pick a contract to instantiate: @openzeppelin/contracts-ethereum-package/StandaloneERC20
? Pick a network: development
✓ Deploying @openzeppelin/contracts-ethereum-package dependency to network
? Do you want to call a function on the instance after creating it?: Yes
? Select which function: * initialize(name: string, symbol: string, decimals: uint8, initialSupply: uint256, initialHolder: address, minters: address[], pausers: address[])
? name (string): MyToken
? symbol (string): MYT
? decimals (uint8): 18
? initialSupply (uint256): 100e18
? initialHolder (address): 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1
? minters (address[]):
? pausers (address[]):
✓ Setting everything up to create contract instances
✓ Instance created at 0x2612Af3A521c2df9EAF28422Ca335b04AdF3ac66
```
Once installed, you can use the contracts in the library by importing them:
OpenZeppelin will create an upgradeable ERC20 instance and keep track of its address in the `.openzeppelin/rinkeby.json` file. Should you update your version of the openzeppelin contracts ethereum package later down the road, you can simply run `openzeppelin update` to upgrade all your ERC20 instances to the latest version.
You can also deploy a ERC721 token by choosing the `StandaloneERC721` contract when running `openzeppelin create`. Refer to the `initialize` function of each of the predeployed logic contracts to see which parameters are required for initialization.
## Extending contracts
If you prefer to write your custom contracts, import the ones from this package and extend them through inheritance. Note that **you must use this package and not `@openzeppelin/contracts` if you are [writing upgradeable contracts](https://docs.zeppelinos.org/docs/writing_contracts.html)**.
```solidity
pragma solidity ^0.8.20;
pragma solidity ^0.5.0;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import '@openzeppelin/upgrades/contracts/Initializable.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721Full.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/token/ERC721/ERC721Mintable.sol';
contract MyCollectible is ERC721 {
constructor() ERC721("MyCollectible", "MCO") {
}
contract MyNFT is Initializable, ERC721Full, ERC721Mintable {
function initialize() public initializer {
ERC721.initialize();
ERC721Enumerable.initialize();
ERC721Metadata.initialize("MyNFT", "MNFT");
ERC721Mintable.initialize(msg.sender);
}
}
```
_If you're new to smart contract development, head to [Developing Smart Contracts](https://docs.openzeppelin.com/learn/developing-smart-contracts) to learn about creating a new project and compiling your contracts._
To keep your system secure, you should **always** use the installed code as-is, and neither copy-paste it from online sources nor modify it yourself. The library is designed so that only the contracts and functions you use are deployed, so you don't need to worry about it needlessly increasing gas costs.
## Learn More
The guides in the [documentation site](https://docs.openzeppelin.com/contracts) will teach about different concepts, and how to use the related contracts that OpenZeppelin Contracts provides:
* [Access Control](https://docs.openzeppelin.com/contracts/access-control): decide who can perform each of the actions on your system.
* [Tokens](https://docs.openzeppelin.com/contracts/tokens): create tradeable assets or collectives, and distribute them via [Crowdsales](https://docs.openzeppelin.com/contracts/crowdsales).
* [Utilities](https://docs.openzeppelin.com/contracts/utilities): generic useful tools including non-overflowing math, signature verification, and trustless paying systems.
The [full API](https://docs.openzeppelin.com/contracts/api/token/ERC20) is also thoroughly documented, and serves as a great reference when developing your smart contract application. You can also ask for help or follow Contracts's development in the [community forum](https://forum.openzeppelin.com).
Finally, you may want to take a look at the [guides on our blog](https://blog.openzeppelin.com/), which cover several common use cases and good practices. The following articles provide great background reading, though please note that some of the referenced tools have changed, as the tooling in the ecosystem continues to rapidly evolve.
* [The Hitchhikers Guide to Smart Contracts in Ethereum](https://blog.openzeppelin.com/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05) will help you get an overview of the various tools available for smart contract development, and help you set up your environment.
* [A Gentle Introduction to Ethereum Programming, Part 1](https://blog.openzeppelin.com/a-gentle-introduction-to-ethereum-programming-part-1-783cc7796094) provides very useful information on an introductory level, including many basic concepts from the Ethereum platform.
* For a more in-depth dive, you may read the guide [Designing the Architecture for Your Ethereum Application](https://blog.openzeppelin.com/designing-the-architecture-for-your-ethereum-application-9cec086f8317), which discusses how to better structure your application and its relationship to the real world.
On our site you will find a few [guides] to learn about the different 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 forum][forum].
## Security
This project is maintained by [OpenZeppelin](https://openzeppelin.com) with the goal of providing a secure and reliable library of smart contract components for the ecosystem. We address security through risk management in various areas such as engineering and open source best practices, scoping and API design, multi-layered review processes, and incident response preparedness.
OpenZeppelin Contracts is maintained by [OpenZeppelin](https://openzeppelin.com) the company, and developed following our high standards for code quality and security. OpenZeppelin Contracts 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 [OpenZeppelin Contracts Security Center](https://contracts.openzeppelin.com/security) contains more details about the secure development process.
The core development principles and strategies that OpenZeppelin Contracts 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.
The security policy is detailed in [`SECURITY.md`](./SECURITY.md) as well, and specifies how you can report security vulnerabilities, which versions will receive security patches, and how to stay informed about them. We run a [bug bounty program on Immunefi](https://immunefi.com/bounty/openzeppelin) to reward the responsible disclosure of vulnerabilities.
The latest audit was done on October 2018 on version 2.0.0.
The engineering guidelines we follow to promote project quality can be found in [`GUIDELINES.md`](./GUIDELINES.md).
Past audits can be found in [`audits/`](./audits).
Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. Although OpenZeppelin is well known for its security audits, using OpenZeppelin Contracts is not a substitute for a security audit.
OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. As set out further in the Terms, you acknowledge that you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use.
Please report any security issues you find to security@openzeppelin.org.
## Contribute
OpenZeppelin Contracts exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the [contribution guide](CONTRIBUTING.md)!
OpenZeppelin exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the [contribution guide]!
## License
OpenZeppelin Contracts is released under the [MIT License](LICENSE).
OpenZeppelin is released under the [MIT License](LICENSE).
## Legal
Your use of this Project is governed by the terms found at www.openzeppelin.com/tos (the "Terms").
[API docs]: https://docs.openzeppelin.org/v2.3.0/api/token/erc20
[guides]: https://docs.openzeppelin.org/v2.3.0/get-started
[forum]: https://forum.zeppelin.solutions
[contribution guide]: CONTRIBUTING.md

View File

@ -1,45 +1,99 @@
# Releasing
OpenZeppelin Contracts uses a fully automated release process that takes care of compiling, packaging, and publishing the library, all of which is carried out in a clean CI environment (GitHub Actions), implemented in the ([`release-cycle`](.github/workflows/release-cycle.yml)) workflow. This helps to reduce the potential for human error and inconsistencies, and ensures that the release process is ongoing and reliable.
This document describes our release process, and contains the steps to be followed by an OpenZeppelin maintainer at the several stages of a release.
## Changesets
We release a new version of OpenZeppelin monthly. Release cycles are tracked in the [issue milestones](https://github.com/OpenZeppelin/openzeppelin-solidity/milestones).
[Changesets](https://github.com/changesets/changesets/) is used as part of our release process for `CHANGELOG.md` management. Each change that is relevant for the codebase is expected to include a changeset.
Each release has at least one release candidate published first, intended for community review and any critical fixes that may come out of it. At the moment we leave 1 week between the first release candidate and the final release.
## Branching model
Before starting make sure to verify the following items.
* Your local `master` branch is in sync with your `upstream` remote (it may have another name depending on your setup).
* Your repo is clean, particularly with no untracked files in the contracts and tests directories. Verify with `git clean -n`.
The release cycle happens on release branches called `release-vX.Y`. Each of these branches starts as a release candidate (rc) and is eventually promoted to final.
A release branch can be updated with cherry-picked patches from `master`, or may sometimes be committed to directly in the case of old releases. These commits will lead to a new release candidate or a patch increment depending on the state of the release branch.
## Creating the release branch
```mermaid
%%{init: {'gitGraph': {'mainBranchName': 'master'}} }%%
gitGraph
commit id: "Feature A"
commit id: "Feature B"
branch release-vX.Y
commit id: "Start release"
commit id: "Release vX.Y.0-rc.0"
We'll refer to a release `vX.Y.Z`.
checkout master
commit id: "Feature C"
commit id: "Fix A"
checkout release-vX.Y
cherry-pick id: "Fix A" tag: ""
commit id: "Release vX.Y.0-rc.1"
commit id: "Release vX.Y.0"
checkout master
merge release-vX.Y
commit id: "Feature D"
commit id: "Patch B"
checkout release-vX.Y
cherry-pick id: "Patch B" tag: ""
commit id: "Release vX.Y.1"
checkout master
merge release-vX.Y
commit id: "Feature E"
```
git checkout master
git checkout -b release-vX.Y.Z
```
## Creating a release candidate
Once in the release branch, change the version string in `package.json`, `package-lock.json` and `ethpm.json` to `X.Y.Z-rc.R`. (This will be `X.Y.Z-rc.1` for the first release candidate.) Commit these changes and tag the commit as `vX.Y.Z-rc.R`.
```
git add package.json package-lock.json ethpm.json
git commit -m "Release candidate vX.Y.Z-rc.R"
git tag -a vX.Y.Z-rc.R
git push upstream release-vX.Y.Z
git push upstream vX.Y.Z-rc.R
```
Draft the release notes in our [GitHub releases](https://github.com/OpenZeppelin/openzeppelin-solidity/releases). Make sure to mark it as a pre-release! Try to be consistent with our previous release notes in the title and format of the text. Release candidates don't need a detailed changelog, but make sure to include a link to GitHub's compare page.
Once the CI run for the new tag is green, publish on npm under the `next` tag. You should see the contracts compile automatically.
```
npm publish --tag next
```
Publish the release notes on GitHub and ask our community manager to announce the release candidate on at least Slack and Twitter.
## Creating the final release
Make sure to have the latest changes from `upstream` in your local release branch.
```
git checkout release-vX.Y.Z
git pull upstream
```
Before starting the release process, make one final commit to CHANGELOG.md, including the date of the release.
Change the version string in `package.json`, `package-lock.json` and `ethpm.json` removing the "-rc.R" suffix. Commit these changes and tag the commit as `vX.Y.Z`.
```
git add package.json package-lock.json ethpm.json
git commit -m "Release vX.Y.Z"
git tag -a vX.Y.Z
git push upstream release-vX.Y.Z
git push upstream vX.Y.Z
```
Draft the release notes in GitHub releases. Try to be consistent with our previous release notes in the title and format of the text. Make sure to include a detailed changelog.
Once the CI run for the new tag is green, publish on npm. You should see the contracts compile automatically.
```
npm publish
```
Publish the release notes on GitHub and ask our community manager to announce the release!
Delete the `next` tag in the npm package as there is no longer a release candidate.
```
npm dist-tag rm --otp $2FA_CODE openzeppelin-solidity next
```
## Merging the release branch
After the final release, the release branch should be merged back into `master`. This merge must not be squashed because it would lose the tagged release commit. Since the GitHub repo is set up to only allow squashed merges, the merge should be done locally and pushed.
Make sure to have the latest changes from `upstream` in your local release branch.
```
git checkout release-vX.Y.Z
git pull upstream
```
```
git checkout master
git merge --no-ff release-vX.Y.Z
git push upstream master
```
The release branch can then be deleted on GitHub.

View File

@ -1,42 +0,0 @@
# Security Policy
Security vulnerabilities should be disclosed to the project maintainers through [Immunefi], or alternatively by email to security@openzeppelin.com.
[Immunefi]: https://immunefi.com/bounty/openzeppelin
## Bug Bounty
Responsible disclosure of security vulnerabilities is rewarded through a bug bounty program on [Immunefi].
There is a bonus reward for issues introduced in release candidates that are reported before making it into a stable release.
## Security Patches
Security vulnerabilities will be patched as soon as responsibly possible, and published as an advisory on this repository (see [advisories]) and on the affected npm packages.
[advisories]: https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories
Projects that build on OpenZeppelin Contracts are encouraged to clearly state, in their source code and websites, how to be contacted about security issues in the event that a direct notification is considered necessary. We recommend including it in the NatSpec for the contract as `/// @custom:security-contact security@example.com`.
Additionally, we recommend installing the library through npm and setting up vulnerability alerts such as [Dependabot].
[Dependabot]: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security#what-is-dependabot
### Supported Versions
Security patches will be released for the latest minor of a given major release. For example, if an issue is found in versions >=4.6.0 and the latest is 4.8.0, the patch will be released only in version 4.8.1.
Only critical severity bug fixes will be backported to past major releases.
| Version | Critical security fixes | Other security fixes |
| ------- | ----------------------- | -------------------- |
| 4.x | :white_check_mark: | :white_check_mark: |
| 3.4 | :white_check_mark: | :x: |
| 2.5 | :white_check_mark: | :x: |
| < 2.0 | :x: | :x: |
Note as well that the Solidity language itself only guarantees security updates for the latest release.
## Legal
Smart contracts are a nascent technology and carry a high level of technical risk and uncertainty. OpenZeppelin Contracts is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project, including OpenZeppelin. Your use of the project is also governed by the terms found at www.openzeppelin.com/tos (the "Terms"). As set out in the Terms, you are solely responsible for any use of OpenZeppelin Contracts and you assume all risks associated with any such use. This Security Policy in no way evidences or represents an on-going duty by any contributor, including OpenZeppelin, to correct any flaws or alert you to all or any of the potential risks of utilizing the project.

View File

@ -1,7 +1,5 @@
# OpenZeppelin Audit
NOTE ON 2021-07-19: This report makes reference to Zeppelin, OpenZeppelin, OpenZeppelin Contracts, the OpenZeppelin team, and OpenZeppelin library. Many of these things have since been renamed and know that this audit applies to what is currently called the OpenZeppelin Contracts which are maintained by the OpenZeppelin Contracts Community.
March, 2017
Authored by Dennis Peterson and Peter Vessenes
@ -133,7 +131,7 @@ I presume that the goal of this contract is to allow and annotate a migration to
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 modifiers 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)`.
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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +0,0 @@
# Audits
| Date | Version | Commit | Auditor | Scope | Links |
| ------------ | ------- | --------- | ------------ | -------------------- | ----------------------------------------------------------- |
| October 2023 | v5.0.0 | `b5a3e69` | OpenZeppelin | v5.0 Changes | [🔗](./2023-10-v5.0.pdf) |
| May 2023 | v4.9.0 | `91df66c` | OpenZeppelin | v4.9 Changes | [🔗](./2023-05-v4.9.pdf) |
| October 2022 | v4.8.0 | `14f98db` | OpenZeppelin | ERC4626, Checkpoints | [🔗](./2022-10-ERC4626.pdf) [🔗](./2022-10-Checkpoints.pdf) |
| October 2018 | v2.0.0 | `dac5bcc` | LevelK | Everything | [🔗](./2018-10.pdf) |
| March 2017 | v1.0.4 | `9c5975a` | New Alchemy | Everything | [🔗](./2017-03.md) |
# Formal Verification
| Date | Version | Commit | Tool | Scope | Links |
| ------------ | ------- | --------- | ------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| May 2022 | v4.7.0 | `109778c` | Certora | Initializable, GovernorPreventLateQuorum, ERC1155Burnable, ERC1155Pausable, ERC1155Supply, ERC1155Holder, ERC1155Receiver | [🔗](../certora/reports/2022-05.pdf) |
| March 2022 | v4.4.0 | `4088540` | Certora | ERC20Votes, ERC20FlashMint, ERC20Wrapper, TimelockController, ERC721Votes, Votes, AccessControl, ERC1155 | [🔗](../certora/reports/2022-03.pdf) |
| October 2021 | v4.4.0 | `4088540` | Certora | Governor, GovernorCountingSimple, GovernorProposalThreshold, GovernorTimelockControl, GovernorVotes, GovernorVotesQuorumFraction | [🔗](../certora/reports/2021-10.pdf) |

1
certora/.gitignore vendored
View File

@ -1 +0,0 @@
patched

View File

@ -1,54 +0,0 @@
default: help
SRC := ../contracts
DST := patched
DIFF := diff
SRCS := $(shell find $(SRC) -type f)
DSTS := $(shell find $(DST) -type f)
DIFFS := $(shell find $(DIFF) -type f)
###############################################################################
# Apply all patches in the $DIFF folder to the $DST folder
apply: $(DST) $(patsubst $(DIFF)/%.patch,$(DST)/%,$(subst _,/,$(DIFFS)))
# Reset the $DST folder
$(DST): FORCE
@rm -rf $@
@cp -r $(SRC) $@
# Update a solidity file in the $DST directory using the corresponding patch
$(DST)/%.sol: FORCE
@echo Applying patch to $@
@patch -p0 -d $(DST) < $(patsubst $(DST)_%,$(DIFF)/%.patch,$(subst /,_,$@))
###############################################################################
# Record all difference between $SRC and $DST in patches
record: $(DIFF) $(patsubst %,$(DIFF)/%.patch,$(subst /,_,$(subst $(SRC)/,,$(SRCS)) $(subst $(DST)/,,$(DSTS))))
# Create the $DIFF folder
$(DIFF): FORCE
@rm -rf $@
@mkdir $@
# Create the patch file by comparing the source and the destination
$(DIFF)/%.patch: FORCE
@echo Generating patch $@
@diff -ruN \
$(patsubst $(DIFF)/%.patch,$(SRC)/%,$(subst _,/,$@)) \
$(patsubst $(DIFF)/%.patch,$(DST)/%,$(subst _,/,$@)) \
| sed 's+$(SRC)/++g' \
| sed 's+$(DST)/++g' \
> $@
@[ -s $@ ] || rm $@
###############################################################################
help:
@echo "usage:"
@echo " make apply: create $(DST) directory by applying the patches to $(SRC)"
@echo " make record: record the patches capturing the differences between $(SRC) and $(DST)"
@echo " make clean: remove all generated files (those ignored by git)"
clean:
git clean -fdX
FORCE: ;

View File

@ -1,60 +0,0 @@
# Running the certora verification tool
These instructions detail the process for running Certora Verification Tool on OpenZeppelin Contracts.
Documentation for CVT and the specification language are available [here](https://certora.atlassian.net/wiki/spaces/CPD/overview).
## Prerequisites
Follow the [Certora installation guide](https://docs.certora.com/en/latest/docs/user-guide/getting-started/install.html) in order to get the Certora Prover Package and the `solc` executable folder in your path.
> **Note**
> An API Key is required for local testing. Although the prover will run on a Github Actions' CI environment on selected Pull Requests.
## Running the verification
The Certora Verification Tool proves specs for contracts, which are defined by the `./specs.json` file along with their pre-configured options.
The verification script `./run.js` is used to submit verification jobs to the Certora Verification service.
You can run it from the root of the repository with the following command:
```bash
node certora/run.js [[CONTRACT_NAME:]SPEC_NAME] [OPTIONS...]
```
Where:
- `CONTRACT_NAME` matches the `contract` key in the `./spec.json` file and may be empty. It will run all matching contracts if not provided.
- `SPEC_NAME` refers to a `spec` key from the `./specs.json` file. It will run every spec if not provided.
- `OPTIONS` extend the [Certora Prover CLI options](https://docs.certora.com/en/latest/docs/prover/cli/options.html#certora-prover-cli-options) and will respect the preconfigured options in the `specs.json` file.
> **Note**
> A single spec may be configured to run for multiple contracts, whereas a single contract may run multiple specs.
Example usage:
```bash
node certora/run.js AccessControl # Run the AccessControl spec against every contract implementing it
```
## Adapting to changes in the contracts
Some of our rules require the code to be simplified in various ways. Our primary tool for performing these simplifications is to run verification on a contract that extends the original contracts and overrides some of the methods. These "harness" contracts can be found in the `certora/harness` directory.
This pattern does require some modifications to the original code: some methods need to be made virtual or public, for example. These changes are handled by applying a patch
to the code before verification by running:
```bash
make -C certora apply
```
Before running the `certora/run.js` script, it's required to apply the corresponding patches to the `contracts` directory, placing the output in the `certora/patched` directory. Then, the contracts are verified by running the verification for the `certora/patched` directory.
If the original contracts change, it is possible to create a conflict with the patch. In this case, the verify scripts will report an error message and output rejected changes in the `patched` directory. After merging the changes, run `make record` in the `certora` directory; this will regenerate the patch file, which can then be checked into git.
For more information about the `make` scripts available, run:
```bash
make -C certora help
```

View File

@ -1,97 +0,0 @@
--- access/manager/AccessManager.sol 2023-10-05 12:17:09.694051809 -0300
+++ access/manager/AccessManager.sol 2023-10-05 12:26:18.498688718 -0300
@@ -6,7 +6,6 @@
import {IAccessManaged} from "./IAccessManaged.sol";
import {Address} from "../../utils/Address.sol";
import {Context} from "../../utils/Context.sol";
-import {Multicall} from "../../utils/Multicall.sol";
import {Math} from "../../utils/math/Math.sol";
import {Time} from "../../utils/types/Time.sol";
@@ -57,7 +56,8 @@
* mindful of the danger associated with functions such as {{Ownable-renounceOwnership}} or
* {{AccessControl-renounceRole}}.
*/
-contract AccessManager is Context, Multicall, IAccessManager {
+// NOTE: The FV version of this contract doesn't include Multicall because CVL HAVOCs on any `delegatecall`.
+contract AccessManager is Context, IAccessManager {
using Time for *;
// Structure that stores the details for a target contract.
@@ -105,7 +105,7 @@
// Used to identify operations that are currently being executed via {execute}.
// This should be transient storage when supported by the EVM.
- bytes32 private _executionId;
+ bytes32 internal _executionId; // private → internal for FV
/**
* @dev Check that the caller is authorized to perform the operation, following the restrictions encoded in
@@ -253,6 +253,11 @@
_setGrantDelay(roleId, newDelay);
}
+ // Exposed for FV
+ function _getTargetAdminDelayFull(address target) internal view virtual returns (uint32, uint32, uint48) {
+ return _targets[target].adminDelay.getFull();
+ }
+
/**
* @dev Internal version of {grantRole} without access control. Returns true if the role was newly granted.
*
@@ -287,6 +292,11 @@
return newMember;
}
+ // Exposed for FV
+ function _getRoleGrantDelayFull(uint64 roleId) internal view virtual returns (uint32, uint32, uint48) {
+ return _roles[roleId].grantDelay.getFull();
+ }
+
/**
* @dev Internal version of {revokeRole} without access control. This logic is also used by {renounceRole}.
* Returns true if the role was previously granted.
@@ -586,7 +596,7 @@
/**
* @dev Check if the current call is authorized according to admin logic.
*/
- function _checkAuthorized() private {
+ function _checkAuthorized() internal virtual { // private → internal virtual for FV
address caller = _msgSender();
(bool immediate, uint32 delay) = _canCallSelf(caller, _msgData());
if (!immediate) {
@@ -609,7 +619,7 @@
*/
function _getAdminRestrictions(
bytes calldata data
- ) private view returns (bool restricted, uint64 roleAdminId, uint32 executionDelay) {
+ ) internal view returns (bool restricted, uint64 roleAdminId, uint32 executionDelay) { // private → internal for FV
if (data.length < 4) {
return (false, 0, 0);
}
@@ -662,7 +672,7 @@
address caller,
address target,
bytes calldata data
- ) private view returns (bool immediate, uint32 delay) {
+ ) internal view returns (bool immediate, uint32 delay) { // private → internal for FV
if (target == address(this)) {
return _canCallSelf(caller, data);
} else {
@@ -716,14 +726,14 @@
/**
* @dev Extracts the selector from calldata. Panics if data is not at least 4 bytes
*/
- function _checkSelector(bytes calldata data) private pure returns (bytes4) {
+ function _checkSelector(bytes calldata data) internal pure returns (bytes4) { // private → internal for FV
return bytes4(data[0:4]);
}
/**
* @dev Hashing function for execute protection
*/
- function _hashExecutionId(address target, bytes4 selector) private pure returns (bytes32) {
+ function _hashExecutionId(address target, bytes4 selector) internal pure returns (bytes32) { // private → internal for FV
return keccak256(abi.encode(target, selector));
}
}

View File

@ -1,46 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {AccessControlDefaultAdminRules} from "../patched/access/extensions/AccessControlDefaultAdminRules.sol";
contract AccessControlDefaultAdminRulesHarness is AccessControlDefaultAdminRules {
uint48 private _delayIncreaseWait;
constructor(
uint48 initialDelay,
address initialDefaultAdmin,
uint48 delayIncreaseWait
) AccessControlDefaultAdminRules(initialDelay, initialDefaultAdmin) {
_delayIncreaseWait = delayIncreaseWait;
}
// FV
function pendingDefaultAdmin_() external view returns (address) {
(address newAdmin, ) = pendingDefaultAdmin();
return newAdmin;
}
function pendingDefaultAdminSchedule_() external view returns (uint48) {
(, uint48 schedule) = pendingDefaultAdmin();
return schedule;
}
function pendingDelay_() external view returns (uint48) {
(uint48 newDelay, ) = pendingDefaultAdminDelay();
return newDelay;
}
function pendingDelaySchedule_() external view returns (uint48) {
(, uint48 schedule) = pendingDefaultAdminDelay();
return schedule;
}
function delayChangeWait_(uint48 newDelay) external view returns (uint48) {
return _delayChangeWait(newDelay);
}
// Overrides
function defaultAdminDelayIncreaseWait() public view override returns (uint48) {
return _delayIncreaseWait;
}
}

View File

@ -1,6 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {AccessControl} from "../patched/access/AccessControl.sol";
contract AccessControlHarness is AccessControl {}

View File

@ -1,58 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {DoubleEndedQueue} from "../patched/utils/structs/DoubleEndedQueue.sol";
contract DoubleEndedQueueHarness {
using DoubleEndedQueue for DoubleEndedQueue.Bytes32Deque;
DoubleEndedQueue.Bytes32Deque private _deque;
function pushFront(bytes32 value) external {
_deque.pushFront(value);
}
function pushBack(bytes32 value) external {
_deque.pushBack(value);
}
function popFront() external returns (bytes32 value) {
return _deque.popFront();
}
function popBack() external returns (bytes32 value) {
return _deque.popBack();
}
function clear() external {
_deque.clear();
}
function begin() external view returns (uint128) {
return _deque._begin;
}
function end() external view returns (uint128) {
return _deque._end;
}
function length() external view returns (uint256) {
return _deque.length();
}
function empty() external view returns (bool) {
return _deque.empty();
}
function front() external view returns (bytes32 value) {
return _deque.front();
}
function back() external view returns (bytes32 value) {
return _deque.back();
}
function at_(uint256 index) external view returns (bytes32 value) {
return _deque.at(index);
}
}

View File

@ -1,36 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "../patched/token/ERC20/ERC20.sol";
import "../patched/token/ERC20/extensions/ERC20Permit.sol";
import "../patched/token/ERC20/extensions/ERC20FlashMint.sol";
contract ERC20FlashMintHarness is ERC20, ERC20Permit, ERC20FlashMint {
uint256 someFee;
address someFeeReceiver;
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
function mint(address account, uint256 amount) external {
_mint(account, amount);
}
function burn(address account, uint256 amount) external {
_burn(account, amount);
}
// public accessor
function flashFeeReceiver() public view returns (address) {
return someFeeReceiver;
}
// internal hook
function _flashFee(address, uint256) internal view override returns (uint256) {
return someFee;
}
function _flashFeeReceiver() internal view override returns (address) {
return someFeeReceiver;
}
}

View File

@ -1,16 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ERC20Permit, ERC20} from "../patched/token/ERC20/extensions/ERC20Permit.sol";
contract ERC20PermitHarness is ERC20Permit {
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {}
function mint(address account, uint256 amount) external {
_mint(account, amount);
}
function burn(address account, uint256 amount) external {
_burn(account, amount);
}
}

View File

@ -1,34 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ERC20Permit} from "../patched/token/ERC20/extensions/ERC20Permit.sol";
import {ERC20Wrapper, IERC20, ERC20} from "../patched/token/ERC20/extensions/ERC20Wrapper.sol";
contract ERC20WrapperHarness is ERC20Permit, ERC20Wrapper {
constructor(
IERC20 _underlying,
string memory _name,
string memory _symbol
) ERC20(_name, _symbol) ERC20Permit(_name) ERC20Wrapper(_underlying) {}
function underlyingTotalSupply() public view returns (uint256) {
return underlying().totalSupply();
}
function underlyingBalanceOf(address account) public view returns (uint256) {
return underlying().balanceOf(account);
}
function underlyingAllowanceToThis(address account) public view returns (uint256) {
return underlying().allowance(account, address(this));
}
function recover(address account) public returns (uint256) {
return _recover(account);
}
function decimals() public view override(ERC20Wrapper, ERC20) returns (uint8) {
return super.decimals();
}
}

View File

@ -1,13 +0,0 @@
// SPDX-License-Identifier: MIT
import {IERC3156FlashBorrower} from "../patched/interfaces/IERC3156FlashBorrower.sol";
pragma solidity ^0.8.20;
contract ERC3156FlashBorrowerHarness is IERC3156FlashBorrower {
bytes32 somethingToReturn;
function onFlashLoan(address, address, uint256, uint256, bytes calldata) external view override returns (bytes32) {
return somethingToReturn;
}
}

View File

@ -1,33 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ERC721} from "../patched/token/ERC721/ERC721.sol";
contract ERC721Harness is ERC721 {
constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
function mint(address account, uint256 tokenId) external {
_mint(account, tokenId);
}
function safeMint(address to, uint256 tokenId) external {
_safeMint(to, tokenId);
}
function safeMint(address to, uint256 tokenId, bytes memory data) external {
_safeMint(to, tokenId, data);
}
function burn(uint256 tokenId) external {
_burn(tokenId);
}
function unsafeOwnerOf(uint256 tokenId) external view returns (address) {
return _ownerOf(tokenId);
}
function unsafeGetApproved(uint256 tokenId) external view returns (address) {
return _getApproved(tokenId);
}
}

View File

@ -1,11 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "../patched/interfaces/IERC721Receiver.sol";
contract ERC721ReceiverHarness is IERC721Receiver {
function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {
return this.onERC721Received.selector;
}
}

View File

@ -1,55 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {EnumerableMap} from "../patched/utils/structs/EnumerableMap.sol";
contract EnumerableMapHarness {
using EnumerableMap for EnumerableMap.Bytes32ToBytes32Map;
EnumerableMap.Bytes32ToBytes32Map private _map;
function set(bytes32 key, bytes32 value) public returns (bool) {
return _map.set(key, value);
}
function remove(bytes32 key) public returns (bool) {
return _map.remove(key);
}
function contains(bytes32 key) public view returns (bool) {
return _map.contains(key);
}
function length() public view returns (uint256) {
return _map.length();
}
function key_at(uint256 index) public view returns (bytes32) {
(bytes32 key,) = _map.at(index);
return key;
}
function value_at(uint256 index) public view returns (bytes32) {
(,bytes32 value) = _map.at(index);
return value;
}
function tryGet_contains(bytes32 key) public view returns (bool) {
(bool contained,) = _map.tryGet(key);
return contained;
}
function tryGet_value(bytes32 key) public view returns (bytes32) {
(,bytes32 value) = _map.tryGet(key);
return value;
}
function get(bytes32 key) public view returns (bytes32) {
return _map.get(key);
}
function _indexOf(bytes32 key) public view returns (uint256) {
return _map._keys._inner._indexes[key];
}
}

View File

@ -1,35 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {EnumerableSet} from "../patched/utils/structs/EnumerableSet.sol";
contract EnumerableSetHarness {
using EnumerableSet for EnumerableSet.Bytes32Set;
EnumerableSet.Bytes32Set private _set;
function add(bytes32 value) public returns (bool) {
return _set.add(value);
}
function remove(bytes32 value) public returns (bool) {
return _set.remove(value);
}
function contains(bytes32 value) public view returns (bool) {
return _set.contains(value);
}
function length() public view returns (uint256) {
return _set.length();
}
function at_(uint256 index) public view returns (bytes32) {
return _set.at(index);
}
function _indexOf(bytes32 value) public view returns (uint256) {
return _set._inner._indexes[value];
}
}

View File

@ -1,23 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Initializable} from "../patched/proxy/utils/Initializable.sol";
contract InitializableHarness is Initializable {
function initialize() public initializer {}
function reinitialize(uint64 n) public reinitializer(n) {}
function disable() public { _disableInitializers(); }
function nested_init_init() public initializer { initialize(); }
function nested_init_reinit(uint64 m) public initializer { reinitialize(m); }
function nested_reinit_init(uint64 n) public reinitializer(n) { initialize(); }
function nested_reinit_reinit(uint64 n, uint64 m) public reinitializer(n) { reinitialize(m); }
function version() public view returns (uint64) {
return _getInitializedVersion();
}
function initializing() public view returns (bool) {
return _isInitializing();
}
}

View File

@ -1,10 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Ownable2Step, Ownable} from "../patched/access/Ownable2Step.sol";
contract Ownable2StepHarness is Ownable2Step {
constructor(address initialOwner) Ownable(initialOwner) {}
function restricted() external onlyOwner {}
}

View File

@ -1,10 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Ownable} from "../patched/access/Ownable.sol";
contract OwnableHarness is Ownable {
constructor(address initialOwner) Ownable(initialOwner) {}
function restricted() external onlyOwner {}
}

View File

@ -1,18 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Pausable} from "../patched/utils/Pausable.sol";
contract PausableHarness is Pausable {
function pause() external {
_pause();
}
function unpause() external {
_unpause();
}
function onlyWhenPaused() external whenPaused {}
function onlyWhenNotPaused() external whenNotPaused {}
}

View File

@ -1,13 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {TimelockController} from "../patched/governance/TimelockController.sol";
contract TimelockControllerHarness is TimelockController {
constructor(
uint256 minDelay,
address[] memory proposers,
address[] memory executors,
address admin
) TimelockController(minDelay, proposers, executors, admin) {}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,160 +0,0 @@
#!/usr/bin/env node
// USAGE:
// node certora/run.js [[CONTRACT_NAME:]SPEC_NAME]* [--all] [--options OPTIONS...] [--specs PATH]
// EXAMPLES:
// node certora/run.js --all
// node certora/run.js AccessControl
// node certora/run.js AccessControlHarness:AccessControl
const proc = require('child_process');
const { PassThrough } = require('stream');
const events = require('events');
const argv = require('yargs')
.env('')
.options({
all: {
alias: 'a',
type: 'boolean',
},
spec: {
alias: 's',
type: 'string',
default: __dirname + '/specs.json',
},
parallel: {
alias: 'p',
type: 'number',
default: 4,
},
verbose: {
alias: 'v',
type: 'count',
default: 0,
},
options: {
alias: 'o',
type: 'array',
default: [],
},
}).argv;
function match(entry, request) {
const [reqSpec, reqContract] = request.split(':').reverse();
return entry.spec == reqSpec && (!reqContract || entry.contract == reqContract);
}
const specs = require(argv.spec).filter(s => argv.all || argv._.some(r => match(s, r)));
const limit = require('p-limit')(argv.parallel);
if (argv._.length == 0 && !argv.all) {
console.error(`Warning: No specs requested. Did you forgot to toggle '--all'?`);
}
for (const r of argv._) {
if (!specs.some(s => match(s, r))) {
console.error(`Error: Requested spec '${r}' not found in ${argv.spec}`);
process.exitCode = 1;
}
}
if (process.exitCode) {
process.exit(process.exitCode);
}
for (const { spec, contract, files, options = [] } of specs) {
limit(
runCertora,
spec,
contract,
files,
[...options, ...argv.options].flatMap(opt => opt.split(' ')),
);
}
// Run certora, aggregate the output and print it at the end
async function runCertora(spec, contract, files, options = []) {
const args = [...files, '--verify', `${contract}:certora/specs/${spec}.spec`, ...options];
if (argv.verbose) {
console.log('Running:', args.join(' '));
}
const child = proc.spawn('certoraRun', args);
const stream = new PassThrough();
const output = collect(stream);
child.stdout.pipe(stream, { end: false });
child.stderr.pipe(stream, { end: false });
// as soon as we have a job id, print the output link
stream.on('data', function logStatusUrl(data) {
const { '-DjobId': jobId, '-DuserId': userId } = Object.fromEntries(
data
.toString('utf8')
.match(/-D\S+=\S+/g)
?.map(s => s.split('=')) || [],
);
if (jobId && userId) {
console.error(`[${spec}] https://prover.certora.com/output/${userId}/${jobId}/`);
stream.off('data', logStatusUrl);
}
});
// wait for process end
const [code, signal] = await events.once(child, 'exit');
// error
if (code || signal) {
console.error(`[${spec}] Exited with code ${code || signal}`);
process.exitCode = 1;
}
// get all output
stream.end();
// write results in markdown format
writeEntry(spec, contract, code || signal, (await output).match(/https:\/\/prover.certora.com\/output\/\S*/)?.[0]);
// write all details
console.error(`+ certoraRun ${args.join(' ')}\n` + (await output));
}
// Collects stream data into a string
async function collect(stream) {
const buffers = [];
for await (const data of stream) {
const buf = Buffer.isBuffer(data) ? data : Buffer.from(data);
buffers.push(buf);
}
return Buffer.concat(buffers).toString('utf8');
}
// Formatting
let hasHeader = false;
function formatRow(...array) {
return ['', ...array, ''].join(' | ');
}
function writeHeader() {
console.log(formatRow('spec', 'contract', 'result', 'status', 'output'));
console.log(formatRow('-', '-', '-', '-', '-'));
}
function writeEntry(spec, contract, success, url) {
if (!hasHeader) {
hasHeader = true;
writeHeader();
}
console.log(
formatRow(
spec,
contract,
success ? ':x:' : ':heavy_check_mark:',
url ? `[link](${url?.replace('/output/', '/jobStatus/')})` : 'error',
url ? `[link](${url})` : 'error',
),
);
}

View File

@ -1,86 +0,0 @@
[
{
"spec": "Pausable",
"contract": "PausableHarness",
"files": ["certora/harnesses/PausableHarness.sol"]
},
{
"spec": "AccessControl",
"contract": "AccessControlHarness",
"files": ["certora/harnesses/AccessControlHarness.sol"]
},
{
"spec": "AccessControlDefaultAdminRules",
"contract": "AccessControlDefaultAdminRulesHarness",
"files": ["certora/harnesses/AccessControlDefaultAdminRulesHarness.sol"]
},
{
"spec": "DoubleEndedQueue",
"contract": "DoubleEndedQueueHarness",
"files": ["certora/harnesses/DoubleEndedQueueHarness.sol"]
},
{
"spec": "Ownable",
"contract": "OwnableHarness",
"files": ["certora/harnesses/OwnableHarness.sol"]
},
{
"spec": "Ownable2Step",
"contract": "Ownable2StepHarness",
"files": ["certora/harnesses/Ownable2StepHarness.sol"]
},
{
"spec": "ERC20",
"contract": "ERC20PermitHarness",
"files": ["certora/harnesses/ERC20PermitHarness.sol"],
"options": ["--optimistic_loop"]
},
{
"spec": "ERC20FlashMint",
"contract": "ERC20FlashMintHarness",
"files": [
"certora/harnesses/ERC20FlashMintHarness.sol",
"certora/harnesses/ERC3156FlashBorrowerHarness.sol"
],
"options": ["--optimistic_loop"]
},
{
"spec": "ERC20Wrapper",
"contract": "ERC20WrapperHarness",
"files": [
"certora/harnesses/ERC20PermitHarness.sol",
"certora/harnesses/ERC20WrapperHarness.sol"
],
"options": [
"--link ERC20WrapperHarness:_underlying=ERC20PermitHarness",
"--optimistic_loop"
]
},
{
"spec": "ERC721",
"contract": "ERC721Harness",
"files": ["certora/harnesses/ERC721Harness.sol", "certora/harnesses/ERC721ReceiverHarness.sol"],
"options": ["--optimistic_loop"]
},
{
"spec": "Initializable",
"contract": "InitializableHarness",
"files": ["certora/harnesses/InitializableHarness.sol"]
},
{
"spec": "EnumerableSet",
"contract": "EnumerableSetHarness",
"files": ["certora/harnesses/EnumerableSetHarness.sol"]
},
{
"spec": "EnumerableMap",
"contract": "EnumerableMapHarness",
"files": ["certora/harnesses/EnumerableMapHarness.sol"]
},
{
"spec": "TimelockController",
"contract": "TimelockControllerHarness",
"files": ["certora/harnesses/TimelockControllerHarness.sol"],
"options": ["--optimistic_hashing", "--optimistic_loop"]
}
]

View File

@ -1,119 +0,0 @@
import "helpers/helpers.spec";
import "methods/IAccessControl.spec";
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Identify entrypoints: only grantRole, revokeRole and renounceRole can alter permissions
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyGrantCanGrant(env e, method f, bytes32 role, address account) {
calldataarg args;
bool hasRoleBefore = hasRole(role, account);
f(e, args);
bool hasRoleAfter = hasRole(role, account);
assert (
!hasRoleBefore &&
hasRoleAfter
) => (
f.selector == sig:grantRole(bytes32, address).selector
);
assert (
hasRoleBefore &&
!hasRoleAfter
) => (
f.selector == sig:revokeRole(bytes32, address).selector ||
f.selector == sig:renounceRole(bytes32, address).selector
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: grantRole only affects the specified user/role combo
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule grantRoleEffect(env e, bytes32 role) {
require nonpayable(e);
bytes32 otherRole;
address account;
address otherAccount;
bool isCallerAdmin = hasRole(getRoleAdmin(role), e.msg.sender);
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
grantRole@withrevert(e, role, account);
bool success = !lastReverted;
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
// liveness
assert success <=> isCallerAdmin;
// effect
assert success => hasRole(role, account);
// no side effect
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: revokeRole only affects the specified user/role combo
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule revokeRoleEffect(env e, bytes32 role) {
require nonpayable(e);
bytes32 otherRole;
address account;
address otherAccount;
bool isCallerAdmin = hasRole(getRoleAdmin(role), e.msg.sender);
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
revokeRole@withrevert(e, role, account);
bool success = !lastReverted;
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
// liveness
assert success <=> isCallerAdmin;
// effect
assert success => !hasRole(role, account);
// no side effect
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: renounceRole only affects the specified user/role combo
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule renounceRoleEffect(env e, bytes32 role) {
require nonpayable(e);
bytes32 otherRole;
address account;
address otherAccount;
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
renounceRole@withrevert(e, role, account);
bool success = !lastReverted;
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
// liveness
assert success <=> account == e.msg.sender;
// effect
assert success => !hasRole(role, account);
// no side effect
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount);
}

View File

@ -1,464 +0,0 @@
import "helpers/helpers.spec";
import "methods/IAccessControlDefaultAdminRules.spec";
import "methods/IAccessControl.spec";
import "AccessControl.spec";
use rule onlyGrantCanGrant filtered {
f -> f.selector != sig:acceptDefaultAdminTransfer().selector
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Definitions
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
definition timeSanity(env e) returns bool =
e.block.timestamp > 0 && e.block.timestamp + defaultAdminDelay(e) < max_uint48;
definition delayChangeWaitSanity(env e, uint48 newDelay) returns bool =
e.block.timestamp + delayChangeWait_(e, newDelay) < max_uint48;
definition isSet(uint48 schedule) returns bool =
schedule != 0;
definition hasPassed(env e, uint48 schedule) returns bool =
assert_uint256(schedule) < e.block.timestamp;
definition increasingDelaySchedule(env e, uint48 newDelay) returns mathint =
e.block.timestamp + min(newDelay, defaultAdminDelayIncreaseWait());
definition decreasingDelaySchedule(env e, uint48 newDelay) returns mathint =
e.block.timestamp + defaultAdminDelay(e) - newDelay;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: defaultAdmin holds the DEFAULT_ADMIN_ROLE
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant defaultAdminConsistency(address account)
(account == defaultAdmin() && account != 0) <=> hasRole(DEFAULT_ADMIN_ROLE(), account)
{
preserved with (env e) {
require nonzerosender(e);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: Only one account holds the DEFAULT_ADMIN_ROLE
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant singleDefaultAdmin(address account, address another)
hasRole(DEFAULT_ADMIN_ROLE(), account) && hasRole(DEFAULT_ADMIN_ROLE(), another) => another == account
{
preserved {
requireInvariant defaultAdminConsistency(account);
requireInvariant defaultAdminConsistency(another);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: DEFAULT_ADMIN_ROLE's admin is always DEFAULT_ADMIN_ROLE
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant defaultAdminRoleAdminConsistency()
getRoleAdmin(DEFAULT_ADMIN_ROLE()) == DEFAULT_ADMIN_ROLE();
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: owner is the defaultAdmin
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant ownerConsistency()
defaultAdmin() == owner();
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: revokeRole only affects the specified user/role combo
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule revokeRoleEffect(env e, bytes32 role) {
require nonpayable(e);
bytes32 otherRole;
address account;
address otherAccount;
bool isCallerAdmin = hasRole(getRoleAdmin(role), e.msg.sender);
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
revokeRole@withrevert(e, role, account);
bool success = !lastReverted;
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
// liveness
assert success <=> isCallerAdmin && role != DEFAULT_ADMIN_ROLE(),
"roles can only be revoked by their owner except for the default admin role";
// effect
assert success => !hasRole(role, account),
"role is revoked";
// no side effect
assert hasOtherRoleBefore != hasOtherRoleAfter => (role == otherRole && account == otherAccount),
"no other role is affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: renounceRole only affects the specified user/role combo
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule renounceRoleEffect(env e, bytes32 role) {
require nonpayable(e);
bytes32 otherRole;
address account;
address otherAccount;
bool hasOtherRoleBefore = hasRole(otherRole, otherAccount);
address adminBefore = defaultAdmin();
address pendingAdminBefore = pendingDefaultAdmin_();
uint48 scheduleBefore = pendingDefaultAdminSchedule_();
renounceRole@withrevert(e, role, account);
bool success = !lastReverted;
bool hasOtherRoleAfter = hasRole(otherRole, otherAccount);
address adminAfter = defaultAdmin();
address pendingAdminAfter = pendingDefaultAdmin_();
uint48 scheduleAfter = pendingDefaultAdminSchedule_();
// liveness
assert success <=> (
account == e.msg.sender &&
(
role != DEFAULT_ADMIN_ROLE() ||
account != adminBefore ||
(
pendingAdminBefore == 0 &&
isSet(scheduleBefore) &&
hasPassed(e, scheduleBefore)
)
)
),
"an account only can renounce by itself with a delay for the default admin role";
// effect
assert success => !hasRole(role, account),
"role is renounced";
assert success => (
(
role == DEFAULT_ADMIN_ROLE() &&
account == adminBefore
) ? (
adminAfter == 0 &&
pendingAdminAfter == 0 &&
scheduleAfter == 0
) : (
adminAfter == adminBefore &&
pendingAdminAfter == pendingAdminBefore &&
scheduleAfter == scheduleBefore
)
),
"renouncing default admin role cleans state iff called by previous admin";
// no side effect
assert hasOtherRoleBefore != hasOtherRoleAfter => (
role == otherRole &&
account == otherAccount
),
"no other role is affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: defaultAdmin is only affected by accepting an admin transfer or renoucing
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noDefaultAdminChange(env e, method f, calldataarg args) {
address adminBefore = defaultAdmin();
f(e, args);
address adminAfter = defaultAdmin();
assert adminBefore != adminAfter => (
f.selector == sig:acceptDefaultAdminTransfer().selector ||
f.selector == sig:renounceRole(bytes32,address).selector
),
"default admin is only affected by accepting an admin transfer or renoucing";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: pendingDefaultAdmin is only affected by beginning, completing (accept or renounce), or canceling an admin
transfer
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noPendingDefaultAdminChange(env e, method f, calldataarg args) {
address pendingAdminBefore = pendingDefaultAdmin_();
uint48 scheduleBefore = pendingDefaultAdminSchedule_();
f(e, args);
address pendingAdminAfter = pendingDefaultAdmin_();
uint48 scheduleAfter = pendingDefaultAdminSchedule_();
assert (
pendingAdminBefore != pendingAdminAfter ||
scheduleBefore != scheduleAfter
) => (
f.selector == sig:beginDefaultAdminTransfer(address).selector ||
f.selector == sig:acceptDefaultAdminTransfer().selector ||
f.selector == sig:cancelDefaultAdminTransfer().selector ||
f.selector == sig:renounceRole(bytes32,address).selector
),
"pending admin and its schedule is only affected by beginning, completing, or cancelling an admin transfer";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: defaultAdminDelay can't be changed atomically by any function
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noDefaultAdminDelayChange(env e, method f, calldataarg args) {
uint48 delayBefore = defaultAdminDelay(e);
f(e, args);
uint48 delayAfter = defaultAdminDelay(e);
assert delayBefore == delayAfter,
"delay can't be changed atomically by any function";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: pendingDefaultAdminDelay is only affected by changeDefaultAdminDelay or rollbackDefaultAdminDelay
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noPendingDefaultAdminDelayChange(env e, method f, calldataarg args) {
uint48 pendingDelayBefore = pendingDelay_(e);
f(e, args);
uint48 pendingDelayAfter = pendingDelay_(e);
assert pendingDelayBefore != pendingDelayAfter => (
f.selector == sig:changeDefaultAdminDelay(uint48).selector ||
f.selector == sig:rollbackDefaultAdminDelay().selector
),
"pending delay is only affected by changeDefaultAdminDelay or rollbackDefaultAdminDelay";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: defaultAdminDelayIncreaseWait can't be changed atomically by any function
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noDefaultAdminDelayIncreaseWaitChange(env e, method f, calldataarg args) {
uint48 delayIncreaseWaitBefore = defaultAdminDelayIncreaseWait();
f(e, args);
uint48 delayIncreaseWaitAfter = defaultAdminDelayIncreaseWait();
assert delayIncreaseWaitBefore == delayIncreaseWaitAfter,
"delay increase wait can't be changed atomically by any function";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: beginDefaultAdminTransfer sets a pending default admin and its schedule
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule beginDefaultAdminTransfer(env e, address newAdmin) {
require timeSanity(e);
require nonpayable(e);
require nonzerosender(e);
requireInvariant defaultAdminConsistency(e.msg.sender);
beginDefaultAdminTransfer@withrevert(e, newAdmin);
bool success = !lastReverted;
// liveness
assert success <=> e.msg.sender == defaultAdmin(),
"only the current default admin can begin a transfer";
// effect
assert success => pendingDefaultAdmin_() == newAdmin,
"pending default admin is set";
assert success => to_mathint(pendingDefaultAdminSchedule_()) == e.block.timestamp + defaultAdminDelay(e),
"pending default admin delay is set";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: A default admin can't change in less than the applied schedule
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pendingDefaultAdminDelayEnforced(env e1, env e2, method f, calldataarg args, address newAdmin) {
require e1.block.timestamp <= e2.block.timestamp;
uint48 delayBefore = defaultAdminDelay(e1);
address adminBefore = defaultAdmin();
// There might be a better way to generalize this without requiring `beginDefaultAdminTransfer`, but currently
// it's the only way in which we can attest that only `delayBefore` has passed before a change.
beginDefaultAdminTransfer(e1, newAdmin);
f(e2, args);
address adminAfter = defaultAdmin();
// change can only happen towards the newAdmin, with the delay
assert adminAfter != adminBefore => (
adminAfter == newAdmin &&
to_mathint(e2.block.timestamp) >= e1.block.timestamp + delayBefore
),
"The admin can only change after the enforced delay and to the previously scheduled new admin";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: acceptDefaultAdminTransfer updates defaultAdmin resetting the pending admin and its schedule
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule acceptDefaultAdminTransfer(env e) {
require nonpayable(e);
address pendingAdminBefore = pendingDefaultAdmin_();
uint48 scheduleBefore = pendingDefaultAdminSchedule_();
acceptDefaultAdminTransfer@withrevert(e);
bool success = !lastReverted;
// liveness
assert success <=> (
e.msg.sender == pendingAdminBefore &&
isSet(scheduleBefore) &&
hasPassed(e, scheduleBefore)
),
"only the pending default admin can accept the role after the schedule has been set and passed";
// effect
assert success => defaultAdmin() == pendingAdminBefore,
"Default admin is set to the previous pending default admin";
assert success => pendingDefaultAdmin_() == 0,
"Pending default admin is reset";
assert success => pendingDefaultAdminSchedule_() == 0,
"Pending default admin delay is reset";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: cancelDefaultAdminTransfer resets pending default admin and its schedule
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule cancelDefaultAdminTransfer(env e) {
require nonpayable(e);
require nonzerosender(e);
requireInvariant defaultAdminConsistency(e.msg.sender);
cancelDefaultAdminTransfer@withrevert(e);
bool success = !lastReverted;
// liveness
assert success <=> e.msg.sender == defaultAdmin(),
"only the current default admin can cancel a transfer";
// effect
assert success => pendingDefaultAdmin_() == 0,
"Pending default admin is reset";
assert success => pendingDefaultAdminSchedule_() == 0,
"Pending default admin delay is reset";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: changeDefaultAdminDelay sets a pending default admin delay and its schedule
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule changeDefaultAdminDelay(env e, uint48 newDelay) {
require timeSanity(e);
require nonpayable(e);
require nonzerosender(e);
require delayChangeWaitSanity(e, newDelay);
requireInvariant defaultAdminConsistency(e.msg.sender);
uint48 delayBefore = defaultAdminDelay(e);
changeDefaultAdminDelay@withrevert(e, newDelay);
bool success = !lastReverted;
// liveness
assert success <=> e.msg.sender == defaultAdmin(),
"only the current default admin can begin a delay change";
// effect
assert success => pendingDelay_(e) == newDelay,
"pending delay is set";
assert success => (
assert_uint256(pendingDelaySchedule_(e)) > e.block.timestamp ||
delayBefore == newDelay || // Interpreted as decreasing, x - x = 0
defaultAdminDelayIncreaseWait() == 0
),
"pending delay schedule is set in the future unless accepted edge cases";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: A delay can't change in less than the applied schedule
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pendingDelayWaitEnforced(env e1, env e2, method f, calldataarg args, uint48 newDelay) {
require e1.block.timestamp <= e2.block.timestamp;
uint48 delayBefore = defaultAdminDelay(e1);
changeDefaultAdminDelay(e1, newDelay);
f(e2, args);
uint48 delayAfter = defaultAdminDelay(e2);
mathint delayWait = newDelay > delayBefore ? increasingDelaySchedule(e1, newDelay) : decreasingDelaySchedule(e1, newDelay);
assert delayAfter != delayBefore => (
delayAfter == newDelay &&
to_mathint(e2.block.timestamp) >= delayWait
),
"A delay can only change after the applied schedule";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: pending delay wait is set depending on increasing or decreasing the delay
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pendingDelayWait(env e, uint48 newDelay) {
uint48 oldDelay = defaultAdminDelay(e);
changeDefaultAdminDelay(e, newDelay);
assert newDelay > oldDelay => to_mathint(pendingDelaySchedule_(e)) == increasingDelaySchedule(e, newDelay),
"Delay wait is the minimum between the new delay and a threshold when the delay is increased";
assert newDelay <= oldDelay => to_mathint(pendingDelaySchedule_(e)) == decreasingDelaySchedule(e, newDelay),
"Delay wait is the difference between the current and the new delay when the delay is decreased";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: rollbackDefaultAdminDelay resets the delay and its schedule
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule rollbackDefaultAdminDelay(env e) {
require nonpayable(e);
require nonzerosender(e);
requireInvariant defaultAdminConsistency(e.msg.sender);
rollbackDefaultAdminDelay@withrevert(e);
bool success = !lastReverted;
// liveness
assert success <=> e.msg.sender == defaultAdmin(),
"only the current default admin can rollback a delay change";
// effect
assert success => pendingDelay_(e) == 0,
"Pending default admin is reset";
assert success => pendingDelaySchedule_(e) == 0,
"Pending default admin delay is reset";
}

View File

@ -1,300 +0,0 @@
import "helpers/helpers.spec";
methods {
function pushFront(bytes32) external envfree;
function pushBack(bytes32) external envfree;
function popFront() external returns (bytes32) envfree;
function popBack() external returns (bytes32) envfree;
function clear() external envfree;
// exposed for FV
function begin() external returns (uint128) envfree;
function end() external returns (uint128) envfree;
// view
function length() external returns (uint256) envfree;
function empty() external returns (bool) envfree;
function front() external returns (bytes32) envfree;
function back() external returns (bytes32) envfree;
function at_(uint256) external returns (bytes32) envfree; // at is a reserved word
}
definition full() returns bool = length() == max_uint128;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: empty() is length 0 and no element exists
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant emptiness()
empty() <=> length() == 0
filtered { f -> !f.isView }
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: front points to the first index and back points to the last one
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant queueFront()
at_(0) == front()
filtered { f -> !f.isView }
invariant queueBack()
at_(require_uint256(length() - 1)) == back()
filtered { f -> !f.isView }
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: pushFront adds an element at the beginning of the queue
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pushFront(bytes32 value) {
uint256 lengthBefore = length();
bool fullBefore = full();
pushFront@withrevert(value);
bool success = !lastReverted;
// liveness
assert success <=> !fullBefore, "never revert if not previously full";
// effect
assert success => front() == value, "front set to value";
assert success => to_mathint(length()) == lengthBefore + 1, "queue extended";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: pushFront preserves the previous values in the queue with a +1 offset
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pushFrontConsistency(uint256 index) {
bytes32 beforeAt = at_(index);
bytes32 value;
pushFront(value);
// try to read value
bytes32 afterAt = at_@withrevert(require_uint256(index + 1));
assert !lastReverted, "value still there";
assert afterAt == beforeAt, "data is preserved";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: pushBack adds an element at the end of the queue
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pushBack(bytes32 value) {
uint256 lengthBefore = length();
bool fullBefore = full();
pushBack@withrevert(value);
bool success = !lastReverted;
// liveness
assert success <=> !fullBefore, "never revert if not previously full";
// effect
assert success => back() == value, "back set to value";
assert success => to_mathint(length()) == lengthBefore + 1, "queue increased";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: pushBack preserves the previous values in the queue
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pushBackConsistency(uint256 index) {
bytes32 beforeAt = at_(index);
bytes32 value;
pushBack(value);
// try to read value
bytes32 afterAt = at_@withrevert(index);
assert !lastReverted, "value still there";
assert afterAt == beforeAt, "data is preserved";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: popFront removes an element from the beginning of the queue
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule popFront {
uint256 lengthBefore = length();
bytes32 frontBefore = front@withrevert();
bytes32 popped = popFront@withrevert();
bool success = !lastReverted;
// liveness
assert success <=> lengthBefore != 0, "never reverts if not previously empty";
// effect
assert success => frontBefore == popped, "previous front is returned";
assert success => to_mathint(length()) == lengthBefore - 1, "queue decreased";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: at(x) is preserved and offset to at(x - 1) after calling popFront |
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule popFrontConsistency(uint256 index) {
// Read (any) value that is not the front (this asserts the value exists / the queue is long enough)
require index > 1;
bytes32 before = at_(index);
popFront();
// try to read value
bytes32 after = at_@withrevert(require_uint256(index - 1));
assert !lastReverted, "value still exists in the queue";
assert before == after, "values are offset and not modified";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: popBack removes an element from the end of the queue
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule popBack {
uint256 lengthBefore = length();
bytes32 backBefore = back@withrevert();
bytes32 popped = popBack@withrevert();
bool success = !lastReverted;
// liveness
assert success <=> lengthBefore != 0, "never reverts if not previously empty";
// effect
assert success => backBefore == popped, "previous back is returned";
assert success => to_mathint(length()) == lengthBefore - 1, "queue decreased";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: at(x) is preserved after calling popBack |
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule popBackConsistency(uint256 index) {
// Read (any) value that is not the back (this asserts the value exists / the queue is long enough)
require to_mathint(index) < length() - 1;
bytes32 before = at_(index);
popBack();
// try to read value
bytes32 after = at_@withrevert(index);
assert !lastReverted, "value still exists in the queue";
assert before == after, "values are offset and not modified";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: clear sets length to 0
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule clear {
clear@withrevert();
// liveness
assert !lastReverted, "never reverts";
// effect
assert length() == 0, "sets length to 0";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: front/back access reverts only if the queue is empty or querying out of bounds
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyEmptyOrFullRevert(env e) {
require nonpayable(e);
method f;
calldataarg args;
bool emptyBefore = empty();
bool fullBefore = full();
f@withrevert(e, args);
assert lastReverted => (
(f.selector == sig:front().selector && emptyBefore) ||
(f.selector == sig:back().selector && emptyBefore) ||
(f.selector == sig:popFront().selector && emptyBefore) ||
(f.selector == sig:popBack().selector && emptyBefore) ||
(f.selector == sig:pushFront(bytes32).selector && fullBefore ) ||
(f.selector == sig:pushBack(bytes32).selector && fullBefore ) ||
f.selector == sig:at_(uint256).selector // revert conditions are verified in onlyOutOfBoundsRevert
), "only revert if empty or out of bounds";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: at(index) only reverts if index is out of bounds |
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyOutOfBoundsRevert(uint256 index) {
at_@withrevert(index);
assert lastReverted <=> index >= length(), "only reverts if index is out of bounds";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: only clear/push/pop operations can change the length of the queue
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noLengthChange(env e) {
method f;
calldataarg args;
uint256 lengthBefore = length();
f(e, args);
uint256 lengthAfter = length();
assert lengthAfter != lengthBefore => (
(f.selector == sig:pushFront(bytes32).selector && to_mathint(lengthAfter) == lengthBefore + 1) ||
(f.selector == sig:pushBack(bytes32).selector && to_mathint(lengthAfter) == lengthBefore + 1) ||
(f.selector == sig:popBack().selector && to_mathint(lengthAfter) == lengthBefore - 1) ||
(f.selector == sig:popFront().selector && to_mathint(lengthAfter) == lengthBefore - 1) ||
(f.selector == sig:clear().selector && lengthAfter == 0)
), "length is only affected by clear/pop/push operations";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: only push/pop can change values bounded in the queue (outside values aren't cleared)
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noDataChange(env e) {
method f;
calldataarg args;
uint256 index;
bytes32 atBefore = at_(index);
f(e, args);
bytes32 atAfter = at_@withrevert(index);
bool atAfterSuccess = !lastReverted;
assert !atAfterSuccess <=> (
(f.selector == sig:clear().selector ) ||
(f.selector == sig:popBack().selector && index == length()) ||
(f.selector == sig:popFront().selector && index == length())
), "indexes of the queue are only removed by clear or pop";
assert atAfterSuccess && atAfter != atBefore => (
f.selector == sig:popFront().selector ||
f.selector == sig:pushFront(bytes32).selector
), "values of the queue are only changed by popFront or pushFront";
}

View File

@ -1,352 +0,0 @@
import "helpers/helpers.spec";
import "methods/IERC20.spec";
import "methods/IERC2612.spec";
methods {
// exposed for FV
function mint(address,uint256) external;
function burn(address,uint256) external;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Ghost & hooks: sum of all balances
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
ghost mathint sumOfBalances {
init_state axiom sumOfBalances == 0;
}
// Because `balance` has a uint256 type, any balance addition in CVL1 behaved as a `require_uint256()` casting,
// leaving out the possibility of overflow. This is not the case in CVL2 where casting became more explicit.
// A counterexample in CVL2 is having an initial state where Alice initial balance is larger than totalSupply, which
// overflows Alice's balance when receiving a transfer. This is not possible unless the contract is deployed into an
// already used address (or upgraded from corrupted state).
// We restrict such behavior by making sure no balance is greater than the sum of balances.
hook Sload uint256 balance _balances[KEY address addr] STORAGE {
require sumOfBalances >= to_mathint(balance);
}
hook Sstore _balances[KEY address addr] uint256 newValue (uint256 oldValue) STORAGE {
sumOfBalances = sumOfBalances - oldValue + newValue;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: totalSupply is the sum of all balances
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant totalSupplyIsSumOfBalances()
to_mathint(totalSupply()) == sumOfBalances;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: balance of address(0) is 0
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant zeroAddressNoBalance()
balanceOf(0) == 0;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: only mint and burn can change total supply
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noChangeTotalSupply(env e) {
requireInvariant totalSupplyIsSumOfBalances();
method f;
calldataarg args;
uint256 totalSupplyBefore = totalSupply();
f(e, args);
uint256 totalSupplyAfter = totalSupply();
assert totalSupplyAfter > totalSupplyBefore => f.selector == sig:mint(address,uint256).selector;
assert totalSupplyAfter < totalSupplyBefore => f.selector == sig:burn(address,uint256).selector;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: only the token holder or an approved third party can reduce an account's balance
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyAuthorizedCanTransfer(env e) {
requireInvariant totalSupplyIsSumOfBalances();
method f;
calldataarg args;
address account;
uint256 allowanceBefore = allowance(account, e.msg.sender);
uint256 balanceBefore = balanceOf(account);
f(e, args);
uint256 balanceAfter = balanceOf(account);
assert (
balanceAfter < balanceBefore
) => (
f.selector == sig:burn(address,uint256).selector ||
e.msg.sender == account ||
balanceBefore - balanceAfter <= to_mathint(allowanceBefore)
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: only the token holder (or a permit) can increase allowance. The spender can decrease it by using it
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyHolderOfSpenderCanChangeAllowance(env e) {
requireInvariant totalSupplyIsSumOfBalances();
method f;
calldataarg args;
address holder;
address spender;
uint256 allowanceBefore = allowance(holder, spender);
f(e, args);
uint256 allowanceAfter = allowance(holder, spender);
assert (
allowanceAfter > allowanceBefore
) => (
(f.selector == sig:approve(address,uint256).selector && e.msg.sender == holder) ||
(f.selector == sig:permit(address,address,uint256,uint256,uint8,bytes32,bytes32).selector)
);
assert (
allowanceAfter < allowanceBefore
) => (
(f.selector == sig:transferFrom(address,address,uint256).selector && e.msg.sender == spender) ||
(f.selector == sig:approve(address,uint256).selector && e.msg.sender == holder ) ||
(f.selector == sig:permit(address,address,uint256,uint256,uint8,bytes32,bytes32).selector)
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: mint behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule mint(env e) {
requireInvariant totalSupplyIsSumOfBalances();
require nonpayable(e);
address to;
address other;
uint256 amount;
// cache state
uint256 toBalanceBefore = balanceOf(to);
uint256 otherBalanceBefore = balanceOf(other);
uint256 totalSupplyBefore = totalSupply();
// run transaction
mint@withrevert(e, to, amount);
// check outcome
if (lastReverted) {
assert to == 0 || totalSupplyBefore + amount > max_uint256;
} else {
// updates balance and totalSupply
assert to_mathint(balanceOf(to)) == toBalanceBefore + amount;
assert to_mathint(totalSupply()) == totalSupplyBefore + amount;
// no other balance is modified
assert balanceOf(other) != otherBalanceBefore => other == to;
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: burn behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule burn(env e) {
requireInvariant totalSupplyIsSumOfBalances();
require nonpayable(e);
address from;
address other;
uint256 amount;
// cache state
uint256 fromBalanceBefore = balanceOf(from);
uint256 otherBalanceBefore = balanceOf(other);
uint256 totalSupplyBefore = totalSupply();
// run transaction
burn@withrevert(e, from, amount);
// check outcome
if (lastReverted) {
assert from == 0 || fromBalanceBefore < amount;
} else {
// updates balance and totalSupply
assert to_mathint(balanceOf(from)) == fromBalanceBefore - amount;
assert to_mathint(totalSupply()) == totalSupplyBefore - amount;
// no other balance is modified
assert balanceOf(other) != otherBalanceBefore => other == from;
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: transfer behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule transfer(env e) {
requireInvariant totalSupplyIsSumOfBalances();
require nonpayable(e);
address holder = e.msg.sender;
address recipient;
address other;
uint256 amount;
// cache state
uint256 holderBalanceBefore = balanceOf(holder);
uint256 recipientBalanceBefore = balanceOf(recipient);
uint256 otherBalanceBefore = balanceOf(other);
// run transaction
transfer@withrevert(e, recipient, amount);
// check outcome
if (lastReverted) {
assert holder == 0 || recipient == 0 || amount > holderBalanceBefore;
} else {
// balances of holder and recipient are updated
assert to_mathint(balanceOf(holder)) == holderBalanceBefore - (holder == recipient ? 0 : amount);
assert to_mathint(balanceOf(recipient)) == recipientBalanceBefore + (holder == recipient ? 0 : amount);
// no other balance is modified
assert balanceOf(other) != otherBalanceBefore => (other == holder || other == recipient);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: transferFrom behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule transferFrom(env e) {
requireInvariant totalSupplyIsSumOfBalances();
require nonpayable(e);
address spender = e.msg.sender;
address holder;
address recipient;
address other;
uint256 amount;
// cache state
uint256 allowanceBefore = allowance(holder, spender);
uint256 holderBalanceBefore = balanceOf(holder);
uint256 recipientBalanceBefore = balanceOf(recipient);
uint256 otherBalanceBefore = balanceOf(other);
// run transaction
transferFrom@withrevert(e, holder, recipient, amount);
// check outcome
if (lastReverted) {
assert holder == 0 || recipient == 0 || spender == 0 || amount > holderBalanceBefore || amount > allowanceBefore;
} else {
// allowance is valid & updated
assert allowanceBefore >= amount;
assert to_mathint(allowance(holder, spender)) == (allowanceBefore == max_uint256 ? max_uint256 : allowanceBefore - amount);
// balances of holder and recipient are updated
assert to_mathint(balanceOf(holder)) == holderBalanceBefore - (holder == recipient ? 0 : amount);
assert to_mathint(balanceOf(recipient)) == recipientBalanceBefore + (holder == recipient ? 0 : amount);
// no other balance is modified
assert balanceOf(other) != otherBalanceBefore => (other == holder || other == recipient);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: approve behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule approve(env e) {
require nonpayable(e);
address holder = e.msg.sender;
address spender;
address otherHolder;
address otherSpender;
uint256 amount;
// cache state
uint256 otherAllowanceBefore = allowance(otherHolder, otherSpender);
// run transaction
approve@withrevert(e, spender, amount);
// check outcome
if (lastReverted) {
assert holder == 0 || spender == 0;
} else {
// allowance is updated
assert allowance(holder, spender) == amount;
// other allowances are untouched
assert allowance(otherHolder, otherSpender) != otherAllowanceBefore => (otherHolder == holder && otherSpender == spender);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: permit behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule permit(env e) {
require nonpayable(e);
address holder;
address spender;
uint256 amount;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
address account1;
address account2;
address account3;
// cache state
uint256 nonceBefore = nonces(holder);
uint256 otherNonceBefore = nonces(account1);
uint256 otherAllowanceBefore = allowance(account2, account3);
// sanity: nonce overflow, which possible in theory, is assumed to be impossible in practice
require nonceBefore < max_uint256;
require otherNonceBefore < max_uint256;
// run transaction
permit@withrevert(e, holder, spender, amount, deadline, v, r, s);
// check outcome
if (lastReverted) {
// Without formally checking the signature, we can't verify exactly the revert causes
assert true;
} else {
// allowance and nonce are updated
assert allowance(holder, spender) == amount;
assert to_mathint(nonces(holder)) == nonceBefore + 1;
// deadline was respected
assert deadline >= e.block.timestamp;
// no other allowance or nonce is modified
assert nonces(account1) != otherNonceBefore => account1 == holder;
assert allowance(account2, account3) != otherAllowanceBefore => (account2 == holder && account3 == spender);
}
}

View File

@ -1,55 +0,0 @@
import "helpers/helpers.spec";
import "methods/IERC20.spec";
import "methods/IERC3156FlashLender.spec";
import "methods/IERC3156FlashBorrower.spec";
methods {
// non standard ERC3156 functions
function flashFeeReceiver() external returns (address) envfree;
// function summaries below
function _._update(address from, address to, uint256 amount) internal => specUpdate(from, to, amount) expect void ALL;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Ghost: track mint and burns in the CVL
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
ghost mapping(address => mathint) trackedMintAmount;
ghost mapping(address => mathint) trackedBurnAmount;
ghost mapping(address => mapping(address => mathint)) trackedTransferedAmount;
function specUpdate(address from, address to, uint256 amount) {
if (from == 0 && to == 0) { assert(false); } // defensive
if (from == 0) {
trackedMintAmount[to] = amount;
} else if (to == 0) {
trackedBurnAmount[from] = amount;
} else {
trackedTransferedAmount[from][to] = amount;
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: When doing a flashLoan, "amount" is minted and burnt, additionally, the fee is either burnt
(if the fee recipient is 0) or transferred (if the fee recipient is not 0)
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule checkMintAndBurn(env e) {
address receiver;
address token;
uint256 amount;
bytes data;
uint256 fees = flashFee(token, amount);
address recipient = flashFeeReceiver();
flashLoan(e, receiver, token, amount, data);
assert trackedMintAmount[receiver] == to_mathint(amount);
assert trackedBurnAmount[receiver] == amount + to_mathint(recipient == 0 ? fees : 0);
assert (fees > 0 && recipient != 0) => trackedTransferedAmount[receiver][recipient] == to_mathint(fees);
}

View File

@ -1,198 +0,0 @@
import "helpers/helpers.spec";
import "ERC20.spec";
methods {
function underlying() external returns(address) envfree;
function underlyingTotalSupply() external returns(uint256) envfree;
function underlyingBalanceOf(address) external returns(uint256) envfree;
function underlyingAllowanceToThis(address) external returns(uint256) envfree;
function depositFor(address, uint256) external returns(bool);
function withdrawTo(address, uint256) external returns(bool);
function recover(address) external returns(uint256);
}
use invariant totalSupplyIsSumOfBalances;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Helper: consequence of `totalSupplyIsSumOfBalances` applied to underlying
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
definition underlyingBalancesLowerThanUnderlyingSupply(address a) returns bool =
underlyingBalanceOf(a) <= underlyingTotalSupply();
definition sumOfUnderlyingBalancesLowerThanUnderlyingSupply(address a, address b) returns bool =
a != b => underlyingBalanceOf(a) + underlyingBalanceOf(b) <= to_mathint(underlyingTotalSupply());
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: wrapped token can't be undercollateralized (solvency of the wrapper)
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant totalSupplyIsSmallerThanUnderlyingBalance()
totalSupply() <= underlyingBalanceOf(currentContract) &&
underlyingBalanceOf(currentContract) <= underlyingTotalSupply() &&
underlyingTotalSupply() <= max_uint256
{
preserved {
requireInvariant totalSupplyIsSumOfBalances;
require underlyingBalancesLowerThanUnderlyingSupply(currentContract);
}
preserved depositFor(address account, uint256 amount) with (env e) {
require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(e.msg.sender, currentContract);
}
}
invariant noSelfWrap()
currentContract != underlying();
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: depositFor liveness and effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule depositFor(env e) {
require nonpayable(e);
address sender = e.msg.sender;
address receiver;
address other;
uint256 amount;
// sanity
requireInvariant noSelfWrap;
requireInvariant totalSupplyIsSumOfBalances;
requireInvariant totalSupplyIsSmallerThanUnderlyingBalance;
require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(currentContract, sender);
uint256 balanceBefore = balanceOf(receiver);
uint256 supplyBefore = totalSupply();
uint256 senderUnderlyingBalanceBefore = underlyingBalanceOf(sender);
uint256 senderUnderlyingAllowanceBefore = underlyingAllowanceToThis(sender);
uint256 wrapperUnderlyingBalanceBefore = underlyingBalanceOf(currentContract);
uint256 underlyingSupplyBefore = underlyingTotalSupply();
uint256 otherBalanceBefore = balanceOf(other);
uint256 otherUnderlyingBalanceBefore = underlyingBalanceOf(other);
depositFor@withrevert(e, receiver, amount);
bool success = !lastReverted;
// liveness
assert success <=> (
sender != currentContract && // invalid sender
sender != 0 && // invalid sender
receiver != currentContract && // invalid receiver
receiver != 0 && // invalid receiver
amount <= senderUnderlyingBalanceBefore && // deposit doesn't exceed balance
amount <= senderUnderlyingAllowanceBefore // deposit doesn't exceed allowance
);
// effects
assert success => (
to_mathint(balanceOf(receiver)) == balanceBefore + amount &&
to_mathint(totalSupply()) == supplyBefore + amount &&
to_mathint(underlyingBalanceOf(currentContract)) == wrapperUnderlyingBalanceBefore + amount &&
to_mathint(underlyingBalanceOf(sender)) == senderUnderlyingBalanceBefore - amount
);
// no side effect
assert underlyingTotalSupply() == underlyingSupplyBefore;
assert balanceOf(other) != otherBalanceBefore => other == receiver;
assert underlyingBalanceOf(other) != otherUnderlyingBalanceBefore => (other == sender || other == currentContract);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: withdrawTo liveness and effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule withdrawTo(env e) {
require nonpayable(e);
address sender = e.msg.sender;
address receiver;
address other;
uint256 amount;
// sanity
requireInvariant noSelfWrap;
requireInvariant totalSupplyIsSumOfBalances;
requireInvariant totalSupplyIsSmallerThanUnderlyingBalance;
require sumOfUnderlyingBalancesLowerThanUnderlyingSupply(currentContract, receiver);
uint256 balanceBefore = balanceOf(sender);
uint256 supplyBefore = totalSupply();
uint256 receiverUnderlyingBalanceBefore = underlyingBalanceOf(receiver);
uint256 wrapperUnderlyingBalanceBefore = underlyingBalanceOf(currentContract);
uint256 underlyingSupplyBefore = underlyingTotalSupply();
uint256 otherBalanceBefore = balanceOf(other);
uint256 otherUnderlyingBalanceBefore = underlyingBalanceOf(other);
withdrawTo@withrevert(e, receiver, amount);
bool success = !lastReverted;
// liveness
assert success <=> (
sender != 0 && // invalid sender
receiver != currentContract && // invalid receiver
receiver != 0 && // invalid receiver
amount <= balanceBefore // withdraw doesn't exceed balance
);
// effects
assert success => (
to_mathint(balanceOf(sender)) == balanceBefore - amount &&
to_mathint(totalSupply()) == supplyBefore - amount &&
to_mathint(underlyingBalanceOf(currentContract)) == wrapperUnderlyingBalanceBefore - (currentContract != receiver ? amount : 0) &&
to_mathint(underlyingBalanceOf(receiver)) == receiverUnderlyingBalanceBefore + (currentContract != receiver ? amount : 0)
);
// no side effect
assert underlyingTotalSupply() == underlyingSupplyBefore;
assert balanceOf(other) != otherBalanceBefore => other == sender;
assert underlyingBalanceOf(other) != otherUnderlyingBalanceBefore => (other == receiver || other == currentContract);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: recover liveness and effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule recover(env e) {
require nonpayable(e);
address receiver;
address other;
// sanity
requireInvariant noSelfWrap;
requireInvariant totalSupplyIsSumOfBalances;
requireInvariant totalSupplyIsSmallerThanUnderlyingBalance;
mathint value = underlyingBalanceOf(currentContract) - totalSupply();
uint256 supplyBefore = totalSupply();
uint256 balanceBefore = balanceOf(receiver);
uint256 otherBalanceBefore = balanceOf(other);
uint256 otherUnderlyingBalanceBefore = underlyingBalanceOf(other);
recover@withrevert(e, receiver);
bool success = !lastReverted;
// liveness
assert success <=> receiver != 0;
// effect
assert success => (
to_mathint(balanceOf(receiver)) == balanceBefore + value &&
to_mathint(totalSupply()) == supplyBefore + value &&
totalSupply() == underlyingBalanceOf(currentContract)
);
// no side effect
assert underlyingBalanceOf(other) == otherUnderlyingBalanceBefore;
assert balanceOf(other) != otherBalanceBefore => other == receiver;
}

View File

@ -1,679 +0,0 @@
import "helpers/helpers.spec";
import "methods/IERC721.spec";
import "methods/IERC721Receiver.spec";
methods {
// exposed for FV
function mint(address,uint256) external;
function safeMint(address,uint256) external;
function safeMint(address,uint256,bytes) external;
function burn(uint256) external;
function unsafeOwnerOf(uint256) external returns (address) envfree;
function unsafeGetApproved(uint256) external returns (address) envfree;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Helpers
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
definition authSanity(env e) returns bool = e.msg.sender != 0;
// Could be broken in theory, but not in practice
definition balanceLimited(address account) returns bool = balanceOf(account) < max_uint256;
function helperTransferWithRevert(env e, method f, address from, address to, uint256 tokenId) {
if (f.selector == sig:transferFrom(address,address,uint256).selector) {
transferFrom@withrevert(e, from, to, tokenId);
} else if (f.selector == sig:safeTransferFrom(address,address,uint256).selector) {
safeTransferFrom@withrevert(e, from, to, tokenId);
} else if (f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector) {
bytes params;
require params.length < 0xffff;
safeTransferFrom@withrevert(e, from, to, tokenId, params);
} else {
calldataarg args;
f@withrevert(e, args);
}
}
function helperMintWithRevert(env e, method f, address to, uint256 tokenId) {
if (f.selector == sig:mint(address,uint256).selector) {
mint@withrevert(e, to, tokenId);
} else if (f.selector == sig:safeMint(address,uint256).selector) {
safeMint@withrevert(e, to, tokenId);
} else if (f.selector == sig:safeMint(address,uint256,bytes).selector) {
bytes params;
require params.length < 0xffff;
safeMint@withrevert(e, to, tokenId, params);
} else {
require false;
}
}
function helperSoundFnCall(env e, method f) {
if (f.selector == sig:mint(address,uint256).selector) {
address to; uint256 tokenId;
require balanceLimited(to);
requireInvariant notMintedUnset(tokenId);
mint(e, to, tokenId);
} else if (f.selector == sig:safeMint(address,uint256).selector) {
address to; uint256 tokenId;
require balanceLimited(to);
requireInvariant notMintedUnset(tokenId);
safeMint(e, to, tokenId);
} else if (f.selector == sig:safeMint(address,uint256,bytes).selector) {
address to; uint256 tokenId; bytes data;
require data.length < 0xffff;
require balanceLimited(to);
requireInvariant notMintedUnset(tokenId);
safeMint(e, to, tokenId, data);
} else if (f.selector == sig:burn(uint256).selector) {
uint256 tokenId;
requireInvariant ownerHasBalance(tokenId);
requireInvariant notMintedUnset(tokenId);
burn(e, tokenId);
} else if (f.selector == sig:transferFrom(address,address,uint256).selector) {
address from; address to; uint256 tokenId;
require balanceLimited(to);
requireInvariant ownerHasBalance(tokenId);
requireInvariant notMintedUnset(tokenId);
transferFrom(e, from, to, tokenId);
} else if (f.selector == sig:safeTransferFrom(address,address,uint256).selector) {
address from; address to; uint256 tokenId;
require balanceLimited(to);
requireInvariant ownerHasBalance(tokenId);
requireInvariant notMintedUnset(tokenId);
safeTransferFrom(e, from, to, tokenId);
} else if (f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector) {
address from; address to; uint256 tokenId; bytes data;
require data.length < 0xffff;
require balanceLimited(to);
requireInvariant ownerHasBalance(tokenId);
requireInvariant notMintedUnset(tokenId);
safeTransferFrom(e, from, to, tokenId, data);
} else {
calldataarg args;
f(e, args);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Ghost & hooks: ownership count
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
ghost mathint _ownedTotal {
init_state axiom _ownedTotal == 0;
}
ghost mapping(address => mathint) _ownedByUser {
init_state axiom forall address a. _ownedByUser[a] == 0;
}
hook Sstore _owners[KEY uint256 tokenId] address newOwner (address oldOwner) STORAGE {
_ownedByUser[newOwner] = _ownedByUser[newOwner] + to_mathint(newOwner != 0 ? 1 : 0);
_ownedByUser[oldOwner] = _ownedByUser[oldOwner] - to_mathint(oldOwner != 0 ? 1 : 0);
_ownedTotal = _ownedTotal + to_mathint(newOwner != 0 ? 1 : 0) - to_mathint(oldOwner != 0 ? 1 : 0);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Ghost & hooks: sum of all balances
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
ghost mathint _supply {
init_state axiom _supply == 0;
}
ghost mapping(address => mathint) _balances {
init_state axiom forall address a. _balances[a] == 0;
}
hook Sstore _balances[KEY address addr] uint256 newValue (uint256 oldValue) STORAGE {
_supply = _supply - oldValue + newValue;
}
// TODO: This used to not be necessary. We should try to remove it. In order to do so, we will probably need to add
// many "preserved" directive that require the "balanceOfConsistency" invariant on the accounts involved.
hook Sload uint256 value _balances[KEY address user] STORAGE {
require _balances[user] == to_mathint(value);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: number of owned tokens is the sum of all balances
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant ownedTotalIsSumOfBalances()
_ownedTotal == _supply
{
preserved mint(address to, uint256 tokenId) with (env e) {
require balanceLimited(to);
}
preserved safeMint(address to, uint256 tokenId) with (env e) {
require balanceLimited(to);
}
preserved safeMint(address to, uint256 tokenId, bytes data) with (env e) {
require balanceLimited(to);
}
preserved burn(uint256 tokenId) with (env e) {
requireInvariant ownerHasBalance(tokenId);
requireInvariant balanceOfConsistency(ownerOf(tokenId));
}
preserved transferFrom(address from, address to, uint256 tokenId) with (env e) {
require balanceLimited(to);
requireInvariant ownerHasBalance(tokenId);
requireInvariant balanceOfConsistency(from);
requireInvariant balanceOfConsistency(to);
}
preserved safeTransferFrom(address from, address to, uint256 tokenId) with (env e) {
require balanceLimited(to);
requireInvariant ownerHasBalance(tokenId);
requireInvariant balanceOfConsistency(from);
requireInvariant balanceOfConsistency(to);
}
preserved safeTransferFrom(address from, address to, uint256 tokenId, bytes data) with (env e) {
require balanceLimited(to);
requireInvariant ownerHasBalance(tokenId);
requireInvariant balanceOfConsistency(from);
requireInvariant balanceOfConsistency(to);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: balanceOf is the number of tokens owned
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant balanceOfConsistency(address user)
to_mathint(balanceOf(user)) == _ownedByUser[user] &&
to_mathint(balanceOf(user)) == _balances[user]
{
preserved {
require balanceLimited(user);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: owner of a token must have some balance
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant ownerHasBalance(uint256 tokenId)
balanceOf(ownerOf(tokenId)) > 0
{
preserved {
requireInvariant balanceOfConsistency(ownerOf(tokenId));
require balanceLimited(ownerOf(tokenId));
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: balance of address(0) is 0
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule zeroAddressBalanceRevert() {
balanceOf@withrevert(0);
assert lastReverted;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: address(0) has no authorized operator
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant zeroAddressHasNoApprovedOperator(address a)
!isApprovedForAll(0, a)
{
preserved with (env e) {
require nonzerosender(e);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: tokens that do not exist are not owned and not approved
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant notMintedUnset(uint256 tokenId)
unsafeOwnerOf(tokenId) == 0 => unsafeGetApproved(tokenId) == 0;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: unsafeOwnerOf and unsafeGetApproved don't revert + ownerOf and getApproved revert if token does not exist
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule notMintedRevert(uint256 tokenId) {
requireInvariant notMintedUnset(tokenId);
address _owner = unsafeOwnerOf@withrevert(tokenId);
assert !lastReverted;
address _approved = unsafeGetApproved@withrevert(tokenId);
assert !lastReverted;
address owner = ownerOf@withrevert(tokenId);
assert lastReverted <=> _owner == 0;
assert !lastReverted => _owner == owner;
address approved = getApproved@withrevert(tokenId);
assert lastReverted <=> _owner == 0;
assert !lastReverted => _approved == approved;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: total supply can only change through mint and burn
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule supplyChange(env e) {
require nonzerosender(e);
requireInvariant zeroAddressHasNoApprovedOperator(e.msg.sender);
mathint supplyBefore = _supply;
method f; helperSoundFnCall(e, f);
mathint supplyAfter = _supply;
assert supplyAfter > supplyBefore => (
supplyAfter == supplyBefore + 1 &&
(
f.selector == sig:mint(address,uint256).selector ||
f.selector == sig:safeMint(address,uint256).selector ||
f.selector == sig:safeMint(address,uint256,bytes).selector
)
);
assert supplyAfter < supplyBefore => (
supplyAfter == supplyBefore - 1 &&
f.selector == sig:burn(uint256).selector
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: balanceOf can only change through mint, burn or transfers. balanceOf cannot change by more than 1.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule balanceChange(env e, address account) {
requireInvariant balanceOfConsistency(account);
require balanceLimited(account);
mathint balanceBefore = balanceOf(account);
method f; helperSoundFnCall(e, f);
mathint balanceAfter = balanceOf(account);
// balance can change by at most 1
assert balanceBefore != balanceAfter => (
balanceAfter == balanceBefore - 1 ||
balanceAfter == balanceBefore + 1
);
// only selected function can change balances
assert balanceBefore != balanceAfter => (
f.selector == sig:transferFrom(address,address,uint256).selector ||
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector ||
f.selector == sig:mint(address,uint256).selector ||
f.selector == sig:safeMint(address,uint256).selector ||
f.selector == sig:safeMint(address,uint256,bytes).selector ||
f.selector == sig:burn(uint256).selector
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: ownership can only change through mint, burn or transfers.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule ownershipChange(env e, uint256 tokenId) {
require nonzerosender(e);
requireInvariant zeroAddressHasNoApprovedOperator(e.msg.sender);
address ownerBefore = unsafeOwnerOf(tokenId);
method f; helperSoundFnCall(e, f);
address ownerAfter = unsafeOwnerOf(tokenId);
assert ownerBefore == 0 && ownerAfter != 0 => (
f.selector == sig:mint(address,uint256).selector ||
f.selector == sig:safeMint(address,uint256).selector ||
f.selector == sig:safeMint(address,uint256,bytes).selector
);
assert ownerBefore != 0 && ownerAfter == 0 => (
f.selector == sig:burn(uint256).selector
);
assert (ownerBefore != ownerAfter && ownerBefore != 0 && ownerAfter != 0) => (
f.selector == sig:transferFrom(address,address,uint256).selector ||
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: token approval can only change through approve or transfers (implicitly).
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule approvalChange(env e, uint256 tokenId) {
address approvalBefore = unsafeGetApproved(tokenId);
method f; helperSoundFnCall(e, f);
address approvalAfter = unsafeGetApproved(tokenId);
// approve can set any value, other functions reset
assert approvalBefore != approvalAfter => (
f.selector == sig:approve(address,uint256).selector ||
(
(
f.selector == sig:transferFrom(address,address,uint256).selector ||
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector ||
f.selector == sig:burn(uint256).selector
) && approvalAfter == 0
)
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: approval for all tokens can only change through isApprovedForAll.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule approvedForAllChange(env e, address owner, address spender) {
bool approvedForAllBefore = isApprovedForAll(owner, spender);
method f; helperSoundFnCall(e, f);
bool approvedForAllAfter = isApprovedForAll(owner, spender);
assert approvedForAllBefore != approvedForAllAfter => f.selector == sig:setApprovalForAll(address,bool).selector;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: transferFrom behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule transferFrom(env e, address from, address to, uint256 tokenId) {
require nonpayable(e);
require authSanity(e);
address operator = e.msg.sender;
uint256 otherTokenId;
address otherAccount;
requireInvariant ownerHasBalance(tokenId);
require balanceLimited(to);
uint256 balanceOfFromBefore = balanceOf(from);
uint256 balanceOfToBefore = balanceOf(to);
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
address ownerBefore = unsafeOwnerOf(tokenId);
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
address approvalBefore = unsafeGetApproved(tokenId);
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
transferFrom@withrevert(e, from, to, tokenId);
bool success = !lastReverted;
// liveness
assert success <=> (
from == ownerBefore &&
from != 0 &&
to != 0 &&
(operator == from || operator == approvalBefore || isApprovedForAll(ownerBefore, operator))
);
// effect
assert success => (
to_mathint(balanceOf(from)) == balanceOfFromBefore - assert_uint256(from != to ? 1 : 0) &&
to_mathint(balanceOf(to)) == balanceOfToBefore + assert_uint256(from != to ? 1 : 0) &&
unsafeOwnerOf(tokenId) == to &&
unsafeGetApproved(tokenId) == 0
);
// no side effect
assert balanceOf(otherAccount) != balanceOfOtherBefore => (otherAccount == from || otherAccount == to);
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: safeTransferFrom behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule safeTransferFrom(env e, method f, address from, address to, uint256 tokenId) filtered { f ->
f.selector == sig:safeTransferFrom(address,address,uint256).selector ||
f.selector == sig:safeTransferFrom(address,address,uint256,bytes).selector
} {
require nonpayable(e);
require authSanity(e);
address operator = e.msg.sender;
uint256 otherTokenId;
address otherAccount;
requireInvariant ownerHasBalance(tokenId);
require balanceLimited(to);
uint256 balanceOfFromBefore = balanceOf(from);
uint256 balanceOfToBefore = balanceOf(to);
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
address ownerBefore = unsafeOwnerOf(tokenId);
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
address approvalBefore = unsafeGetApproved(tokenId);
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
helperTransferWithRevert(e, f, from, to, tokenId);
bool success = !lastReverted;
assert success <=> (
from == ownerBefore &&
from != 0 &&
to != 0 &&
(operator == from || operator == approvalBefore || isApprovedForAll(ownerBefore, operator))
);
// effect
assert success => (
to_mathint(balanceOf(from)) == balanceOfFromBefore - assert_uint256(from != to ? 1: 0) &&
to_mathint(balanceOf(to)) == balanceOfToBefore + assert_uint256(from != to ? 1: 0) &&
unsafeOwnerOf(tokenId) == to &&
unsafeGetApproved(tokenId) == 0
);
// no side effect
assert balanceOf(otherAccount) != balanceOfOtherBefore => (otherAccount == from || otherAccount == to);
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: mint behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule mint(env e, address to, uint256 tokenId) {
require nonpayable(e);
requireInvariant notMintedUnset(tokenId);
uint256 otherTokenId;
address otherAccount;
require balanceLimited(to);
mathint supplyBefore = _supply;
uint256 balanceOfToBefore = balanceOf(to);
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
address ownerBefore = unsafeOwnerOf(tokenId);
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
mint@withrevert(e, to, tokenId);
bool success = !lastReverted;
// liveness
assert success <=> (
ownerBefore == 0 &&
to != 0
);
// effect
assert success => (
_supply == supplyBefore + 1 &&
to_mathint(balanceOf(to)) == balanceOfToBefore + 1 &&
unsafeOwnerOf(tokenId) == to
);
// no side effect
assert balanceOf(otherAccount) != balanceOfOtherBefore => otherAccount == to;
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: safeMint behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule safeMint(env e, method f, address to, uint256 tokenId) filtered { f ->
f.selector == sig:safeMint(address,uint256).selector ||
f.selector == sig:safeMint(address,uint256,bytes).selector
} {
require nonpayable(e);
requireInvariant notMintedUnset(tokenId);
uint256 otherTokenId;
address otherAccount;
require balanceLimited(to);
mathint supplyBefore = _supply;
uint256 balanceOfToBefore = balanceOf(to);
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
address ownerBefore = unsafeOwnerOf(tokenId);
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
helperMintWithRevert(e, f, to, tokenId);
bool success = !lastReverted;
assert success <=> (
ownerBefore == 0 &&
to != 0
);
// effect
assert success => (
_supply == supplyBefore + 1 &&
to_mathint(balanceOf(to)) == balanceOfToBefore + 1 &&
unsafeOwnerOf(tokenId) == to
);
// no side effect
assert balanceOf(otherAccount) != balanceOfOtherBefore => otherAccount == to;
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: burn behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule burn(env e, uint256 tokenId) {
require nonpayable(e);
address from = unsafeOwnerOf(tokenId);
uint256 otherTokenId;
address otherAccount;
requireInvariant ownerHasBalance(tokenId);
mathint supplyBefore = _supply;
uint256 balanceOfFromBefore = balanceOf(from);
uint256 balanceOfOtherBefore = balanceOf(otherAccount);
address ownerBefore = unsafeOwnerOf(tokenId);
address otherOwnerBefore = unsafeOwnerOf(otherTokenId);
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
burn@withrevert(e, tokenId);
bool success = !lastReverted;
// liveness
assert success <=> (
ownerBefore != 0
);
// effect
assert success => (
_supply == supplyBefore - 1 &&
to_mathint(balanceOf(from)) == balanceOfFromBefore - 1 &&
unsafeOwnerOf(tokenId) == 0 &&
unsafeGetApproved(tokenId) == 0
);
// no side effect
assert balanceOf(otherAccount) != balanceOfOtherBefore => otherAccount == from;
assert unsafeOwnerOf(otherTokenId) != otherOwnerBefore => otherTokenId == tokenId;
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: approve behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule approve(env e, address spender, uint256 tokenId) {
require nonpayable(e);
require authSanity(e);
address caller = e.msg.sender;
address owner = unsafeOwnerOf(tokenId);
uint256 otherTokenId;
address otherApprovalBefore = unsafeGetApproved(otherTokenId);
approve@withrevert(e, spender, tokenId);
bool success = !lastReverted;
// liveness
assert success <=> (
owner != 0 &&
(owner == caller || isApprovedForAll(owner, caller))
);
// effect
assert success => unsafeGetApproved(tokenId) == spender;
// no side effect
assert unsafeGetApproved(otherTokenId) != otherApprovalBefore => otherTokenId == tokenId;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: setApprovalForAll behavior and side effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule setApprovalForAll(env e, address operator, bool approved) {
require nonpayable(e);
address owner = e.msg.sender;
address otherOwner;
address otherOperator;
bool otherIsApprovedForAllBefore = isApprovedForAll(otherOwner, otherOperator);
setApprovalForAll@withrevert(e, operator, approved);
bool success = !lastReverted;
// liveness
assert success <=> operator != 0;
// effect
assert success => isApprovedForAll(owner, operator) == approved;
// no side effect
assert isApprovedForAll(otherOwner, otherOperator) != otherIsApprovedForAllBefore => (
otherOwner == owner &&
otherOperator == operator
);
}

View File

@ -1,333 +0,0 @@
import "helpers/helpers.spec";
methods {
// library
function set(bytes32,bytes32) external returns (bool) envfree;
function remove(bytes32) external returns (bool) envfree;
function contains(bytes32) external returns (bool) envfree;
function length() external returns (uint256) envfree;
function key_at(uint256) external returns (bytes32) envfree;
function value_at(uint256) external returns (bytes32) envfree;
function tryGet_contains(bytes32) external returns (bool) envfree;
function tryGet_value(bytes32) external returns (bytes32) envfree;
function get(bytes32) external returns (bytes32) envfree;
// FV
function _indexOf(bytes32) external returns (uint256) envfree;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Helpers
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
definition sanity() returns bool =
length() < max_uint256;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: the value mapping is empty for keys that are not in the EnumerableMap.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant noValueIfNotContained(bytes32 key)
!contains(key) => tryGet_value(key) == to_bytes32(0)
{
preserved set(bytes32 otherKey, bytes32 someValue) {
require sanity();
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: All indexed keys are contained
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant indexedContained(uint256 index)
index < length() => contains(key_at(index))
{
preserved {
requireInvariant consistencyIndex(index);
requireInvariant consistencyIndex(require_uint256(length() - 1));
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: A value can only be stored at a single location
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant atUniqueness(uint256 index1, uint256 index2)
index1 == index2 <=> key_at(index1) == key_at(index2)
{
preserved remove(bytes32 key) {
requireInvariant atUniqueness(index1, require_uint256(length() - 1));
requireInvariant atUniqueness(index2, require_uint256(length() - 1));
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: index <> value relationship is consistent
Note that the two consistencyXxx invariants, put together, prove that at_ and _indexOf are inverse of one another.
This proves that we have a bijection between indices (the enumerability part) and keys (the entries that are set
and removed from the EnumerableMap).
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant consistencyIndex(uint256 index)
index < length() => to_mathint(_indexOf(key_at(index))) == index + 1
{
preserved remove(bytes32 key) {
requireInvariant consistencyIndex(require_uint256(length() - 1));
}
}
invariant consistencyKey(bytes32 key)
contains(key) => (
_indexOf(key) > 0 &&
_indexOf(key) <= length() &&
key_at(require_uint256(_indexOf(key) - 1)) == key
)
{
preserved remove(bytes32 otherKey) {
requireInvariant consistencyKey(otherKey);
requireInvariant atUniqueness(
require_uint256(_indexOf(key) - 1),
require_uint256(_indexOf(otherKey) - 1)
);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: state only changes by setting or removing elements
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule stateChange(env e, bytes32 key) {
require sanity();
requireInvariant consistencyKey(key);
uint256 lengthBefore = length();
bool containsBefore = contains(key);
bytes32 valueBefore = tryGet_value(key);
method f;
calldataarg args;
f(e, args);
uint256 lengthAfter = length();
bool containsAfter = contains(key);
bytes32 valueAfter = tryGet_value(key);
assert lengthBefore != lengthAfter => (
(f.selector == sig:set(bytes32,bytes32).selector && to_mathint(lengthAfter) == lengthBefore + 1) ||
(f.selector == sig:remove(bytes32).selector && to_mathint(lengthAfter) == lengthBefore - 1)
);
assert containsBefore != containsAfter => (
(f.selector == sig:set(bytes32,bytes32).selector && containsAfter) ||
(f.selector == sig:remove(bytes32).selector && !containsAfter)
);
assert valueBefore != valueAfter => (
(f.selector == sig:set(bytes32,bytes32).selector && containsAfter) ||
(f.selector == sig:remove(bytes32).selector && !containsAfter && valueAfter == to_bytes32(0))
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: check liveness of view functions.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule liveness_1(bytes32 key) {
requireInvariant consistencyKey(key);
// contains never revert
bool contains = contains@withrevert(key);
assert !lastReverted;
// tryGet never reverts (key)
tryGet_contains@withrevert(key);
assert !lastReverted;
// tryGet never reverts (value)
tryGet_value@withrevert(key);
assert !lastReverted;
// get reverts iff the key is not in the map
get@withrevert(key);
assert !lastReverted <=> contains;
}
rule liveness_2(uint256 index) {
requireInvariant consistencyIndex(index);
// length never revert
uint256 length = length@withrevert();
assert !lastReverted;
// key_at reverts iff the index is out of bound
key_at@withrevert(index);
assert !lastReverted <=> index < length;
// value_at reverts iff the index is out of bound
value_at@withrevert(index);
assert !lastReverted <=> index < length;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: get and tryGet return the expected values.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule getAndTryGet(bytes32 key) {
requireInvariant noValueIfNotContained(key);
bool contained = contains(key);
bool tryContained = tryGet_contains(key);
bytes32 tryValue = tryGet_value(key);
bytes32 value = get@withrevert(key); // revert is not contained
assert contained == tryContained;
assert contained => tryValue == value;
assert !contained => tryValue == to_bytes32(0);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: set key-value in EnumerableMap
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule set(bytes32 key, bytes32 value, bytes32 otherKey) {
require sanity();
uint256 lengthBefore = length();
bool containsBefore = contains(key);
bool containsOtherBefore = contains(otherKey);
bytes32 otherValueBefore = tryGet_value(otherKey);
bool added = set@withrevert(key, value);
bool success = !lastReverted;
assert success && contains(key) && get(key) == value,
"liveness & immediate effect";
assert added <=> !containsBefore,
"return value: added iff not contained";
assert to_mathint(length()) == lengthBefore + to_mathint(added ? 1 : 0),
"effect: length increases iff added";
assert added => (key_at(lengthBefore) == key && value_at(lengthBefore) == value),
"effect: add at the end";
assert containsOtherBefore != contains(otherKey) => (added && key == otherKey),
"side effect: other keys are not affected";
assert otherValueBefore != tryGet_value(otherKey) => key == otherKey,
"side effect: values attached to other keys are not affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: remove key from EnumerableMap
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule remove(bytes32 key, bytes32 otherKey) {
requireInvariant consistencyKey(key);
requireInvariant consistencyKey(otherKey);
uint256 lengthBefore = length();
bool containsBefore = contains(key);
bool containsOtherBefore = contains(otherKey);
bytes32 otherValueBefore = tryGet_value(otherKey);
bool removed = remove@withrevert(key);
bool success = !lastReverted;
assert success && !contains(key),
"liveness & immediate effect";
assert removed <=> containsBefore,
"return value: removed iff contained";
assert to_mathint(length()) == lengthBefore - to_mathint(removed ? 1 : 0),
"effect: length decreases iff removed";
assert containsOtherBefore != contains(otherKey) => (removed && key == otherKey),
"side effect: other keys are not affected";
assert otherValueBefore != tryGet_value(otherKey) => key == otherKey,
"side effect: values attached to other keys are not affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: when adding a new key, the other keys remain in set, at the same index.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule setEnumerability(bytes32 key, bytes32 value, uint256 index) {
require sanity();
bytes32 atKeyBefore = key_at(index);
bytes32 atValueBefore = value_at(index);
set(key, value);
bytes32 atKeyAfter = key_at@withrevert(index);
assert !lastReverted;
bytes32 atValueAfter = value_at@withrevert(index);
assert !lastReverted;
assert atKeyAfter == atKeyBefore;
assert atValueAfter != atValueBefore => (
key == atKeyBefore &&
value == atValueAfter
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: when removing a existing key, the other keys remain in set, at the same index (except for the last one).
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule removeEnumerability(bytes32 key, uint256 index) {
uint256 last = require_uint256(length() - 1);
requireInvariant consistencyKey(key);
requireInvariant consistencyIndex(index);
requireInvariant consistencyIndex(last);
bytes32 atKeyBefore = key_at(index);
bytes32 atValueBefore = value_at(index);
bytes32 lastKeyBefore = key_at(last);
bytes32 lastValueBefore = value_at(last);
remove(key);
// can't read last value & keys (length decreased)
bytes32 atKeyAfter = key_at@withrevert(index);
assert lastReverted <=> index == last;
bytes32 atValueAfter = value_at@withrevert(index);
assert lastReverted <=> index == last;
// One value that is allowed to change is if previous value was removed,
// in that case the last value before took its place.
assert (
index != last &&
atKeyBefore != atKeyAfter
) => (
atKeyBefore == key &&
atKeyAfter == lastKeyBefore
);
assert (
index != last &&
atValueBefore != atValueAfter
) => (
atValueAfter == lastValueBefore
);
}

View File

@ -1,246 +0,0 @@
import "helpers/helpers.spec";
methods {
// library
function add(bytes32) external returns (bool) envfree;
function remove(bytes32) external returns (bool) envfree;
function contains(bytes32) external returns (bool) envfree;
function length() external returns (uint256) envfree;
function at_(uint256) external returns (bytes32) envfree;
// FV
function _indexOf(bytes32) external returns (uint256) envfree;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Helpers
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
definition sanity() returns bool =
length() < max_uint256;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: All indexed keys are contained
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant indexedContained(uint256 index)
index < length() => contains(at_(index))
{
preserved {
requireInvariant consistencyIndex(index);
requireInvariant consistencyIndex(require_uint256(length() - 1));
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: A value can only be stored at a single location
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant atUniqueness(uint256 index1, uint256 index2)
index1 == index2 <=> at_(index1) == at_(index2)
{
preserved remove(bytes32 key) {
requireInvariant atUniqueness(index1, require_uint256(length() - 1));
requireInvariant atUniqueness(index2, require_uint256(length() - 1));
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: index <> key relationship is consistent
Note that the two consistencyXxx invariants, put together, prove that at_ and _indexOf are inverse of one another.
This proves that we have a bijection between indices (the enumerability part) and keys (the entries that are added
and removed from the EnumerableSet).
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant consistencyIndex(uint256 index)
index < length() => _indexOf(at_(index)) == require_uint256(index + 1)
{
preserved remove(bytes32 key) {
requireInvariant consistencyIndex(require_uint256(length() - 1));
}
}
invariant consistencyKey(bytes32 key)
contains(key) => (
_indexOf(key) > 0 &&
_indexOf(key) <= length() &&
at_(require_uint256(_indexOf(key) - 1)) == key
)
{
preserved remove(bytes32 otherKey) {
requireInvariant consistencyKey(otherKey);
requireInvariant atUniqueness(
require_uint256(_indexOf(key) - 1),
require_uint256(_indexOf(otherKey) - 1)
);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: state only changes by adding or removing elements
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule stateChange(env e, bytes32 key) {
require sanity();
requireInvariant consistencyKey(key);
uint256 lengthBefore = length();
bool containsBefore = contains(key);
method f;
calldataarg args;
f(e, args);
uint256 lengthAfter = length();
bool containsAfter = contains(key);
assert lengthBefore != lengthAfter => (
(f.selector == sig:add(bytes32).selector && lengthAfter == require_uint256(lengthBefore + 1)) ||
(f.selector == sig:remove(bytes32).selector && lengthAfter == require_uint256(lengthBefore - 1))
);
assert containsBefore != containsAfter => (
(f.selector == sig:add(bytes32).selector && containsAfter) ||
(f.selector == sig:remove(bytes32).selector && containsBefore)
);
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: check liveness of view functions.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule liveness_1(bytes32 key) {
requireInvariant consistencyKey(key);
// contains never revert
contains@withrevert(key);
assert !lastReverted;
}
rule liveness_2(uint256 index) {
requireInvariant consistencyIndex(index);
// length never revert
uint256 length = length@withrevert();
assert !lastReverted;
// at reverts iff the index is out of bound
at_@withrevert(index);
assert !lastReverted <=> index < length;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: add key to EnumerableSet if not already contained
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule add(bytes32 key, bytes32 otherKey) {
require sanity();
uint256 lengthBefore = length();
bool containsBefore = contains(key);
bool containsOtherBefore = contains(otherKey);
bool added = add@withrevert(key);
bool success = !lastReverted;
assert success && contains(key),
"liveness & immediate effect";
assert added <=> !containsBefore,
"return value: added iff not contained";
assert length() == require_uint256(lengthBefore + to_mathint(added ? 1 : 0)),
"effect: length increases iff added";
assert added => at_(lengthBefore) == key,
"effect: add at the end";
assert containsOtherBefore != contains(otherKey) => (added && key == otherKey),
"side effect: other keys are not affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: remove key from EnumerableSet if already contained
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule remove(bytes32 key, bytes32 otherKey) {
requireInvariant consistencyKey(key);
requireInvariant consistencyKey(otherKey);
uint256 lengthBefore = length();
bool containsBefore = contains(key);
bool containsOtherBefore = contains(otherKey);
bool removed = remove@withrevert(key);
bool success = !lastReverted;
assert success && !contains(key),
"liveness & immediate effect";
assert removed <=> containsBefore,
"return value: removed iff contained";
assert length() == require_uint256(lengthBefore - to_mathint(removed ? 1 : 0)),
"effect: length decreases iff removed";
assert containsOtherBefore != contains(otherKey) => (removed && key == otherKey),
"side effect: other keys are not affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: when adding a new key, the other keys remain in set, at the same index.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule addEnumerability(bytes32 key, uint256 index) {
require sanity();
bytes32 atBefore = at_(index);
add(key);
bytes32 atAfter = at_@withrevert(index);
bool atAfterSuccess = !lastReverted;
assert atAfterSuccess;
assert atBefore == atAfter;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: when removing a existing key, the other keys remain in set, at the same index (except for the last one).
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule removeEnumerability(bytes32 key, uint256 index) {
uint256 last = require_uint256(length() - 1);
requireInvariant consistencyKey(key);
requireInvariant consistencyIndex(index);
requireInvariant consistencyIndex(last);
bytes32 atBefore = at_(index);
bytes32 lastBefore = at_(last);
remove(key);
// can't read last value (length decreased)
bytes32 atAfter = at_@withrevert(index);
assert lastReverted <=> index == last;
// One value that is allowed to change is if previous value was removed,
// in that case the last value before took its place.
assert (
index != last &&
atBefore != atAfter
) => (
atBefore == key &&
atAfter == lastBefore
);
}

View File

@ -1,165 +0,0 @@
import "helpers/helpers.spec";
methods {
// initialize, reinitialize, disable
function initialize() external envfree;
function reinitialize(uint64) external envfree;
function disable() external envfree;
function nested_init_init() external envfree;
function nested_init_reinit(uint64) external envfree;
function nested_reinit_init(uint64) external envfree;
function nested_reinit_reinit(uint64,uint64) external envfree;
// view
function version() external returns uint64 envfree;
function initializing() external returns bool envfree;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Definitions
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
definition isUninitialized() returns bool = version() == 0;
definition isInitialized() returns bool = version() > 0;
definition isDisabled() returns bool = version() == max_uint64;
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: A contract must only ever be in an initializing state while in the middle of a transaction execution.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant notInitializing()
!initializing();
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: The version cannot decrease & disable state is irrevocable.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule increasingVersion(env e) {
uint64 versionBefore = version();
bool disabledBefore = isDisabled();
method f; calldataarg args;
f(e, args);
assert versionBefore <= version(), "_initialized must only increase";
assert disabledBefore => isDisabled(), "a disabled initializer must stay disabled";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: Cannot initialize a contract that is already initialized.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule cannotInitializeTwice() {
require isInitialized();
initialize@withrevert();
assert lastReverted, "contract must only be initialized once";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: Cannot initialize once disabled.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule cannotInitializeOnceDisabled() {
require isDisabled();
initialize@withrevert();
assert lastReverted, "contract is disabled";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: Cannot reinitialize once disabled.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule cannotReinitializeOnceDisabled() {
require isDisabled();
uint64 n;
reinitialize@withrevert(n);
assert lastReverted, "contract is disabled";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: Cannot nest initializers (after construction).
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule cannotNestInitializers_init_init() {
nested_init_init@withrevert();
assert lastReverted, "nested initializers";
}
rule cannotNestInitializers_init_reinit(uint64 m) {
nested_init_reinit@withrevert(m);
assert lastReverted, "nested initializers";
}
rule cannotNestInitializers_reinit_init(uint64 n) {
nested_reinit_init@withrevert(n);
assert lastReverted, "nested initializers";
}
rule cannotNestInitializers_reinit_reinit(uint64 n, uint64 m) {
nested_reinit_reinit@withrevert(n, m);
assert lastReverted, "nested initializers";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: Initialize correctly sets the version.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule initializeEffects() {
requireInvariant notInitializing();
bool isUninitializedBefore = isUninitialized();
initialize@withrevert();
bool success = !lastReverted;
assert success <=> isUninitializedBefore, "can only initialize uninitialized contracts";
assert success => version() == 1, "initialize must set version() to 1";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: Reinitialize correctly sets the version.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule reinitializeEffects() {
requireInvariant notInitializing();
uint64 versionBefore = version();
uint64 n;
reinitialize@withrevert(n);
bool success = !lastReverted;
assert success <=> versionBefore < n, "can only reinitialize to a latter versions";
assert success => version() == n, "reinitialize must set version() to n";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: Can disable.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule disableEffect() {
requireInvariant notInitializing();
disable@withrevert();
bool success = !lastReverted;
assert success, "call to _disableInitializers failed";
assert isDisabled(), "disable state not set";
}

View File

@ -1,77 +0,0 @@
import "helpers/helpers.spec";
import "methods/IOwnable.spec";
methods {
function restricted() external;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: transferOwnership changes ownership
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule transferOwnership(env e) {
require nonpayable(e);
address newOwner;
address current = owner();
transferOwnership@withrevert(e, newOwner);
bool success = !lastReverted;
assert success <=> (e.msg.sender == current && newOwner != 0), "unauthorized caller or invalid arg";
assert success => owner() == newOwner, "current owner changed";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: renounceOwnership removes the owner
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule renounceOwnership(env e) {
require nonpayable(e);
address current = owner();
renounceOwnership@withrevert(e);
bool success = !lastReverted;
assert success <=> e.msg.sender == current, "unauthorized caller";
assert success => owner() == 0, "owner not cleared";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Access control: only current owner can call restricted functions
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyCurrentOwnerCanCallOnlyOwner(env e) {
require nonpayable(e);
address current = owner();
calldataarg args;
restricted@withrevert(e, args);
assert !lastReverted <=> e.msg.sender == current, "access control failed";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: ownership can only change in specific ways
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyOwnerOrPendingOwnerCanChangeOwnership(env e) {
address oldCurrent = owner();
method f; calldataarg args;
f(e, args);
address newCurrent = owner();
// If owner changes, must be either transferOwnership or renounceOwnership
assert oldCurrent != newCurrent => (
(e.msg.sender == oldCurrent && newCurrent != 0 && f.selector == sig:transferOwnership(address).selector) ||
(e.msg.sender == oldCurrent && newCurrent == 0 && f.selector == sig:renounceOwnership().selector)
);
}

View File

@ -1,108 +0,0 @@
import "helpers/helpers.spec";
import "methods/IOwnable2Step.spec";
methods {
function restricted() external;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: transferOwnership sets the pending owner
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule transferOwnership(env e) {
require nonpayable(e);
address newOwner;
address current = owner();
transferOwnership@withrevert(e, newOwner);
bool success = !lastReverted;
assert success <=> e.msg.sender == current, "unauthorized caller";
assert success => pendingOwner() == newOwner, "pending owner not set";
assert success => owner() == current, "current owner changed";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: renounceOwnership removes the owner and the pendingOwner
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule renounceOwnership(env e) {
require nonpayable(e);
address current = owner();
renounceOwnership@withrevert(e);
bool success = !lastReverted;
assert success <=> e.msg.sender == current, "unauthorized caller";
assert success => pendingOwner() == 0, "pending owner not cleared";
assert success => owner() == 0, "owner not cleared";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: acceptOwnership changes owner and reset pending owner
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule acceptOwnership(env e) {
require nonpayable(e);
address current = owner();
address pending = pendingOwner();
acceptOwnership@withrevert(e);
bool success = !lastReverted;
assert success <=> e.msg.sender == pending, "unauthorized caller";
assert success => pendingOwner() == 0, "pending owner not cleared";
assert success => owner() == pending, "owner not transferred";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Access control: only current owner can call restricted functions
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule onlyCurrentOwnerCanCallOnlyOwner(env e) {
require nonpayable(e);
address current = owner();
calldataarg args;
restricted@withrevert(e, args);
assert !lastReverted <=> e.msg.sender == current, "access control failed";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: ownership and pending ownership can only change in specific ways
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule ownerOrPendingOwnerChange(env e, method f) {
address oldCurrent = owner();
address oldPending = pendingOwner();
calldataarg args;
f(e, args);
address newCurrent = owner();
address newPending = pendingOwner();
// If owner changes, must be either acceptOwnership or renounceOwnership
assert oldCurrent != newCurrent => (
(e.msg.sender == oldPending && newCurrent == oldPending && newPending == 0 && f.selector == sig:acceptOwnership().selector) ||
(e.msg.sender == oldCurrent && newCurrent == 0 && newPending == 0 && f.selector == sig:renounceOwnership().selector)
);
// If pending changes, must be either acceptance or reset
assert oldPending != newPending => (
(e.msg.sender == oldCurrent && newCurrent == oldCurrent && f.selector == sig:transferOwnership(address).selector) ||
(e.msg.sender == oldPending && newCurrent == oldPending && newPending == 0 && f.selector == sig:acceptOwnership().selector) ||
(e.msg.sender == oldCurrent && newCurrent == 0 && newPending == 0 && f.selector == sig:renounceOwnership().selector)
);
}

View File

@ -1,96 +0,0 @@
import "helpers/helpers.spec";
methods {
function paused() external returns (bool) envfree;
function pause() external;
function unpause() external;
function onlyWhenPaused() external;
function onlyWhenNotPaused() external;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: _pause pauses the contract
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule pause(env e) {
require nonpayable(e);
bool pausedBefore = paused();
pause@withrevert(e);
bool success = !lastReverted;
bool pausedAfter = paused();
// liveness
assert success <=> !pausedBefore, "works if and only if the contract was not paused before";
// effect
assert success => pausedAfter, "contract must be paused after a successful call";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: _unpause unpauses the contract
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule unpause(env e) {
require nonpayable(e);
bool pausedBefore = paused();
unpause@withrevert(e);
bool success = !lastReverted;
bool pausedAfter = paused();
// liveness
assert success <=> pausedBefore, "works if and only if the contract was paused before";
// effect
assert success => !pausedAfter, "contract must be unpaused after a successful call";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: whenPaused modifier can only be called if the contract is paused
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule whenPaused(env e) {
require nonpayable(e);
onlyWhenPaused@withrevert(e);
assert !lastReverted <=> paused(), "works if and only if the contract is paused";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Function correctness: whenNotPaused modifier can only be called if the contract is not paused
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule whenNotPaused(env e) {
require nonpayable(e);
onlyWhenNotPaused@withrevert(e);
assert !lastReverted <=> !paused(), "works if and only if the contract is not paused";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rules: only _pause and _unpause can change paused status
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule noPauseChange(env e) {
method f;
calldataarg args;
bool pausedBefore = paused();
f(e, args);
bool pausedAfter = paused();
assert pausedBefore != pausedAfter => (
(!pausedAfter && f.selector == sig:unpause().selector) ||
(pausedAfter && f.selector == sig:pause().selector)
), "contract's paused status can only be changed by _pause() or _unpause()";
}

View File

@ -1,274 +0,0 @@
import "helpers/helpers.spec";
import "methods/IAccessControl.spec";
methods {
function PROPOSER_ROLE() external returns (bytes32) envfree;
function EXECUTOR_ROLE() external returns (bytes32) envfree;
function CANCELLER_ROLE() external returns (bytes32) envfree;
function isOperation(bytes32) external returns (bool);
function isOperationPending(bytes32) external returns (bool);
function isOperationReady(bytes32) external returns (bool);
function isOperationDone(bytes32) external returns (bool);
function getTimestamp(bytes32) external returns (uint256) envfree;
function getMinDelay() external returns (uint256) envfree;
function hashOperation(address, uint256, bytes, bytes32, bytes32) external returns(bytes32) envfree;
function hashOperationBatch(address[], uint256[], bytes[], bytes32, bytes32) external returns(bytes32) envfree;
function schedule(address, uint256, bytes, bytes32, bytes32, uint256) external;
function scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256) external;
function execute(address, uint256, bytes, bytes32, bytes32) external;
function executeBatch(address[], uint256[], bytes[], bytes32, bytes32) external;
function cancel(bytes32) external;
function updateDelay(uint256) external;
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Helpers
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
// Uniformly handle scheduling of batched and non-batched operations.
function helperScheduleWithRevert(env e, method f, bytes32 id, uint256 delay) {
if (f.selector == sig:schedule(address, uint256, bytes, bytes32, bytes32, uint256).selector) {
address target; uint256 value; bytes data; bytes32 predecessor; bytes32 salt;
require hashOperation(target, value, data, predecessor, salt) == id; // Correlation
schedule@withrevert(e, target, value, data, predecessor, salt, delay);
} else if (f.selector == sig:scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256).selector) {
address[] targets; uint256[] values; bytes[] payloads; bytes32 predecessor; bytes32 salt;
require hashOperationBatch(targets, values, payloads, predecessor, salt) == id; // Correlation
scheduleBatch@withrevert(e, targets, values, payloads, predecessor, salt, delay);
} else {
calldataarg args;
f@withrevert(e, args);
}
}
// Uniformly handle execution of batched and non-batched operations.
function helperExecuteWithRevert(env e, method f, bytes32 id, bytes32 predecessor) {
if (f.selector == sig:execute(address, uint256, bytes, bytes32, bytes32).selector) {
address target; uint256 value; bytes data; bytes32 salt;
require hashOperation(target, value, data, predecessor, salt) == id; // Correlation
execute@withrevert(e, target, value, data, predecessor, salt);
} else if (f.selector == sig:executeBatch(address[], uint256[], bytes[], bytes32, bytes32).selector) {
address[] targets; uint256[] values; bytes[] payloads; bytes32 salt;
require hashOperationBatch(targets, values, payloads, predecessor, salt) == id; // Correlation
executeBatch@withrevert(e, targets, values, payloads, predecessor, salt);
} else {
calldataarg args;
f@withrevert(e, args);
}
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Definitions
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
definition DONE_TIMESTAMP() returns uint256 = 1;
definition UNSET() returns uint8 = 0x1;
definition PENDING() returns uint8 = 0x2;
definition DONE() returns uint8 = 0x4;
definition isUnset(env e, bytes32 id) returns bool = !isOperation(e, id);
definition isPending(env e, bytes32 id) returns bool = isOperationPending(e, id);
definition isDone(env e, bytes32 id) returns bool = isOperationDone(e, id);
definition state(env e, bytes32 id) returns uint8 = (isUnset(e, id) ? UNSET() : 0) | (isPending(e, id) ? PENDING() : 0) | (isDone(e, id) ? DONE() : 0);
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariants: consistency of accessors
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant isOperationCheck(env e, bytes32 id)
isOperation(e, id) <=> getTimestamp(id) > 0
filtered { f -> !f.isView }
invariant isOperationPendingCheck(env e, bytes32 id)
isOperationPending(e, id) <=> getTimestamp(id) > DONE_TIMESTAMP()
filtered { f -> !f.isView }
invariant isOperationDoneCheck(env e, bytes32 id)
isOperationDone(e, id) <=> getTimestamp(id) == DONE_TIMESTAMP()
filtered { f -> !f.isView }
invariant isOperationReadyCheck(env e, bytes32 id)
isOperationReady(e, id) <=> (isOperationPending(e, id) && getTimestamp(id) <= e.block.timestamp)
filtered { f -> !f.isView }
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Invariant: a proposal id is either unset, pending or done
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
invariant stateConsistency(bytes32 id, env e)
// Check states are mutually exclusive
(isUnset(e, id) <=> (!isPending(e, id) && !isDone(e, id) )) &&
(isPending(e, id) <=> (!isUnset(e, id) && !isDone(e, id) )) &&
(isDone(e, id) <=> (!isUnset(e, id) && !isPending(e, id))) &&
// Check that the state helper behaves as expected:
(isUnset(e, id) <=> state(e, id) == UNSET() ) &&
(isPending(e, id) <=> state(e, id) == PENDING() ) &&
(isDone(e, id) <=> state(e, id) == DONE() ) &&
// Check substate
isOperationReady(e, id) => isPending(e, id)
filtered { f -> !f.isView }
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: state transition rules
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule stateTransition(bytes32 id, env e, method f, calldataarg args) {
require e.block.timestamp > 1; // Sanity
uint8 stateBefore = state(e, id);
f(e, args);
uint8 stateAfter = state(e, id);
// Cannot jump from UNSET to DONE
assert stateBefore == UNSET() => stateAfter != DONE();
// UNSET PENDING: schedule or scheduleBatch
assert stateBefore == UNSET() && stateAfter == PENDING() => (
f.selector == sig:schedule(address, uint256, bytes, bytes32, bytes32, uint256).selector ||
f.selector == sig:scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256).selector
);
// PENDING UNSET: cancel
assert stateBefore == PENDING() && stateAfter == UNSET() => (
f.selector == sig:cancel(bytes32).selector
);
// PENDING DONE: execute or executeBatch
assert stateBefore == PENDING() && stateAfter == DONE() => (
f.selector == sig:execute(address, uint256, bytes, bytes32, bytes32).selector ||
f.selector == sig:executeBatch(address[], uint256[], bytes[], bytes32, bytes32).selector
);
// DONE is final
assert stateBefore == DONE() => stateAfter == DONE();
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: minimum delay can only be updated through a timelock execution
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule minDelayOnlyChange(env e) {
uint256 delayBefore = getMinDelay();
method f; calldataarg args;
f(e, args);
assert delayBefore != getMinDelay() => (e.msg.sender == currentContract && f.selector == sig:updateDelay(uint256).selector), "Unauthorized delay update";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: schedule liveness and effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule schedule(env e, method f, bytes32 id, uint256 delay) filtered { f ->
f.selector == sig:schedule(address, uint256, bytes, bytes32, bytes32, uint256).selector ||
f.selector == sig:scheduleBatch(address[], uint256[], bytes[], bytes32, bytes32, uint256).selector
} {
require nonpayable(e);
// Basic timestamp assumptions
require e.block.timestamp > 1;
require e.block.timestamp + delay < max_uint256;
require e.block.timestamp + getMinDelay() < max_uint256;
bytes32 otherId; uint256 otherTimestamp = getTimestamp(otherId);
uint8 stateBefore = state(e, id);
bool isDelaySufficient = delay >= getMinDelay();
bool isProposerBefore = hasRole(PROPOSER_ROLE(), e.msg.sender);
helperScheduleWithRevert(e, f, id, delay);
bool success = !lastReverted;
// liveness
assert success <=> (
stateBefore == UNSET() &&
isDelaySufficient &&
isProposerBefore
);
// effect
assert success => state(e, id) == PENDING(), "State transition violation";
assert success => getTimestamp(id) == require_uint256(e.block.timestamp + delay), "Proposal timestamp not correctly set";
// no side effect
assert otherTimestamp != getTimestamp(otherId) => id == otherId, "Other proposal affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: execute liveness and effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule execute(env e, method f, bytes32 id, bytes32 predecessor) filtered { f ->
f.selector == sig:execute(address, uint256, bytes, bytes32, bytes32).selector ||
f.selector == sig:executeBatch(address[], uint256[], bytes[], bytes32, bytes32).selector
} {
bytes32 otherId; uint256 otherTimestamp = getTimestamp(otherId);
uint8 stateBefore = state(e, id);
bool isOperationReadyBefore = isOperationReady(e, id);
bool isExecutorOrOpen = hasRole(EXECUTOR_ROLE(), e.msg.sender) || hasRole(EXECUTOR_ROLE(), 0);
bool predecessorDependency = predecessor == to_bytes32(0) || isDone(e, predecessor);
helperExecuteWithRevert(e, f, id, predecessor);
bool success = !lastReverted;
// The underlying transaction can revert, and that would cause the execution to revert. We can check that all non
// reverting calls meet the requirements in terms of proposal readiness, access control and predecessor dependency.
// We can't however guarantee that these requirements being meet ensure liveness of the proposal, because the
// proposal can revert for reasons beyond our control.
// liveness, should be `<=>` but can only check `=>` (see comment above)
assert success => (
stateBefore == PENDING() &&
isOperationReadyBefore &&
predecessorDependency &&
isExecutorOrOpen
);
// effect
assert success => state(e, id) == DONE(), "State transition violation";
// no side effect
assert otherTimestamp != getTimestamp(otherId) => id == otherId, "Other proposal affected";
}
/*
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
Rule: cancel liveness and effects
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
rule cancel(env e, bytes32 id) {
require nonpayable(e);
bytes32 otherId; uint256 otherTimestamp = getTimestamp(otherId);
uint8 stateBefore = state(e, id);
bool isCanceller = hasRole(CANCELLER_ROLE(), e.msg.sender);
cancel@withrevert(e, id);
bool success = !lastReverted;
// liveness
assert success <=> (
stateBefore == PENDING() &&
isCanceller
);
// effect
assert success => state(e, id) == UNSET(), "State transition violation";
// no side effect
assert otherTimestamp != getTimestamp(otherId) => id == otherId, "Other proposal affected";
}

View File

@ -1,7 +0,0 @@
// environment
definition nonpayable(env e) returns bool = e.msg.value == 0;
definition nonzerosender(env e) returns bool = e.msg.sender != 0;
// math
definition min(mathint a, mathint b) returns mathint = a < b ? a : b;
definition max(mathint a, mathint b) returns mathint = a > b ? a : b;

View File

@ -1,8 +0,0 @@
methods {
function DEFAULT_ADMIN_ROLE() external returns (bytes32) envfree;
function hasRole(bytes32, address) external returns(bool) envfree;
function getRoleAdmin(bytes32) external returns(bytes32) envfree;
function grantRole(bytes32, address) external;
function revokeRole(bytes32, address) external;
function renounceRole(bytes32, address) external;
}

View File

@ -1,36 +0,0 @@
import "./IERC5313.spec";
methods {
// === View ==
// Default Admin
function defaultAdmin() external returns(address) envfree;
function pendingDefaultAdmin() external returns(address, uint48) envfree;
// Default Admin Delay
function defaultAdminDelay() external returns(uint48);
function pendingDefaultAdminDelay() external returns(uint48, uint48);
function defaultAdminDelayIncreaseWait() external returns(uint48) envfree;
// === Mutations ==
// Default Admin
function beginDefaultAdminTransfer(address) external;
function cancelDefaultAdminTransfer() external;
function acceptDefaultAdminTransfer() external;
// Default Admin Delay
function changeDefaultAdminDelay(uint48) external;
function rollbackDefaultAdminDelay() external;
// == FV ==
// Default Admin
function pendingDefaultAdmin_() external returns (address) envfree;
function pendingDefaultAdminSchedule_() external returns (uint48) envfree;
// Default Admin Delay
function pendingDelay_() external returns (uint48);
function pendingDelaySchedule_() external returns (uint48);
function delayChangeWait_(uint48) external returns (uint48);
}

View File

@ -1,11 +0,0 @@
methods {
function name() external returns (string) envfree;
function symbol() external returns (string) envfree;
function decimals() external returns (uint8) envfree;
function totalSupply() external returns (uint256) envfree;
function balanceOf(address) external returns (uint256) envfree;
function allowance(address,address) external returns (uint256) envfree;
function approve(address,uint256) external returns (bool);
function transfer(address,uint256) external returns (bool);
function transferFrom(address,address,uint256) external returns (bool);
}

View File

@ -1,5 +0,0 @@
methods {
function permit(address,address,uint256,uint256,uint8,bytes32,bytes32) external;
function nonces(address) external returns (uint256) envfree;
function DOMAIN_SEPARATOR() external returns (bytes32) envfree;
}

View File

@ -1,3 +0,0 @@
methods {
function _.onFlashLoan(address,address,uint256,uint256,bytes) external => DISPATCHER(true);
}

View File

@ -1,5 +0,0 @@
methods {
function maxFlashLoan(address) external returns (uint256) envfree;
function flashFee(address,uint256) external returns (uint256) envfree;
function flashLoan(address,address,uint256,bytes) external returns (bool);
}

View File

@ -1,3 +0,0 @@
methods {
function owner() external returns (address) envfree;
}

View File

@ -1,17 +0,0 @@
methods {
// IERC721
function balanceOf(address) external returns (uint256) envfree;
function ownerOf(uint256) external returns (address) envfree;
function getApproved(uint256) external returns (address) envfree;
function isApprovedForAll(address,address) external returns (bool) envfree;
function safeTransferFrom(address,address,uint256,bytes) external;
function safeTransferFrom(address,address,uint256) external;
function transferFrom(address,address,uint256) external;
function approve(address,uint256) external;
function setApprovalForAll(address,bool) external;
// IERC721Metadata
function name() external returns (string);
function symbol() external returns (string);
function tokenURI(uint256) external returns (string);
}

View File

@ -1,3 +0,0 @@
methods {
function _.onERC721Received(address,address,uint256,bytes) external => DISPATCHER(true);
}

View File

@ -1,5 +0,0 @@
methods {
function owner() external returns (address) envfree;
function transferOwnership(address) external;
function renounceOwnership() external;
}

View File

@ -1,7 +0,0 @@
methods {
function owner() external returns (address) envfree;
function pendingOwner() external returns (address) envfree;
function transferOwnership(address) external;
function acceptOwnership() external;
function renounceOwnership() external;
}

2
contracts/.npmignore Normal file
View File

@ -0,0 +1,2 @@
mocks
examples

27
contracts/ARCHITECTURE.md Normal file
View File

@ -0,0 +1,27 @@
## Architecture
The following provides visibility into how OpenZeppelin's contracts are organized:
- **access** - Smart contracts that enable functionality that can be used for selective restrictions and basic authorization control functions.
- **crowdsale** - A collection of smart contracts used to manage token crowdsales that allow investors to purchase tokens with ETH. Includes a base contract which implements fundamental crowdsale functionality in its simplest form. The base contract can be extended in order to satisfy your crowdsales specific requirements.
- **distribution** - Includes extensions of the base crowdsale contract which can be used to customize the completion of a crowdsale.
- **emission** - Includes extensions of the base crowdsale contract which can be used to mint and manage how tokens are issued to purchasers.
- **price** - Includes extensions of the crowdsale contract that can be used to manage changes in token prices.
- **validation** - Includes extensions of the crowdsale contract that can be used to enforce restraints and limit access to token purchases.
- **examples** - A collection of simple smart contracts that demonstrate how to add new features to base contracts through multiple inheritance.
- **introspection** - An interface that can be used to make a contract comply with the ERC-165 standard as well as a contract that implements ERC-165 using a lookup table.
- **lifecycle** - A collection of base contracts used to manage the existence and behavior of your contracts and their funds.
- **math** - Libraries with safety checks on operations that throw on errors.
- **mocks** - A collection of abstract contracts that are primarily used for unit testing. They also serve as good usage examples and demonstrate how to combine contracts with inheritance when developing your own custom applications.
- **ownership** - A collection of smart contracts that can be used to manage contract and token ownership
- **payment** - A collection of smart contracts that can be used to manage payments through escrow arrangements, withdrawals, and claims. Includes support for both single payees and multiple payees.
- **proposals** - A collection of smart contracts that reflect community Ethereum Improvement Proposals (EIPs). These contracts are under development and standardization. They are not recommended for production, but they are useful for experimentation with pending EIP standards. Go [here](https://github.com/OpenZeppelin/openzeppelin-solidity/wiki/ERC-Process) for more information.
- **token** - A collection of approved ERC standard tokens -- their interfaces and implementations.
- **ERC20** - A standard interface for fungible tokens:
- *Interfaces* - Includes the ERC-20 token standard basic interface. I.e., what the contracts ABI can represent.
- *Implementations* - Includes ERC-20 token implementations that include all required and some optional ERC-20 functionality.
- **ERC721** - A standard interface for non-fungible tokens
- *Interfaces* - Includes the ERC-721 token standard basic interface. I.e., what the contracts ABI can represent.
- *Implementations* - Includes ERC-721 token implementations that include all required and some optional ERC-721 functionality.

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