Skip to content

Commit

Permalink
Merge pull request #36 from opencog/enhancement/minor-cleanups-indent…
Browse files Browse the repository at this point in the history
…ations-interfaces

enhancement/minor-cleanups-indentations-interfaces
  • Loading branch information
tiero authored Oct 13, 2017
2 parents 28ab909 + c5c9e82 commit 514b293
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 120 deletions.
29 changes: 14 additions & 15 deletions dao/contracts/AgiCrowdsale.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.13;
pragma solidity ^0.4.15;

import './tokens/SingularityNetToken.sol';
import 'zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol';
Expand All @@ -13,28 +13,27 @@ import 'zeppelin-solidity/contracts/token/MintableToken.sol';
*/
contract AgiToken is MintableToken {

string public constant NAME = "Artificial General Intelligence token";
string public constant SYMBOL = "AGI";
uint8 public constant DECIMALS = 18;
string public constant NAME = "Artificial General Intelligence token";
string public constant SYMBOL = "AGI";
uint8 public constant DECIMALS = 18;

}


contract AgiCrowdsale is CappedCrowdsale, RefundableCrowdsale {

function AgiCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet)
function AgiCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet)
CappedCrowdsale(_cap)
FinalizableCrowdsale()
RefundableCrowdsale(_goal)
Crowdsale(_startTime, _endTime, _rate, _wallet)
{
//As goal needs to be met for a successful crowdsale
//the value needs to less or equal than a cap which is limit for accepted funds
require(_goal <= _cap);
}
{
//As goal needs to be met for a successful crowdsale
//the value needs to less or equal than a cap which is limit for accepted funds
require(_goal <= _cap);
}

function createTokenContract() internal returns (MintableToken) {
return new AgiToken();
}
function createTokenContract() internal returns (MintableToken) {
return new AgiToken();
}

}
}
2 changes: 1 addition & 1 deletion dao/contracts/Escrow.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

import "./ownership/ownable.sol";

Expand Down
2 changes: 1 addition & 1 deletion dao/contracts/Migrations.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.4;
pragma solidity ^0.4.15;

contract Migrations {
address public owner;
Expand Down
12 changes: 5 additions & 7 deletions dao/contracts/agent/Agent.sol
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
pragma solidity ^0.4.11;

pragma solidity ^0.4.15;

import "./AgentInterface.sol";
import "../MarketJob.sol";
import "../marketjob/MarketJobInterface.sol";
import "../ownership/ownable.sol";


contract Agent is AgentInterface, ownable {

bytes[] public packets;
MarketJob job;
MarketJobInterface public job;

function() payable { }

Expand All @@ -26,8 +24,8 @@ contract Agent is AgentInterface, ownable {
return packets[id];
}

function setJob(MarketJob _job) external returns (address) {
function setJob(MarketJobInterface _job) external returns (address) {
job = _job;
}

}
}
11 changes: 5 additions & 6 deletions dao/contracts/agent/AgentFactory.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

import './Agent.sol';

contract AgentFactory {

function create() public returns (Agent) {
return new Agent();
}

}
function create() public returns (Agent) {
return new Agent();
}
}
2 changes: 1 addition & 1 deletion dao/contracts/agent/AgentInterface.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

contract AgentInterface {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

import "./ownership/ownable.sol";
import "./MarketJobInterface.sol";

contract MarketJob is ownable {
contract MarketJob is MarketJobInterface, ownable {

address public payer;
bytes public lastPacket;
Expand Down Expand Up @@ -49,4 +50,4 @@ contract MarketJob is ownable {
function setJobCompleted() external jobPending {
jobCompleted = true;
}
}
}
8 changes: 8 additions & 0 deletions dao/contracts/marketjob/MarketJobInterface.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pragma solidity ^0.4.15;

contract MarketJobInterface {

function withdraw() external;
function setJobCompleted() external;

}
4 changes: 2 additions & 2 deletions dao/contracts/ownership/ownable.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

contract ownable {

Expand All @@ -20,4 +20,4 @@ contract ownable {
function isOwner(address _address) public constant returns (bool) {
return owner == _address;
}
}
}
2 changes: 1 addition & 1 deletion dao/contracts/registries/AgentRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

import "./AgentRegistryInterface.sol";

Expand Down
2 changes: 1 addition & 1 deletion dao/contracts/registries/AgentRegistryInterface.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

contract AgentRegistryInterface {

Expand Down
22 changes: 11 additions & 11 deletions dao/contracts/tokens/ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

pragma solidity ^0.4.11;
pragma solidity ^0.4.15;

contract ERC20 {
function totalSupply() constant returns (uint);
function balanceOf(address _owner) constant returns (uint);
function allowance(address _owner, address _spender) constant returns (uint);
function transfer(address _to, uint _amount) returns (bool);
function transferFrom(address _from, address _to, uint _amount) returns (bool);
function approve(address _spender, uint _amount) returns (bool);

event Approval(address indexed owner, address indexed spender, uint amount);
event Transfer(address indexed from, address indexed to, uint amount);
}
function totalSupply() constant returns (uint);
function balanceOf(address _owner) constant returns (uint);
function allowance(address _owner, address _spender) constant returns (uint);
function transfer(address _to, uint _amount) returns (bool);
function transferFrom(address _from, address _to, uint _amount) returns (bool);
function approve(address _spender, uint _amount) returns (bool);

event Approval(address indexed owner, address indexed spender, uint amount);
event Transfer(address indexed from, address indexed to, uint amount);
}
74 changes: 33 additions & 41 deletions dao/contracts/tokens/FixedSupplyToken.sol
Original file line number Diff line number Diff line change
@@ -1,68 +1,60 @@
pragma solidity^0.4.11;
pragma solidity ^0.4.15;

import "./ERC20.sol";
import "../ownership/ownable.sol";

contract FixedSupplyToken is ERC20 {
uint8 public constant decimals = 18;
uint256 _totalSupply = 1000000;
address public owner;
contract FixedSupplyToken is ERC20, ownable {
uint8 public constant decimals = 18;
uint256 _totalSupply = 1000000;
address public owner;

mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;

modifier onlyOwner() {
if (msg.sender != owner) {
throw;

function FixedSupplyToken() {
balances[owner] = _totalSupply;
}
_;
}

function FixedSupplyToken() {
owner = msg.sender;
balances[owner] = _totalSupply;
}
function totalSupply() constant returns (uint) {
return _totalSupply;
}

function totalSupply() constant returns (uint) {
return _totalSupply;
}
function balanceOf(address _owner) constant returns (uint) {
return balances[_owner];
}

function balanceOf(address _owner) constant returns (uint) {
return balances[_owner];
}
function transfer(address _to, uint _amount) returns (bool) {
if (balances[msg.sender] < _amount && _amount < 0 && balances[_to] + _amount < balances[_to]) {
return false;
}

function transfer(address _to, uint _amount) returns (bool) {
if (balances[msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);

return true;
} else {
return false;
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
}
}

function transferFrom(address _from, address _to, uint256 _amount) returns (bool success) {
if (balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount && _amount > 0 && balances[_to] + _amount > balances[_to]) {
if (balances[_from] < _amount && allowed[_from][msg.sender] < _amount && _amount < 0 && balances[_to] + _amount < balances[_to]) {
return false;
}

balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);

return true;
} else {
return false;
}
}

function approve(address _spender, uint _amount) returns (bool) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);

return true;
return true;
}

function allowance(address _owner, address _spender) constant returns (uint) {
return allowed[_owner][_spender];
return allowed[_owner][_spender];
}
}
59 changes: 29 additions & 30 deletions dao/contracts/tokens/SingularityNetToken.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pragma solidity ^0.4.11;

pragma solidity ^0.4.15;

import "zeppelin-solidity/contracts/token/StandardToken.sol";
import "zeppelin-solidity/contracts/lifecycle/Pausable.sol";
Expand All @@ -25,31 +24,31 @@ import "zeppelin-solidity/contracts/lifecycle/Pausable.sol";
*/
contract SingularityNetToken is StandardToken, Pausable {

string public constant NAME = "Singularity Network Token";
string public constant SYMBOL = "AGI";
uint8 public constant DECIMALS = 8;
uint256 public constant INITIAL_SUPPLY = 1000000000 * 10**uint256(DECIMALS);

/**
* @dev SingularityNetToken Constructor
*/
function SingularityNetToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}

function transfer(address to, uint256 value) whenNotPaused returns (bool) {
require(to != address(0));
return super.transfer(to, value);
}

function transferFrom(address from, address to, uint256 value) whenNotPaused returns (bool) {
require(to != address(0));
return super.transferFrom(from, to, value);
}

function approve(address spender, uint256 value) whenNotPaused returns (bool) {
return super.approve(spender, value);
}

}
string public constant NAME = "Singularity Network Token";
string public constant SYMBOL = "AGI";
uint8 public constant DECIMALS = 8;
uint256 public constant INITIAL_SUPPLY = 1000000000 * 10**uint256(DECIMALS);

/**
* @dev SingularityNetToken Constructor
*/
function SingularityNetToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}

function transfer(address to, uint256 value) whenNotPaused returns (bool) {
require(to != address(0));
return super.transfer(to, value);
}

function transferFrom(address from, address to, uint256 value) whenNotPaused returns (bool) {
require(to != address(0));
return super.transferFrom(from, to, value);
}

function approve(address spender, uint256 value) whenNotPaused returns (bool) {
return super.approve(spender, value);
}

}

0 comments on commit 514b293

Please sign in to comment.