Skip to content

Commit 1d419b3

Browse files
committed
Merge branch 'master' into less-helpers
2 parents 793a100 + f7e53d9 commit 1d419b3

27 files changed

+371
-224
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Bug report
3+
about: Report a bug in OpenZeppelin
4+
5+
---
6+
7+
<!-- Briefly describe the issue you're experiencing. Tell us what you were trying to do and what happened instead. -->
8+
9+
<!-- 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/. -->
10+
11+
**💻 Environment**
12+
13+
<!-- Tell us what version of OpenZeppelin you're using, and how you're using it: Truffle, Remix, etc. -->
14+
15+
**📝 Details**
16+
17+
<!-- Describe the problem you have been experiencing in more detail. Include as much information as you think is relevant. Keep in mind that transactions can fail for many reasons; context is key here. -->
18+
19+
**🔢 Code to reproduce bug**
20+
21+
<!-- We will be able to better help if you provide a minimal example that triggers the bug. -->
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for OpenZeppelin
4+
5+
---
6+
7+
**🧐 Motivation**
8+
<!-- Is your feature request related to a specific problem? Is it just a crazy idea? Tell us about it! -->
9+
10+
**📝 Details**
11+
<!-- Please describe your feature request in detail. -->
12+
13+
<!-- Make sure that you have reviewed the OpenZeppelin Contributor Guidelines. -->
14+
<!-- https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CONTRIBUTING.md -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<!-- 0. 🎉 Thank you for submitting a PR! -->
22

3-
<!-- 1. **Does this close any open issues?** If so, list them here. If not, remove the `Fixes #` line. -->
3+
<!-- 1. Does this close any open issues? Please list them below. -->
44

5-
Fixes #
5+
<!-- Keep in mind that new features have a better chance of being merged fast if
6+
they were first discussed and designed with the maintainers. If there is no
7+
corresponding issue, please consider opening one for discussion first! -->
68

7-
# 🚀 Description
9+
Fixes #
810

9-
<!-- 2. Describe the changes introduced in this pull request -->
11+
<!-- 2. Describe the changes introduced in this pull request. -->
1012
<!-- Include any context necessary for understanding the PR's purpose. -->
1113

12-
<!-- 3. Before submitting, please review the following checklist: -->
13-
14-
- [ ] 📘 I've reviewed the [OpenZeppelin Contributor Guidelines](../blob/master/CONTRIBUTING.md)
15-
- [ ] ✅ I've added tests where applicable to test my new functionality.
16-
- [ ] 📖 I've made sure that my contracts are well-documented.
17-
- [ ] 🎨 I've run the JS/Solidity linters and fixed any issues (`npm run lint:fix`).
14+
<!-- 3. Before submitting, please make sure that you have:
15+
- reviewed the OpenZeppelin Contributor Guidelines
16+
(https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CONTRIBUTING.md),
17+
- added tests where applicable to test new functionality,
18+
- made sure that your contracts are well-documented, and
19+
- run the JS/Solidity linters and fixed any issues (`npm run lint:fix`).
20+
-->

RELEASING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ git push upstream vX.Y.Z-rc.R
3434

3535
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.
3636

37+
Before publishing on npm you need to generate the build artifacts. This is not done automatically at the moment because of a bug in Truffle. Since some of the contracts should not be included in the package, this is a _hairy_ process that you need to do with care.
38+
39+
1. Delete the `contracts/mocks` and `contracts/examples` directories.
40+
2. Run `truffle compile`. (Note that the Truffle process may never exit and you will have to interrupt it.)
41+
3. Recover the directories using `git checkout`. It doesn't matter if you do this now or later.
42+
3743
Once the CI run for the new tag is green, publish on npm under the `next` tag.
3844

3945
```
@@ -62,6 +68,12 @@ git push upstream vX.Y.Z
6268

6369
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.
6470

71+
Before publishing on npm you need to generate the build artifacts. This is not done automatically at the moment because of a bug in Truffle. Since some of the contracts should not be included in the package, this is a _hairy_ process that you need to do with care.
72+
73+
1. Delete the `contracts/mocks` and `contracts/examples` directories.
74+
2. Run `truffle compile`. (Note that the Truffle process may never exit and you will have to interrupt it.)
75+
3. Recover the directories using `git checkout`. It doesn't matter if you do this now or later.
76+
6577
Once the CI run for the new tag is green, publish on npm.
6678

6779
```

contracts/bounties/BreakInvariantBounty.sol

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,25 @@ import "../ownership/Ownable.sol";
88
* @dev This bounty will pay out to a researcher if they break invariant logic of the contract.
99
*/
1010
contract BreakInvariantBounty is PullPayment, Ownable {
11-
bool private _claimed;
11+
bool private _claimable = true;
1212
mapping(address => address) private _researchers;
1313

1414
event TargetCreated(address createdAddress);
15+
event BountyCanceled();
1516

1617
/**
1718
* @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed.
1819
*/
1920
function() external payable {
20-
require(!_claimed);
21+
require(_claimable);
2122
}
2223

2324
/**
24-
* @dev Determine if the bounty was claimed.
25-
* @return true if the bounty was claimed, false otherwise.
25+
* @dev Determine if the bounty is claimable.
26+
* @return false if the bounty was claimed, true otherwise.
2627
*/
27-
function claimed() public view returns(bool) {
28-
return _claimed;
28+
function claimable() public view returns(bool) {
29+
return _claimable;
2930
}
3031

3132
/**
@@ -45,19 +46,23 @@ contract BreakInvariantBounty is PullPayment, Ownable {
4546
* @param target contract
4647
*/
4748
function claim(Target target) public {
49+
require(_claimable);
4850
address researcher = _researchers[target];
4951
require(researcher != address(0));
5052
// Check Target contract invariants
5153
require(!target.checkInvariant());
5254
_asyncTransfer(researcher, address(this).balance);
53-
_claimed = true;
55+
_claimable = false;
5456
}
5557

5658
/**
57-
* @dev Transfers the current balance to the owner and terminates the contract.
59+
* @dev Cancels the bounty and transfers all funds to the owner
5860
*/
59-
function destroy() public onlyOwner {
60-
selfdestruct(owner());
61+
function cancelBounty() public onlyOwner{
62+
require(_claimable);
63+
_asyncTransfer(owner(), address(this).balance);
64+
_claimable = false;
65+
emit BountyCanceled();
6166
}
6267

6368
/**

contracts/mocks/ArraysImpl.sol

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pragma solidity ^0.4.24;
2+
3+
import "../utils/Arrays.sol";
4+
5+
contract ArraysImpl {
6+
7+
using Arrays for uint256[];
8+
9+
uint256[] private array;
10+
11+
constructor(uint256[] _array) public {
12+
array = _array;
13+
}
14+
15+
function findUpperBound(uint256 _element) external view returns (uint256) {
16+
return array.findUpperBound(_element);
17+
}
18+
}

contracts/mocks/ERC721FullMock.sol

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ pragma solidity ^0.4.24;
22

33
import "../token/ERC721/ERC721Full.sol";
44
import "../token/ERC721/ERC721Mintable.sol";
5+
import "../token/ERC721/ERC721MetadataMintable.sol";
56
import "../token/ERC721/ERC721Burnable.sol";
67

78
/**
8-
* @title ERC721Mock
9+
* @title ERC721FullMock
910
* This mock just provides a public mint and burn functions for testing purposes,
1011
* and a public setter for metadata URI
1112
*/
12-
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721Burnable {
13+
contract ERC721FullMock
14+
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
15+
1316
constructor(string name, string symbol) public
1417
ERC721Mintable()
1518
ERC721Full(name, symbol)

contracts/mocks/ERC721MintableBurnableImpl.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ pragma solidity ^0.4.24;
22

33
import "../token/ERC721/ERC721Full.sol";
44
import "../token/ERC721/ERC721Mintable.sol";
5+
import "../token/ERC721/ERC721MetadataMintable.sol";
56
import "../token/ERC721/ERC721Burnable.sol";
67

78
/**
89
* @title ERC721MintableBurnableImpl
910
*/
1011
contract ERC721MintableBurnableImpl
11-
is ERC721Full, ERC721Mintable, ERC721Burnable {
12+
is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
1213

1314
constructor()
1415
ERC721Mintable()

contracts/mocks/ForceEther.sol

Lines changed: 0 additions & 15 deletions
This file was deleted.

contracts/mocks/MessageHelper.sol

Lines changed: 0 additions & 49 deletions
This file was deleted.

contracts/payment/RefundEscrow.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
pragma solidity ^0.4.24;
22

33
import "./ConditionalEscrow.sol";
4-
import "../ownership/Secondary.sol";
54

65
/**
76
* @title RefundEscrow
87
* @dev Escrow that holds funds for a beneficiary, deposited from multiple parties.
98
* The primary account may close the deposit period, and allow for either withdrawal
109
* by the beneficiary, or refunds to the depositors.
1110
*/
12-
contract RefundEscrow is Secondary, ConditionalEscrow {
11+
contract RefundEscrow is ConditionalEscrow {
1312
enum State { Active, Refunding, Closed }
1413

1514
event Closed();

contracts/token/ERC20/ERC20.sol

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,44 +168,44 @@ contract ERC20 is IERC20 {
168168
* an account. This encapsulates the modification of balances such that the
169169
* proper events are emitted.
170170
* @param account The account that will receive the created tokens.
171-
* @param amount The amount that will be created.
171+
* @param value The amount that will be created.
172172
*/
173-
function _mint(address account, uint256 amount) internal {
173+
function _mint(address account, uint256 value) internal {
174174
require(account != 0);
175-
_totalSupply = _totalSupply.add(amount);
176-
_balances[account] = _balances[account].add(amount);
177-
emit Transfer(address(0), account, amount);
175+
_totalSupply = _totalSupply.add(value);
176+
_balances[account] = _balances[account].add(value);
177+
emit Transfer(address(0), account, value);
178178
}
179179

180180
/**
181181
* @dev Internal function that burns an amount of the token of a given
182182
* account.
183183
* @param account The account whose tokens will be burnt.
184-
* @param amount The amount that will be burnt.
184+
* @param value The amount that will be burnt.
185185
*/
186-
function _burn(address account, uint256 amount) internal {
186+
function _burn(address account, uint256 value) internal {
187187
require(account != 0);
188-
require(amount <= _balances[account]);
188+
require(value <= _balances[account]);
189189

190-
_totalSupply = _totalSupply.sub(amount);
191-
_balances[account] = _balances[account].sub(amount);
192-
emit Transfer(account, address(0), amount);
190+
_totalSupply = _totalSupply.sub(value);
191+
_balances[account] = _balances[account].sub(value);
192+
emit Transfer(account, address(0), value);
193193
}
194194

195195
/**
196196
* @dev Internal function that burns an amount of the token of a given
197197
* account, deducting from the sender's allowance for said account. Uses the
198198
* internal burn function.
199199
* @param account The account whose tokens will be burnt.
200-
* @param amount The amount that will be burnt.
200+
* @param value The amount that will be burnt.
201201
*/
202-
function _burnFrom(address account, uint256 amount) internal {
203-
require(amount <= _allowed[account][msg.sender]);
202+
function _burnFrom(address account, uint256 value) internal {
203+
require(value <= _allowed[account][msg.sender]);
204204

205205
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
206206
// this function needs to emit an event with the updated approval.
207207
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
208-
amount);
209-
_burn(account, amount);
208+
value);
209+
_burn(account, value);
210210
}
211211
}

0 commit comments

Comments
 (0)