diff --git a/MigratableToken.sol b/MigratableToken.sol
index 5f3f5de..98d557e 100644
--- a/MigratableToken.sol
+++ b/MigratableToken.sol
@@ -17,7 +17,7 @@ contract MigrateAgent {
}
contract MigratableToken is Token {
-
+
MigrateAgent public migrateAgent;
//Total migrated tokens
@@ -55,10 +55,10 @@ contract MigratableToken is Token {
Set migrating agent and start migrating
*/
function setMigrateAgent(MigrateAgent _agent)
- external
- onlyOwner
- notZeroAddress(_agent)
- afterCrowdsale
+ external
+ onlyOwner
+ notZeroAddress(_agent)
+ afterCrowdsale
{
//cannot interrupt migrating
require(getMigrateState() != MigrateState.Migrating);
@@ -72,7 +72,7 @@ contract MigratableToken is Token {
Migrating status
*/
function getMigrateState() public constant returns (MigrateState) {
- if (block.number <= ICO_END) {
+ if (block.number <= crowdsaleEndBlock) {
//Migration is not allowed on funding
return MigrateState.NotAllowed;
} else if (address(migrateAgent) == address(0)) {
diff --git a/README.md b/README.md
index 8fb890e..c16178e 100644
--- a/README.md
+++ b/README.md
@@ -112,12 +112,18 @@ Total supply of tokens is 100 million.
```javascript
- uint256 public constant ICO_END = 222222222;
+ uint256 public crowdsaleEndBlock = 222222222;
```
A block number that indicates when the Crowdsale ends.
```javascript
+uint256 public constant crowdsaleMaxEndBlock = 444444444;
+```
+A block number that indicates the max possible end block number.
+
+
+```javascript
mapping (address => uint256) balances;
```
An array that saves balances of the users.
@@ -260,6 +266,18 @@ To decrease allowed value is better to use this function to avoid 2 calls (and w
Allows trusted address burning a specific amount of his tokens. This function is intended to be called after the Crowdsale to burn the unsold tokens.
+```javascript
+ function updateCrowdsaleEndBlock (uint256 _crowdsaleEndBlock) {
+ //Crowdsale must be active
+ require(block.number <= crowdsaleEndBlock);
+ //Transfers can only be unlocked earlier
+ require(_crowdsaleEndBlock < crowdsaleMaxEndBlock);
+ crowdsaleEndBlock = _crowdsaleEndBlock;
+ }
+```
+Allows owner setting the new end block number to extend/close Crowdsale.
+
+
```javascript
function transferOwnership(address _newOwner) public afterCrowdsale {
super.transferOwnership(_newOwner);
@@ -279,7 +297,7 @@ This function prohibits pausing the contract when the Crowdsale is active.
#### **Modifiers**
```javascript
modifier canTransferOnCrowdsale (address _address) {
- if (block.number <= ICO_END) {
+ if (block.number <= crowdsaleEndBlock) {
//Require the end of funding or msg.sender to be trusted
require(trusted[_address]);
}
@@ -291,7 +309,7 @@ Only trusted addresses can call functions that are marked with this modifier.
```javascript
modifier afterCrowdsale {
- require(block.number > ICO_END);
+ require(block.number > crowdsaleEndBlock);
_;
}
```
@@ -1044,7 +1062,7 @@ Set a reference to the new Token. This is only possible when the migration has n
```javascript
function getMigrateState() public constant returns (MigrateState) {
- if (block.number <= ICO_END) {
+ if (block.number <= crowdsaleEndBlock) {
//Migration is not allowed on funding
return MigrateState.NotAllowed;
} else if (address(migrateAgent) == address(0)) {
diff --git a/Token.sol b/Token.sol
index d8449b8..1d1c46f 100644
--- a/Token.sol
+++ b/Token.sol
@@ -15,8 +15,10 @@ contract Token is ERC20, Pausable {
//Total amount of Gee
uint256 public _totalSupply = 100 * (10**6) * (10**8);
- //Iend of crowdsale
- uint256 public constant ICO_END = 222222222;
+ //end of crowdsale
+ uint256 public crowdsaleEndBlock = 222222222;
+ //end of crowdsale
+ uint256 public constant crowdsaleMaxEndBlock = 444444444;
//Balances for each account
mapping (address => uint256) balances;
@@ -142,6 +144,14 @@ contract Token is ERC20, Pausable {
return true;
}
+ function updateCrowdsaleEndBlock (uint256 _crowdsaleEndBlock) {
+ //Crowdsale must be active
+ require(block.number <= crowdsaleEndBlock);
+ //Transfers can only be unlocked earlier
+ require(_crowdsaleEndBlock < crowdsaleMaxEndBlock);
+ crowdsaleEndBlock = _crowdsaleEndBlock;
+ }
+
//Override transferOwnership()
function transferOwnership(address _newOwner) public afterCrowdsale {
super.transferOwnership(_newOwner);
@@ -153,7 +163,7 @@ contract Token is ERC20, Pausable {
}
modifier canTransferOnCrowdsale (address _address) {
- if (block.number <= ICO_END) {
+ if (block.number <= crowdsaleEndBlock) {
//Require the end of funding or msg.sender to be trusted
require(trusted[_address]);
}
@@ -162,7 +172,7 @@ contract Token is ERC20, Pausable {
//Some functions should work only after the Crowdsale
modifier afterCrowdsale {
- require(block.number > ICO_END);
+ require(block.number > crowdsaleEndBlock);
_;
}