Hadrien Croubois
18c7efe800
Make view and pure functions virtual ( #2473 )
...
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
4 years ago
Hadrien Croubois
c34211417c
Refactor SafeMath to avoid memory leaks ( #2462 )
...
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
4 years ago
Andre Korol
974c534210
Update contracts to support Solidity 0.8.x ( #2442 )
...
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
4 years ago
Hadrien Croubois
318c4b44ea
Move Context from GSN to utils directory ( #2453 )
...
Co-authored-by: Hadrien Croubois <hadrien@openzeppelin.com>
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
4 years ago
Alex Beregszaszi
6be0b410dc
Use explicit conversions between addresses and numbers ( #2439 )
...
Co-authored-by: hrkrshnn <webmail.hari@gmail.com>
Co-authored-by: cameel <cameel2@gmail.com>
4 years ago
Alex Beregszaszi
051d340171
Use bytes1 and avoid using the obsolete byte type ( #2438 )
4 years ago
Francisco Giordano
7f8fc584de
Remove Address.functionDelegateCall
4 years ago
Francisco Giordano
90ed1af972
Support compiling with solc 0.7 ( #2408 )
4 years ago
Nicolás Venturo
fcdf8f4618
Add BytesSet ( #2395 )
...
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
4 years ago
psykeeper
7650210ad6
Make contracts abstract if they had internal constructors ( #2383 )
4 years ago
Anton Bukov
87326f7313
Add functionStaticCall and functionDelegateCall methods to Address library ( #2333 )
...
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
4 years ago
Nikhil Desai
ae4e9845de
Fix a grammatical error in a comment ( #2352 )
...
changed a comment in the isContract function to make it grammatically right.
4 years ago
tincho
aaa5ef81cf
Fix typos ( #2343 )
4 years ago
Francisco Giordano
4eb8d2bb10
Revert "feat: use extcodesize for isContract to reduce gas ( #2311 )"
...
This reverts commit c801c8d2bb
.
5 years ago
Elena Gesheva
04fc35707d
Migrate contracts to Solidity 0.7 ( #2319 )
...
* Update contract pragmas to solidity 0.7
* Remove internal declaration on constructors
* Reference SafeMath explicitely
* Remove public constructor declaration from abstract contracts
* Remove public constructor declaration from non-abstract contracts
5 years ago
Julian M. Rodriguez
c801c8d2bb
feat: use extcodesize for isContract to reduce gas ( #2311 )
...
* feat: use extcodesize for isContract to reduce gas
* feat: add changelog entry
5 years ago
Francisco Giordano
ef3bbbcf40
Add readme notices with link to docs site ( #2300 )
...
* add readme notices
* remove period after url
5 years ago
Nicolás Venturo
02a6b05bde
Update functionCall docs
...
(cherry picked from commit 242400e9ea
)
5 years ago
Nicolás Venturo
242400e9ea
Update functionCall docs
5 years ago
Francisco Giordano
7f62c8e145
Fix docs links to overloaded functions ( #2275 )
...
* fix links to overloaded functions
* fix Address xrefs
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
5 years ago
Nicolás Venturo
b72088a90a
Add 'available since' notices
5 years ago
Julian M. Rodriguez
8b58fc7191
feat: add wrapper function for low level calls ( #2264 )
...
* feat: add wrapper function for low level calls
* add error message parameter
* adding unit tests and required mocks
* implement error message on SafeERC20
* fixed variable name in tests
* Add missing tests
* Improve docs.
* Add functionCallWithValue
* Add functionCallWithValue
* Skip balance check on non-value functionCall variants
* Increase out of gas test timeout
* Fix compile errors
* Apply suggestions from code review
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
* Add missing tests
* Add changelog entry
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
5 years ago
Nicolás Venturo
fac773ac99
Add SPX license identifier ( #2235 )
...
(cherry picked from commit 56de324afe
)
5 years ago
Anton Bukov
d418da6b91
Decrease CREATE2 address computation gas usage from 623 to 539 ( #2244 )
...
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
5 years ago
Julian M. Rodriguez
5513dfd3cf
Adding SafeCast variants for signed integers ( #2243 )
...
* feat: Adding SafeCast variants for signed integers
* Add newline at EOF
* Update CHANGELOG.md
* Update contracts/utils/SafeCast.sol
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
5 years ago
Nicolás Venturo
56de324afe
Add SPX license identifier ( #2235 )
5 years ago
Brendan Chou
cfa9ad9943
Fix ReentrancyGuard for Proxy Pattern ( #2171 )
...
* Fix ReentrancyGuard for Proxy Pattern
* Update ReentrancyGuard.sol
* Change constant values
* Add changelog entry
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
5 years ago
Nicolás Venturo
c20e620a06
Improve Pausable docs
5 years ago
Nicolás Venturo
5bb8d0245b
Improve Hooks documentation ( #2199 )
...
* Improve Hooks docs
* Improve Utils docs
* Apply suggestions from code review
Co-Authored-By: Francisco Giordano <frangio.1@gmail.com>
* Add enumerable code samples
* Remove import statement from example
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
5 years ago
Nicolás Venturo
cca71ab709
Fix deprecation warnings ( #2115 )
...
* Fix deprecation warnings
* Workaround linter bug
5 years ago
Francisco Giordano
8b10cb38d8
Rename Strings.fromUint256 to Strings.toString ( #2188 )
...
* rename Strings.fromUint256 to Strings.toString
* add changelog entry
* fix conflict with js toString method
5 years ago
Nicolás Venturo
c4e5daff86
Fix Pausable docs
5 years ago
Nicolás Venturo
402c6ab4cc
Update docs ( #2168 )
...
* Update docs for ERC20 and ERC721
* Add EnumerableMap to docs
* Update misc guides
* Apply suggestions from code review
Co-Authored-By: Francisco Giordano <frangio.1@gmail.com>
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
5 years ago
Nicolás Venturo
bd0778461d
Add EnumerableMap, refactor ERC721 ( #2160 )
...
* Implement AddressSet in terms of a generic Set
* Add Uint256Set
* Add EnumerableMap
* Fix wording on EnumerableSet docs and tests
* Refactor ERC721 using EnumerableSet and EnumerableMap
* Fix tests
* Fix linter error
* Gas optimization for EnumerableMap
* Gas optimization for EnumerableSet
* Remove often not-taken if from Enumerable data structures
* Fix failing test
* Gas optimization for EnumerableMap
* Fix linter errors
* Add comment for clarification
* Improve test naming
* Rename EnumerableMap.add to set
* Add overload for EnumerableMap.get with custom error message
* Improve Enumerable docs
* Rename Uint256Set to UintSet
* Add changelog entry
5 years ago
corydickson
feb7ead005
Add revert if the bytecode length is zero ( #2117 )
...
* Add revert if the bytecode length is not greater than zero
* Add value parameter to create2 deploy function
Add tests for contract balance revert and depositing funds
* Change parameter name to amount for clarity
* Fix test for value sending
* Fix linter error
* Change revert reason
* Improve Create2.deploy documentation
* Slight test improvement
* Add changelog entry
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
5 years ago
Nicolás Venturo
7415ebe8bc
API improvements for EnumerableSet ( #2151 )
...
* Add revert reason to EnumerableSet.get.
* Rename EnumerableSet values to keys
* Rename get to at
* Add changelog entry
* Rename keys to values
* Add leading underscore to struct members
5 years ago
pepelu
4476a2d531
Unsigned conversion #2111 ( #2123 )
...
* Add signed to unsigned conversion to SafeCast
* Update SafeCast exception message
* Add test for SafeCast int to uint conversion
- Update SafeCastMock
- Add tests for SafeCast int256 to uint256
* Update SafeCast int to uint definition
Apply suggestions from code review.
Co-Authored-By: Nicolás Venturo <nicolas.venturo@gmail.com>
* Update test for SafeCast int to uint conversion
* Update SafeCast test after code review
- Change "downcasts" to "casts"
- Move test closer to its function
* Fix error in SafeCast toUint256 description
* Fix breaking error in SafeCast
* Add uint256 to int256 conversion to SafeCast
- Add function
- Add mock
- Add test
* Update SafeCast unsigned to signed conversion
- Update error in conversion to be more clear
- Update constants in test to be powers of 2 instead of shifts
* Add changelog entry
* Update SafeCast tests
- Add minus in INT256_MIN for clarity
Co-Authored-By: Nicolás Venturo <nicolas.venturo@gmail.com>
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
5 years ago
Nicolás Venturo
a8d6f13c94
Remove all 'available since' notices
5 years ago
Nicolás Venturo
9975a1a0c2
Remove Address.toPayable ( #2133 )
...
* Remove Address.toPayable
* Add changelog entry
5 years ago
Nicolás Venturo
c9630526e2
Draft and lifecycles directories cleanup ( #2122 )
...
* Move Pausable into utils
* Move Strings into utils
* Move Counters into utils
* Move SignedSafeMath into math
* Remove ERC1046
* Make ERC20Snapshot.snapshot internal
* Move ERC20Snapshot into ERC20
* Add drafts deprecation notice
* Remove drafts directory
* Add changelog entry
* Apply suggestions from code review
Co-Authored-By: Francisco Giordano <frangio.1@gmail.com>
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
5 years ago
Anton Bukov
e2813df879
Use bytes32 explicitly for Create2.computeAddress() ( #2088 )
...
* Use bytes32 explicitly for Create2.computeAddress(), to force users cache hash of the bytecode
* Remove only from test :)
5 years ago
Anton Bukov
19417c7cd5
Rename CREATE2 argument from bytecodeHash to bytecode and add new method for precomputed bytecode hash ( #2087 )
...
* Rename CREATE2 argument from bytecodeHash to bytecode and add new method for precomputed bytecode hash
* Remove only from test
* Fix linter error
5 years ago
Nicolás Venturo
5dfe7215a9
Migrate Contracts to Solidity v0.6 ( #2080 )
...
* Initial migration to Solidity 0.6.x - v3.0 first steps (#2063 )
* Initial migration, missing GSN, 721, 777 and Crowdsales.
* Add _beforeTokenOperation and _afterTokenOperation.
* Add documentation for hooks.
* Add hooks doc
* Add missing drafts
* Add back ERC721 with hooks
* Bring back ERC777
* Notes on hooks
* Bring back GSN
* Make functions virtual
* Make GSN overrides explicit
* Fix ERC20Pausable tests
* Remove virtual from some view functions
* Update linter
* Delete examples
* Remove unnecessary virtual
* Remove roles from Pausable
* Remove roles
* Remove users of roles
* Adapt ERC20 tests
* Fix ERC721 tests
* Add all ERC721 hooks
* Add ERC777 hooks
* Fix remaining tests
* Bump compiler version
* Move 721BurnableMock into mocks directory
* Remove _before hooks
* Fix tests
* Upgrade linter
* Put modifiers last
* Remove _beforeTokenApproval and _beforeOperatorApproval hooks
5 years ago
Nicolás Venturo
941d305044
Update docs
5 years ago
Nicolás Venturo
1b938e39a8
EnumerableSet improvements ( #2077 )
...
* Remove newAddressSet
* Add count and get functions.
* Fix lint
(cherry picked from commit 7988c044e0
)
5 years ago
Nicolás Venturo
7988c044e0
EnumerableSet improvements ( #2077 )
...
* Remove newAddressSet
* Add count and get functions.
* Fix lint
5 years ago
Alberto Cuesta Cañada
1e0f07751e
Implementation of an address Enumerable Set ( #2061 )
...
* Drafted Enumerable.sol.
* Drafted test framework.
* Tweaked the tests to follow oz structure.
* Coded EnumerableSet.
* Moved EnumerableSet to `utils`.
* Fixed linting.
* Improved comments.
* Tweaked contract description.
* Renamed struct to AddressSet.
* Relaxed version pragma to 0.5.0
* Removed events.
* Revert on useless operations.
* Small comment.
* Created AddressSet factory method.
* Failed transactions return false.
* Transactions now return false on failure.
* Remove comments from mock
* Rename mock functions
* Adapt tests to code style, use test-helpers
* Fix bug in remove, improve tests.
* Add changelog entry
* Add entry on Utils doc
* Add optimization for removal of last slot
* Update docs
* Fix headings of utilities documentation
Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
5 years ago
Nicolás Venturo
e493fb3e95
Add 'available since' notes. Fixes #2054
5 years ago
Francisco Giordano
8c40a5b275
Create2 feature pending tasks ( #2013 )
...
* Add Create2 library (#1744 )
* feat(contracts): Add Create2 library to use create2 evm opcode
* Upgrade sol-coverage
* Add changelog entry
* Update comments and code style
* Remove create2 helper
* Fix linter error
* Fix truffle dependency
* Fix linter error
* refactor(Create2): Remove _deploy internal function
* test(Create2): test Create2 with inline assembly code
* fix(Create2): Check address returned form create2 instead of codesize of created contract
* refactor(Create2):Add revert reason when Create2 deploy fails (#2062 )
* fix merge with master
* fix test
Co-authored-by: Augusto Lemble <me@augustol.com>
5 years ago
Francisco Giordano
06983a2075
add note suggesting reentrancy post ( #2059 )
5 years ago