mirror of https://github.com/vacp2p/minime.git
Make to compile
This commit is contained in:
parent
a372dabbec
commit
a6a8e14187
|
@ -19,9 +19,9 @@ pragma solidity ^0.4.6;
|
|||
|
||||
/// @title MiniMeToken Contract
|
||||
/// @author Jordi Baylina
|
||||
/// @dev This token contract's goal is to make it easy for anyone to clone this
|
||||
/// @dev This token contract's goal is to make it easy for anyone to clone this
|
||||
/// token using the token distribution at a given block, this will allow DAO's
|
||||
/// and DApps to upgrade their features in a decentralized manner without
|
||||
/// and DApps to upgrade their features in a decentralized manner without
|
||||
/// affecting the original token
|
||||
/// @dev It is ERC20 compliant, but still needs to under go further testing.
|
||||
|
||||
|
@ -33,7 +33,7 @@ contract TokenController {
|
|||
/// @return True if the ether is accepted, false if it throws
|
||||
function proxyPayment(address _owner) payable returns(bool);
|
||||
|
||||
/// @notice Notifies the controller about a token transfer allowing the
|
||||
/// @notice Notifies the controller about a token transfer allowing the
|
||||
/// controller to react if desired
|
||||
/// @param _from The origin of the transfer
|
||||
/// @param _to The destination of the transfer
|
||||
|
@ -41,7 +41,7 @@ contract TokenController {
|
|||
/// @return False if the controller does not authorize the transfer
|
||||
function onTransfer(address _from, address _to, uint _amount) returns(bool);
|
||||
|
||||
/// @notice Notifies the controller about an approval allowing the
|
||||
/// @notice Notifies the controller about an approval allowing the
|
||||
/// controller to react if desired
|
||||
/// @param _owner The address that calls `approve()`
|
||||
/// @param _spender The spender in the `approve()` call
|
||||
|
@ -67,7 +67,7 @@ contract Controlled {
|
|||
}
|
||||
}
|
||||
|
||||
/// @dev The actual token contract, the default controller is the msg.sender
|
||||
/// @dev The actual token contract, the default controller is the msg.sender
|
||||
/// that deploys the contract, so usually this token will be deployed by a
|
||||
/// token controller contract, which Giveth will call a "Campaign"
|
||||
contract MiniMeToken is Controlled {
|
||||
|
@ -124,7 +124,7 @@ contract MiniMeToken is Controlled {
|
|||
|
||||
/// @notice Constructor to create a MiniMeToken
|
||||
/// @param _tokenFactory The address of the MiniMeTokenFactory contract that
|
||||
/// will create the Clone token contracts, the token factory needs to be
|
||||
/// will create the Clone token contracts, the token factory needs to be
|
||||
/// deployed first
|
||||
/// @param _parentToken Address of the parent token, set to 0x0 if it is a
|
||||
/// new token
|
||||
|
@ -177,10 +177,10 @@ contract MiniMeToken is Controlled {
|
|||
function transferFrom(address _from, address _to, uint256 _amount
|
||||
) returns (bool success) {
|
||||
|
||||
/// @dev The controller of this contract can move tokens around at will,
|
||||
/// this is important to recognize! Confirm that you trust the
|
||||
/// controller of this contract, which in most situations should be
|
||||
/// another open source smart contract or 0x0
|
||||
// The controller of this contract can move tokens around at will,
|
||||
// this is important to recognize! Confirm that you trust the
|
||||
// controller of this contract, which in most situations should be
|
||||
// another open source smart contract or 0x0
|
||||
if (msg.sender != controller) {
|
||||
if (!transfersEnabled) throw;
|
||||
|
||||
|
@ -191,7 +191,7 @@ contract MiniMeToken is Controlled {
|
|||
return doTransfer(_from, _to, _amount);
|
||||
}
|
||||
|
||||
/// @dev This is the actual transfer function in the token contract, it can
|
||||
/// @dev This is the actual transfer function in the token contract, it can
|
||||
/// only be called by other functions in this contract.
|
||||
/// @param _from The address holding the tokens being transferred
|
||||
/// @param _to The address of the recipient
|
||||
|
@ -243,7 +243,7 @@ contract MiniMeToken is Controlled {
|
|||
|
||||
/// @notice `msg.sender` approves `_spender` to spend `_amount` tokens on
|
||||
/// its behalf. This is a modified version of the ERC20 approve function
|
||||
/// to be a little bit safer
|
||||
/// to be a little bit safer
|
||||
/// @param _spender The address of the account able to transfer the tokens
|
||||
/// @param _amount The amount of tokens to be approved for transfer
|
||||
/// @return True if the approval was successful
|
||||
|
@ -279,7 +279,7 @@ contract MiniMeToken is Controlled {
|
|||
|
||||
/// @notice `msg.sender` approves `_spender` to send `_amount` tokens on
|
||||
/// its behalf, and then a function is triggered in the contract that is
|
||||
/// being approved, `_spender`. This allows users to use their tokens to
|
||||
/// being approved, `_spender`. This allows users to use their tokens to
|
||||
/// interact with contracts in one function call instead of two
|
||||
/// @param _spender The address of the contract able to transfer the tokens
|
||||
/// @param _amount The amount of tokens to be approved for transfer
|
||||
|
@ -494,7 +494,7 @@ contract MiniMeToken is Controlled {
|
|||
return checkpoints[min].value;
|
||||
}
|
||||
|
||||
/// @dev `updateValueAtNow` used to update the `balances` map and the
|
||||
/// @dev `updateValueAtNow` used to update the `balances` map and the
|
||||
/// `totalSupplyHistory`
|
||||
/// @param checkpoints The history of data being updated
|
||||
/// @param _value The new number of tokens
|
||||
|
@ -516,6 +516,7 @@ contract MiniMeToken is Controlled {
|
|||
/// @return True if `_addr` is a contract
|
||||
function isContract(address _addr) constant internal returns(bool) {
|
||||
uint size;
|
||||
if (_addr == 0) return false;
|
||||
assembly {
|
||||
size := extcodesize(_addr)
|
||||
}
|
||||
|
@ -523,7 +524,7 @@ contract MiniMeToken is Controlled {
|
|||
}
|
||||
|
||||
/// @notice The fallback function: If the contract's controller has not been
|
||||
/// set to 0, then the `proxyPayment` method is called which relays the
|
||||
/// set to 0, then the `proxyPayment` method is called which relays the
|
||||
/// ether and creates tokens as described in the token controller contract
|
||||
function () payable {
|
||||
if (isContract(controller)) {
|
||||
|
@ -531,6 +532,8 @@ contract MiniMeToken is Controlled {
|
|||
throw;
|
||||
} else {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////
|
||||
|
|
File diff suppressed because one or more lines are too long
14
README.md
14
README.md
|
@ -14,7 +14,7 @@ Anybody can create a new clone token from any token using this contract with an
|
|||
bool _isConstant
|
||||
) returns(address) {
|
||||
|
||||
Once the clone token is created, it acts as a completely independent token, with it's own unique functionalities.
|
||||
Once the clone token is created, it acts as a completely independent token, with it's own unique functionalities.
|
||||
|
||||
### Balance history is registered and available to be queried
|
||||
|
||||
|
@ -41,7 +41,7 @@ To create and destroy tokens, these two functions are introduced:
|
|||
If transfersEnabled == false, tokens cannot be transferred by the users, however they can still be created, destroyed, and transferred by the controller. The controller can also toggle this flag.
|
||||
|
||||
// Allows tokens to be transferred if true or frozen if false
|
||||
function enableTransfers(bool _transfersEnabled) onlyController
|
||||
function enableTransfers(bool _transfersEnabled) onlyController
|
||||
|
||||
|
||||
## Applications
|
||||
|
@ -58,3 +58,13 @@ If this token contract is used as the base token, then clones of itself can be e
|
|||
8. Lots of other applications including all the applications the standard ERC 20 token can be used for.
|
||||
|
||||
All these applications and more are enabled by the MiniMe Token Contract. The most amazing part being that anyone that wants to add these features can, in a permissionless yet safe manner without affecting the parent token's intended functionality.
|
||||
|
||||
# How to deploy a campaign
|
||||
|
||||
1. Deploy the MinimeTokenFactory
|
||||
2. Deploy the MinimeToken
|
||||
3. Deploy the campaig
|
||||
4. Assign the controller of the MinimeToken to the campaign.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pragma solidity ^0.4.6;
|
|||
/// @title MilestoneTracker Contract
|
||||
/// @author Jordi Baylina
|
||||
/// @dev This contract controls the issuance of tokens for the MiniMe Token
|
||||
/// Contract. This version specifically acts as a Campaign manager for raising
|
||||
/// Contract. This version specifically acts as a Campaign manager for raising
|
||||
/// funds for non-profit causes, but it can be customized for any variety of
|
||||
/// purposes.
|
||||
|
||||
|
@ -49,8 +49,8 @@ contract Owned {
|
|||
|
||||
|
||||
/// @dev This is designed to control the issuance of a MiniMe Token for a
|
||||
/// non-profit Campaign. This contract effectively dictates the terms of the
|
||||
/// funding round.
|
||||
/// non-profit Campaign. This contract effectively dictates the terms of the
|
||||
/// funding round.
|
||||
|
||||
contract Campaign is TokenController, Owned {
|
||||
|
||||
|
@ -78,7 +78,8 @@ contract Campaign is TokenController, Owned {
|
|||
uint _endFundingTime,
|
||||
uint _maximumFunding,
|
||||
address _vaultAddress,
|
||||
address _tokenAddress
|
||||
address _tokenAddress,
|
||||
|
||||
) {
|
||||
if ((_endFundingTime < now) || // Cannot end in the past
|
||||
(_endFundingTime <= _startFundingTime) ||
|
||||
|
@ -173,7 +174,7 @@ contract Campaign is TokenController, Owned {
|
|||
return;
|
||||
}
|
||||
|
||||
/// @notice `finalizeFunding()` ends the Campaign by calling setting the
|
||||
/// @notice `finalizeFunding()` ends the Campaign by calling setting the
|
||||
/// controller to 0, thereby ending the issuance of new tokens and stopping the
|
||||
/// Campaign from receiving more ether
|
||||
/// @dev `finalizeFunding()` can only be called after the end of the funding period.
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
[ { "constant": true, "inputs": [], "name": "vaultContract", "outputs": [ { "name": "", "type": "address", "value": "0x8bb119f1557685fd6c8fb89dc4bf5a9550050ed6" } ], "payable": false, "type": "function" }, { "constant": false, "inputs": [], "name": "seal", "outputs": [], "payable": false, "type": "function" }, { "constant": false, "inputs": [ { "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_amount", "type": "uint256" } ], "name": "onTransfer", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "tokenContract", "outputs": [ { "name": "", "type": "address", "value": "0x19f7f6292595ca137f4a743527e3e773d663b161" } ], "payable": false, "type": "function" }, { "constant": false, "inputs": [ { "name": "data", "type": "uint256[]" } ], "name": "fill", "outputs": [], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "getOwner", "outputs": [ { "name": "", "type": "address", "value": "0xc6bd0efffa610c2bea8449c86c975a477eae9699" } ], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "maximumFunding", "outputs": [ { "name": "", "type": "uint256", "value": "1e+22" } ], "payable": false, "type": "function" }, { "constant": false, "inputs": [], "name": "finalizeFunding", "outputs": [], "payable": false, "type": "function" }, { "constant": false, "inputs": [ { "name": "_newOwner", "type": "address" } ], "name": "changeOwner", "outputs": [], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "startFundingTime", "outputs": [ { "name": "", "type": "uint256", "value": "1478640923" } ], "payable": false, "type": "function" }, { "constant": false, "inputs": [ { "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" }, { "name": "_amount", "type": "uint256" } ], "name": "onApprove", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "totalCollected", "outputs": [ { "name": "", "type": "uint256", "value": "302100000000000000000" } ], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "endFundingTime", "outputs": [ { "name": "", "type": "uint256", "value": "1489009223" } ], "payable": false, "type": "function" }, { "constant": true, "inputs": [], "name": "sealed", "outputs": [ { "name": "", "type": "bool", "value": false } ], "payable": false, "type": "function" }, { "constant": false, "inputs": [ { "name": "_owner", "type": "address" } ], "name": "proxyPayment", "outputs": [ { "name": "", "type": "bool" } ], "payable": true, "type": "function" }, { "inputs": [ { "name": "_startFundingTime", "type": "uint256" }, { "name": "_endFundingTime", "type": "uint256" }, { "name": "_maximumFunding", "type": "uint256" }, { "name": "_vaultContract", "type": "address" }, { "name": "_tokenContract", "type": "address" } ], "payable": false, "type": "constructor" }, { "payable": true, "type": "fallback" } ]
|
|
@ -1 +0,0 @@
|
|||
[ { "constant": false, "inputs": [ { "name": "_parentToken", "type": "address" }, { "name": "_snapshotBlock", "type": "uint256" }, { "name": "_tokenName", "type": "string" }, { "name": "_decimalUnits", "type": "uint8" }, { "name": "_tokenSymbol", "type": "string" }, { "name": "_transfersEnabled", "type": "bool" } ], "name": "createCloneToken", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "type": "function" } ]
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minime",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"description": "MiniMe contract",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
|
@ -31,6 +31,6 @@
|
|||
},
|
||||
"homepage": "https://github.com/Giveth/minime",
|
||||
"dependencies": {
|
||||
"ethconnector": "0.0.19"
|
||||
"ethconnector": "0.0.21"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue