adapt contracts for upgradeability
This commit is contained in:
@ -10,6 +10,10 @@ import "../ownership/Ownable.sol";
|
||||
contract Migrations is Ownable {
|
||||
uint256 public lastCompletedMigration;
|
||||
|
||||
function Migrations() public {
|
||||
Ownable.initialize(msg.sender);
|
||||
}
|
||||
|
||||
function setCompleted(uint256 completed) onlyOwner public {
|
||||
lastCompletedMigration = completed;
|
||||
}
|
||||
|
||||
@ -5,5 +5,7 @@ import "../token/ERC20/DetailedERC20.sol";
|
||||
|
||||
|
||||
contract DetailedERC20Mock is StandardToken, DetailedERC20 {
|
||||
function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) DetailedERC20(_name, _symbol, _decimals) public {}
|
||||
function DetailedERC20Mock(string _name, string _symbol, uint8 _decimals) public {
|
||||
DetailedERC20.initialize(_name, _symbol, _decimals);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,9 +9,9 @@ import "../token/ERC721/ERC721Token.sol";
|
||||
* and a public setter for metadata URI
|
||||
*/
|
||||
contract ERC721TokenMock is ERC721Token {
|
||||
function ERC721TokenMock(string name, string symbol) public
|
||||
ERC721Token(name, symbol)
|
||||
{ }
|
||||
function ERC721TokenMock(string name, string symbol) public {
|
||||
ERC721Token.initialize(name, symbol);
|
||||
}
|
||||
|
||||
function mint(address _to, uint256 _tokenId) public {
|
||||
super._mint(_to, _tokenId);
|
||||
|
||||
@ -10,6 +10,8 @@ contract PausableMock is Pausable {
|
||||
uint256 public count;
|
||||
|
||||
function PausableMock() public {
|
||||
Ownable.initialize(msg.sender);
|
||||
|
||||
drasticMeasureTaken = false;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import "../token/ERC20/PausableToken.sol";
|
||||
contract PausableTokenMock is PausableToken {
|
||||
|
||||
function PausableTokenMock(address initialAccount, uint initialBalance) public {
|
||||
Ownable.initialize(msg.sender);
|
||||
|
||||
balances[initialAccount] = initialBalance;
|
||||
}
|
||||
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
pragma solidity ^0.4.21;
|
||||
|
||||
import 'zos-lib/contracts/migrations/Migratable.sol';
|
||||
|
||||
/**
|
||||
* @title Ownable
|
||||
* @dev The Ownable contract has an owner address, and provides basic authorization control
|
||||
* functions, this simplifies the implementation of "user permissions".
|
||||
*/
|
||||
contract Ownable {
|
||||
contract Ownable is Migratable {
|
||||
address public owner;
|
||||
|
||||
|
||||
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
||||
|
||||
|
||||
/**
|
||||
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
|
||||
* account.
|
||||
*/
|
||||
function Ownable() public {
|
||||
owner = msg.sender;
|
||||
function initialize(address _sender) public isInitializer("Ownable", "0") {
|
||||
owner = _sender;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
pragma solidity ^0.4.21;
|
||||
|
||||
import "./ERC20.sol";
|
||||
import 'zos-lib/contracts/migrations/Migratable.sol';
|
||||
|
||||
|
||||
contract DetailedERC20 is ERC20 {
|
||||
contract DetailedERC20 is Migratable, ERC20 {
|
||||
string public name;
|
||||
string public symbol;
|
||||
uint8 public decimals;
|
||||
|
||||
function DetailedERC20(string _name, string _symbol, uint8 _decimals) public {
|
||||
function initialize(address _sender, string _name, string _symbol, uint8 _decimals) public isInitializer("DetailedERC20", "0") {
|
||||
name = _name;
|
||||
symbol = _symbol;
|
||||
decimals = _decimals;
|
||||
|
||||
@ -2,7 +2,7 @@ pragma solidity ^0.4.21;
|
||||
|
||||
import "./StandardToken.sol";
|
||||
import "../../ownership/Ownable.sol";
|
||||
|
||||
import "zos-lib/contracts/migrations/Migratable.sol";
|
||||
|
||||
/**
|
||||
* @title Mintable token
|
||||
@ -10,7 +10,7 @@ import "../../ownership/Ownable.sol";
|
||||
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
|
||||
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
|
||||
*/
|
||||
contract MintableToken is StandardToken, Ownable {
|
||||
contract MintableToken is Migratable, Ownable, StandardToken {
|
||||
event Mint(address indexed to, uint256 amount);
|
||||
event MintFinished();
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
pragma solidity ^0.4.21;
|
||||
|
||||
import "./SafeERC20.sol";
|
||||
|
||||
import "zos-lib/contracts/migrations/Migratable.sol";
|
||||
|
||||
/**
|
||||
* @title TokenTimelock
|
||||
* @dev TokenTimelock is a token holder contract that will allow a
|
||||
* beneficiary to extract the tokens after a given release time
|
||||
*/
|
||||
contract TokenTimelock {
|
||||
contract TokenTimelock is Migratable {
|
||||
using SafeERC20 for ERC20Basic;
|
||||
|
||||
// ERC20 basic token contract being held
|
||||
@ -20,7 +20,7 @@ contract TokenTimelock {
|
||||
// timestamp when token release is enabled
|
||||
uint256 public releaseTime;
|
||||
|
||||
function TokenTimelock(ERC20Basic _token, address _beneficiary, uint256 _releaseTime) public {
|
||||
function initialize(address _sender, ERC20Basic _token, address _beneficiary, uint256 _releaseTime) public isInitializer("TokenTimelock", "0") {
|
||||
// solium-disable-next-line security/no-block-members
|
||||
require(_releaseTime > block.timestamp);
|
||||
token = _token;
|
||||
|
||||
@ -6,6 +6,7 @@ import "./ERC20Basic.sol";
|
||||
import "./SafeERC20.sol";
|
||||
import "../../ownership/Ownable.sol";
|
||||
import "../../math/SafeMath.sol";
|
||||
import 'zos-lib/contracts/migrations/Migratable.sol';
|
||||
|
||||
|
||||
/**
|
||||
@ -14,7 +15,7 @@ import "../../math/SafeMath.sol";
|
||||
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
|
||||
* owner.
|
||||
*/
|
||||
contract TokenVesting is Ownable {
|
||||
contract TokenVesting is Migratable, Ownable {
|
||||
using SafeMath for uint256;
|
||||
using SafeERC20 for ERC20Basic;
|
||||
|
||||
@ -42,7 +43,8 @@ contract TokenVesting is Ownable {
|
||||
* @param _duration duration in seconds of the period in which the tokens will vest
|
||||
* @param _revocable whether the vesting is revocable or not
|
||||
*/
|
||||
function TokenVesting(
|
||||
function initialize(
|
||||
address _sender,
|
||||
address _beneficiary,
|
||||
uint256 _start,
|
||||
uint256 _cliff,
|
||||
@ -50,7 +52,10 @@ contract TokenVesting is Ownable {
|
||||
bool _revocable
|
||||
)
|
||||
public
|
||||
isInitializer("TokenVesting", "0")
|
||||
{
|
||||
Ownable.initialize(_sender);
|
||||
|
||||
require(_beneficiary != address(0));
|
||||
require(_cliff <= _duration);
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ pragma solidity ^0.4.21;
|
||||
|
||||
import "./ERC721.sol";
|
||||
import "./ERC721BasicToken.sol";
|
||||
import "zos-lib/contracts/migrations/Migratable.sol";
|
||||
|
||||
|
||||
/**
|
||||
@ -10,7 +11,7 @@ import "./ERC721BasicToken.sol";
|
||||
* Moreover, it includes approve all functionality using operator terminology
|
||||
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
|
||||
*/
|
||||
contract ERC721Token is ERC721, ERC721BasicToken {
|
||||
contract ERC721Token is Migratable, ERC721, ERC721BasicToken {
|
||||
// Token name
|
||||
string internal name_;
|
||||
|
||||
@ -35,7 +36,7 @@ contract ERC721Token is ERC721, ERC721BasicToken {
|
||||
/**
|
||||
* @dev Constructor function
|
||||
*/
|
||||
function ERC721Token(string _name, string _symbol) public {
|
||||
function initialize(address _sender, string _name, string _symbol) public isInitializer("ERC721Token", "0") {
|
||||
name_ = _name;
|
||||
symbol_ = _symbol;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user