Skip to content

Commit

Permalink
Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
dondreytaylor committed Jul 12, 2017
0 parents commit 566071b
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
build/
.idea/
22 changes: 22 additions & 0 deletions DNNToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import "./StandardToken.sol";

pragma solidity ^0.4.8;

contract DNNToken is StandardToken {

function () {
//if ether is sent to this address, send it back.
throw;
}

/* Public variables of the token */
string public name = "DNN";
uint8 public decimals = 3;
string public symbol = "DNN";
uint256 public initialAmount = 10000000 * 10**3;

function DNN() {
balances[msg.sender] = initialAmount; // Give the creator all initial tokens
totalSupply = initialAmount;
}
}
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## DNN Alpha Contracts
DNN uses a variety of contracts that work together to make up the DNN network. Paramount to the success of the platform is having complete transparency surrounding the implementations of these contracts. Therefore, we would like to invite the community to perform complete audits on the DNN network smart-contracts.

## What is DNN?
Decentralized News Network is a political news platform that combines news creation with
decentralized networks as a means to delivering factual content, curated by the community of
readers, writers, and reviewers.

DNN will harness the power of the Ethereum blockchain to create infrastructure that is virtually
impossible to infiltrate or take down. Since DNN is not centralized, it does not have a potential single point of failure. The platform’s core purpose is to present political news as accurately as possible, free of any corrupt incentives or hidden agendas, which plagues most news
corporations.

The DNN platform will focus on facilitating the dissemination of balanced and factual observation of current political affairs. DNN's mission is to create political news content that is both empowering for its readers, as well as representative of the integrity of its writers. DNN aspires to become the most-trusted and democratic political news alternative to the mainstream media.

To find out more our DNN, feel free to [join the conversation on our slack](https://slack.dnn.media/) or read more on our [site](https://dnn.media/).

![DNN Logo](./header-text.png)

### Using the DNN Alpha

For any help with using the DNN alpha, please refer to the [DNN Alpha Access Instructions](https://demo.dnn.media/alpha/access/instructions).

### Contributing
To submit changes to the main DNN demo repo, please submit a pull request. If you have any question or if your pull request has not yet been responded to, [please visit the DNN slack](https://slack.dnn.media).

### Reporting Bugs

Please report all bugs to the git issues section or notify the DNN community via the [DNN slack](https://slack.dnn.media/) under the #issues channel.

# License
Apache 2.0
48 changes: 48 additions & 0 deletions StandardToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
pragma solidity ^0.4.8;

import "./Token.sol";

contract StandardToken is Token {

function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}

function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}

function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}

function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}

function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}

mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
}
48 changes: 48 additions & 0 deletions Token.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/issues/20
pragma solidity ^0.4.8;

contract Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;

/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance);

/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success);

/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);

/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success);

/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining);

event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
36 changes: 36 additions & 0 deletions User.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pragma solidity ^0.4.8;

contract User {
enum UserType { none, reader, reviewer, writer }

// Maps user Ethereum addresses to internal IDs
mapping (address => uint32) userId;
// Maps user Ethereum addresses to their profiles on IPFS
mapping (address => string) userIpfsHash;
// Maps user Ethereum addresses to accounts types
mapping (address => UserType) userType;

function updateUserId(uint32 id) {
userId[msg.sender] = id;
}

function retrieveUserId(address userAddress) constant returns (uint32) {
return userId[userAddress];
}

function updateUserData(string ipfsHash) {
userIpfsHash[msg.sender] = ipfsHash;
}

function retrieveUserData(address userAddress) constant returns (string) {
return userIpfsHash[userAddress];
}

function updateUserType(UserType newType) {
userType[msg.sender] = newType;
}

function retrieveUserType(address userAddress) constant returns (UserType) {
return userType[userAddress];
}
}
Binary file added header-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 566071b

Please sign in to comment.