More comments
This commit is contained in:
parent
83ae2e9beb
commit
8858938444
|
@ -1,4 +1,29 @@
|
|||
pragma solidity ^0.4.8;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
/*
|
||||
Copyright 2017, Jordi Baylina
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// @title ContributionWallet Contract
|
||||
/// @author Jordi Baylina
|
||||
/// @dev This contract will be hold the Ether during the contribution period.
|
||||
/// The idea of this contract is to avoid recycling Ether during the contribution
|
||||
/// period. So all the ETH collected will be locked here until the contribution
|
||||
/// period ends
|
||||
|
||||
|
||||
import "./StatusContribution.sol";
|
||||
|
||||
|
|
|
@ -1,4 +1,45 @@
|
|||
pragma solidity ^0.4.6;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
/*
|
||||
Copyright 2017, Jordi Baylina
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// @title DevTokensHolder Contract
|
||||
/// @author Jordi Baylina
|
||||
/// @dev This contract will be hold tokens of the developers.
|
||||
/// Tokens will not be able to be collected until 6 months after the contribution
|
||||
/// period ends. And it will be increasing linearly until 2 years.
|
||||
|
||||
|
||||
// collectable tokens
|
||||
// | _/-------- vestedTokens rect
|
||||
// | _/
|
||||
// | _/
|
||||
// | _/
|
||||
// | _/
|
||||
// | _/
|
||||
// | _/
|
||||
// | _/
|
||||
// | |
|
||||
// | . |
|
||||
// | . |
|
||||
// | . |
|
||||
// +===+======+--------------+----------> time
|
||||
// Contrib 6 Months 24 Months
|
||||
// End
|
||||
|
||||
import "./MiniMeToken.sol";
|
||||
import "./StatusContribution.sol";
|
||||
|
@ -16,6 +57,8 @@ contract DevTokensHolder is Owned, SafeMath {
|
|||
snt = MiniMeToken(_snt);
|
||||
}
|
||||
|
||||
|
||||
/// @notice The Dev (Owner) will call this method to extract the tokens
|
||||
function collectTokens() onlyOwner {
|
||||
uint balance = snt.balanceOf(address(this));
|
||||
uint total = safeAdd(collectedTokens, snt.balanceOf(address(this)));
|
||||
|
|
|
@ -1,5 +1,31 @@
|
|||
pragma solidity ^0.4.11;
|
||||
|
||||
/*
|
||||
Copyright 2017, Jordi Baylina
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// @title DynamicCeiling Contract
|
||||
/// @author Jordi Baylina
|
||||
/// @dev This contract calculates the A cailing from a series of points.
|
||||
/// This points are commited firs and revealed later.
|
||||
/// All the points must be in increasing order and the last point is marked
|
||||
/// as the last one.
|
||||
/// This contract allows to hide and reveal the ceiling at will of the owner.
|
||||
|
||||
|
||||
import "./SafeMath.sol";
|
||||
|
||||
contract DynamicCeiling is SafeMath {
|
||||
|
@ -20,6 +46,12 @@ contract DynamicCeiling is SafeMath {
|
|||
creator = msg.sender;
|
||||
}
|
||||
|
||||
/// @notice This should be called by the creator of the contract to commit
|
||||
/// all the points of the curve.
|
||||
/// @param _pointHashes Array of hashes of each point. Each hash is callculated
|
||||
/// by the `calculateHash` method. More hashes that the actual points of the curve
|
||||
/// can be commited in order to hide also the number of points of the curve.
|
||||
/// The remaining hashes can be just random numbers.
|
||||
function setHiddenPoints(bytes32[] _pointHashes) {
|
||||
if (msg.sender != creator) throw;
|
||||
if (points.length > 0) throw;
|
||||
|
@ -31,7 +63,13 @@ contract DynamicCeiling is SafeMath {
|
|||
}
|
||||
|
||||
|
||||
function revealPoint(uint _block, uint _limit, bool _last, uint _salt) {
|
||||
/// @notice Any body can revel the next point of the curve if he knows it.
|
||||
/// @param _block Block number where this point of the curve is defined.
|
||||
/// (Must be greater than the previous one)
|
||||
/// @param _limit Ceiling cat at that block.
|
||||
/// @param _last `true` if it's the last point of the curve.
|
||||
/// @param _salt Random number used to commit the point
|
||||
function revealPoint(uint _block, uint _limit, bool _last, bytes32 _salt) {
|
||||
if (allRevealed) throw;
|
||||
if (points[revealedPoints].hash != sha3(_block, _limit, _last, _salt)) throw;
|
||||
if (revealedPoints > 0) {
|
||||
|
@ -45,6 +83,7 @@ contract DynamicCeiling is SafeMath {
|
|||
if (_last) allRevealed = true;
|
||||
}
|
||||
|
||||
/// @return Return the limit at specific block number
|
||||
function cap(uint _block) constant returns (uint) {
|
||||
if (revealedPoints == 0) return 0;
|
||||
|
||||
|
@ -75,10 +114,19 @@ contract DynamicCeiling is SafeMath {
|
|||
|
||||
}
|
||||
|
||||
function calculateHash(uint _block, uint _limit, bool _last, uint _salt) constant returns (bytes32) {
|
||||
/// @notice Calculates the hash of a point.
|
||||
/// @param _block Block number where this point of the curve is defined.
|
||||
/// (Must be greater than the previous one)
|
||||
/// @param _limit Ceiling cat at that block.
|
||||
/// @param _last `true` if it's the last point of the curve.
|
||||
/// @param _salt Random number that will be needed to reveal this point.
|
||||
/// @return The calculated hash of this point to be used in the
|
||||
/// `setHiddenPoints` method
|
||||
function calculateHash(uint _block, uint _limit, bool _last, bytes32 _salt) constant returns (bytes32) {
|
||||
return sha3(_block, _limit, _last, _salt);
|
||||
}
|
||||
|
||||
/// @return Return the total number of points commited
|
||||
function nPoints() constant returns(uint) {
|
||||
return points.length;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.6;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
/*
|
||||
Copyright 2016, Jordi Baylina
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.8;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
|
||||
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.6;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
/// @dev `Owned` is a base level contract that assigns an `owner` that can be
|
||||
/// later changed
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.8;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
import "./MiniMeToken.sol";
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ contract SGTExchanger is TokenController, SafeMath, Owned {
|
|||
/// @param _token The address of the token contract that you want to recover
|
||||
/// set to 0 in case you want to extract ether.
|
||||
function claimTokens(address _token) onlyOwner {
|
||||
if (_token == address(snt)) throw;
|
||||
if (_token == 0x0) {
|
||||
owner.transfer(this.balance);
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.8;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
import "./MiniMeToken.sol";
|
||||
|
||||
|
|
|
@ -1,23 +1,34 @@
|
|||
pragma solidity ^0.4.8;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
import "./MiniMeToken.sol";
|
||||
import "./StatusContribution.sol";
|
||||
import "./SafeMath.sol";
|
||||
import "./Owned.sol";
|
||||
|
||||
|
||||
/*
|
||||
Copyright 2017, Jorge Izquierdo (Aragon Foundation)
|
||||
*/
|
||||
/*
|
||||
Copyright 2017, Jordi Baylina
|
||||
|
||||
@notice The SNTPlaceholder contract will take control over the SNT after the offering
|
||||
is finalized and before the Status Network is deployed.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
The contract allows for SNT transfers and transferFrom and implements the
|
||||
logic for transfering control of the token to the network when the offering
|
||||
asks it to do so.
|
||||
*/
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// @title SNTPlaceholder Contract
|
||||
/// @author Jordi Baylina
|
||||
/// @dev The SNTPlaceholder contract will take control over the SNT after the contribution
|
||||
/// is finalized and before the Status Network is deployed.
|
||||
/// The contract allows for SNT transfers and transferFrom and implements the
|
||||
/// logic for transfering control of the token to the network when the offering
|
||||
/// asks it to do so.
|
||||
|
||||
contract SNTPlaceHolder is TokenController, SafeMath, Owned {
|
||||
MiniMeToken public snt;
|
||||
|
@ -25,6 +36,12 @@ contract SNTPlaceHolder is TokenController, SafeMath, Owned {
|
|||
uint public activationTime;
|
||||
address public sgtExchanger;
|
||||
|
||||
/// @notice Constructor
|
||||
/// @param _owner Trusted owner for this contract.
|
||||
/// @param _snt SNT token contract address
|
||||
/// @param _contribution StatusContribution contract address
|
||||
/// @param _sgtExchanger SGT-SNT Exchange address. (During the first two weeks,
|
||||
/// only this exchanger will be able to move tokens from)
|
||||
function SNTPlaceHolder(address _owner, address _snt, address _contribution, address _sgtExchanger) {
|
||||
owner = _owner;
|
||||
snt = MiniMeToken(_snt);
|
||||
|
@ -32,11 +49,20 @@ contract SNTPlaceHolder is TokenController, SafeMath, Owned {
|
|||
sgtExchanger = _sgtExchanger;
|
||||
}
|
||||
|
||||
/// @notice The owner of this contract can cheche the controller of the SNT token
|
||||
/// Please, be sure that the owner is a trusted agent or 0x0 address.
|
||||
/// @param _newController The address of the new controller
|
||||
|
||||
function changeController(address _newController) onlyOwner {
|
||||
snt.changeController(_newController);
|
||||
ControllerChanged(_newController);
|
||||
}
|
||||
|
||||
|
||||
//////////
|
||||
// MiniMe Controller Interface functions
|
||||
//////////
|
||||
|
||||
// In between the offering and the network. Default settings for allowing token transfers.
|
||||
function proxyPayment(address ) payable returns (bool) {
|
||||
return false;
|
||||
|
@ -63,6 +89,11 @@ contract SNTPlaceHolder is TokenController, SafeMath, Owned {
|
|||
return (getTime() > activationTime) || (_from == sgtExchanger);
|
||||
}
|
||||
|
||||
//////////
|
||||
// Testing specific methods
|
||||
//////////
|
||||
|
||||
/// @notice This function is overrided by the test Mocks.
|
||||
function getTime() internal returns(uint) {
|
||||
return now;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.8;
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue