mirror of https://github.com/vacp2p/minime.git
Merge branch 'master' of github.com:CharityDAO/minime
This commit is contained in:
commit
9b1bd455a1
|
@ -25,8 +25,8 @@ pragma solidity ^0.4.4;
|
||||||
|
|
||||||
|
|
||||||
contract Controlled {
|
contract Controlled {
|
||||||
/// @notice The address of the controller is the only address that can call a
|
/// @notice The address of the controller is the only address that can call
|
||||||
/// function with this modifier
|
/// a function with this modifier
|
||||||
modifier onlyController { if (msg.sender != controller) throw; _; }
|
modifier onlyController { if (msg.sender != controller) throw; _; }
|
||||||
|
|
||||||
address public controller;
|
address public controller;
|
||||||
|
@ -148,10 +148,10 @@ contract MiniMeToken is Controlled {
|
||||||
function transferFrom(address _from, address _to, uint256 _amount
|
function transferFrom(address _from, address _to, uint256 _amount
|
||||||
) returns (bool success) {
|
) returns (bool success) {
|
||||||
|
|
||||||
// The controller of this contract can move tokens around at will, this is
|
// The controller of this contract can move tokens around at will, this
|
||||||
// important to recognize! Confirm that you trust the controller of this
|
// is important to recognize! Confirm that you trust the controller of
|
||||||
// contract, which in most situations should be another open source
|
// this contract, which in most situations should be another open
|
||||||
// smart contract or 0x0
|
// source smart contract or 0x0
|
||||||
if (msg.sender != controller) {
|
if (msg.sender != controller) {
|
||||||
if (isConstant) throw;
|
if (isConstant) throw;
|
||||||
|
|
||||||
|
@ -274,8 +274,9 @@ contract MiniMeToken is Controlled {
|
||||||
|
|
||||||
// These next few lines are used when the balance of the token is
|
// These next few lines are used when the balance of the token is
|
||||||
// requested before a check point was ever created for this token, it
|
// requested before a check point was ever created for this token, it
|
||||||
// requires that the `parentToken.balanceOfAt` be queried at the genesis
|
// requires that the `parentToken.balanceOfAt` be queried at the
|
||||||
// block for that token as this contains initial balance of this token.
|
// genesis block for that token as this contains initial balance of
|
||||||
|
// this token
|
||||||
} else if ((balances[_owner].length == 0)
|
} else if ((balances[_owner].length == 0)
|
||||||
|| (balances[_owner][0].fromBlock > _blockNumber)) {
|
|| (balances[_owner][0].fromBlock > _blockNumber)) {
|
||||||
if (address(parentToken) != 0) {
|
if (address(parentToken) != 0) {
|
||||||
|
@ -411,12 +412,12 @@ contract MiniMeToken is Controlled {
|
||||||
function getValueAt(Checkpoint[] storage checkpoints, uint _block
|
function getValueAt(Checkpoint[] storage checkpoints, uint _block
|
||||||
) constant internal returns (uint) {
|
) constant internal returns (uint) {
|
||||||
if (checkpoints.length == 0) return 0;
|
if (checkpoints.length == 0) return 0;
|
||||||
// Shorcut for the actual value
|
// Shortcut for the actual value
|
||||||
if (_block >= checkpoints[checkpoints.length-1].fromBlock)
|
if (_block >= checkpoints[checkpoints.length-1].fromBlock)
|
||||||
return checkpoints[checkpoints.length-1].value;
|
return checkpoints[checkpoints.length-1].value;
|
||||||
if (_block < checkpoints[0].fromBlock) return 0;
|
if (_block < checkpoints[0].fromBlock) return 0;
|
||||||
|
|
||||||
// Binary search of the value in the array.
|
// Binary search of the value in the array
|
||||||
uint min = 0;
|
uint min = 0;
|
||||||
uint max = checkpoints.length-1;
|
uint max = checkpoints.length-1;
|
||||||
while (max > min) {
|
while (max > min) {
|
||||||
|
@ -443,9 +444,9 @@ contract MiniMeToken is Controlled {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice The fallback function: If the contract's owner has not been set
|
/// @notice The fallback function: If the contract's controller has not been
|
||||||
/// to 0, the ether is sent to the owner (normally the token creation
|
/// set to 0, the ether is sent to the controller (normally the token
|
||||||
/// contract) using the `proxyPayment` method.
|
/// creation contract) using the `proxyPayment` method.
|
||||||
function () payable {
|
function () payable {
|
||||||
if (controller == 0) throw;
|
if (controller == 0) throw;
|
||||||
if (! Controller(controller).proxyPayment.value(msg.value)(msg.sender)) {
|
if (! Controller(controller).proxyPayment.value(msg.value)(msg.sender)) {
|
||||||
|
|
Loading…
Reference in New Issue