Release v2.1.0 solc 0.5.x (#1568)

* Now compiling in a separate directory using truffle 5.

* Ported to 0.5.1, now compiling using 0.5.1.

* test now also compiles using the truffle 5 hack.

* Downgraded to 0.5.0.

* Sorted scripts.

* Cleaned up the compile script a bit.
This commit is contained in:
Nicolás Venturo
2018-12-20 12:26:43 -03:00
committed by GitHub
parent 02f9727dd8
commit be5ed7364b
127 changed files with 284 additions and 236 deletions

View File

@ -1,6 +1,6 @@
/* solium-disable security/no-block-members */
pragma solidity ^0.4.24;
pragma solidity ^0.5.0;
import "../token/ERC20/SafeERC20.sol";
import "../ownership/Ownable.sol";
@ -112,11 +112,11 @@ contract TokenVesting is Ownable {
require(unreleased > 0);
_released[token] = _released[token].add(unreleased);
_released[address(token)] = _released[address(token)].add(unreleased);
token.safeTransfer(_beneficiary, unreleased);
emit TokensReleased(token, unreleased);
emit TokensReleased(address(token), unreleased);
}
/**
@ -126,18 +126,18 @@ contract TokenVesting is Ownable {
*/
function revoke(IERC20 token) public onlyOwner {
require(_revocable);
require(!_revoked[token]);
require(!_revoked[address(token)]);
uint256 balance = token.balanceOf(address(this));
uint256 unreleased = _releasableAmount(token);
uint256 refund = balance.sub(unreleased);
_revoked[token] = true;
_revoked[address(token)] = true;
token.safeTransfer(owner(), refund);
emit TokenVestingRevoked(token);
emit TokenVestingRevoked(address(token));
}
/**
@ -145,7 +145,7 @@ contract TokenVesting is Ownable {
* @param token ERC20 token which is being vested
*/
function _releasableAmount(IERC20 token) private view returns (uint256) {
return _vestedAmount(token).sub(_released[token]);
return _vestedAmount(token).sub(_released[address(token)]);
}
/**
@ -154,11 +154,11 @@ contract TokenVesting is Ownable {
*/
function _vestedAmount(IERC20 token) private view returns (uint256) {
uint256 currentBalance = token.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(_released[token]);
uint256 totalBalance = currentBalance.add(_released[address(token)]);
if (block.timestamp < _cliff) {
return 0;
} else if (block.timestamp >= _start.add(_duration) || _revoked[token]) {
} else if (block.timestamp >= _start.add(_duration) || _revoked[address(token)]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);