Skip to content

Commit 7272124

Browse files
authored
Merge pull request #525 from AugurProject/backlog_issues
Backlog issues
2 parents 8336d72 + 7f2c3fc commit 7272124

25 files changed

+367
-112
lines changed

source/contracts/Augur.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pragma solidity 0.4.18;
22

33
import 'Controlled.sol';
4+
import 'IAugur.sol';
45
import 'libraries/token/ERC20.sol';
56
import 'factories/UniverseFactory.sol';
67
import 'reporting/IUniverse.sol';
@@ -15,7 +16,7 @@ import 'libraries/Extractable.sol';
1516

1617

1718
// Centralized approval authority and event emissions
18-
contract Augur is Controlled, Extractable {
19+
contract Augur is Controlled, Extractable, IAugur {
1920
event MarketCreated(bytes32 indexed topic, string description, string extraInfo, address indexed universe, address market, address indexed marketCreator, bytes32[] outcomes, uint256 marketCreationFee, int256 minPrice, int256 maxPrice, IMarket.MarketType marketType);
2021
event InitialReportSubmitted(address indexed universe, address indexed reporter, address indexed market, uint256 amountStaked, bool isDesignatedReporter, uint256[] payoutNumerators);
2122
event DisputeCrowdsourcerCreated(address indexed universe, address indexed market, address disputeCrowdsourcer, uint256[] payoutNumerators, uint256 size);

source/contracts/Controller.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pragma solidity 0.4.18;
88
* Initially, Augur will have a “dev mode” that that can be enabled to allow Augur’s team to suicide funds, extract Ether or Tokens from a specific contract (in case funds inadvertently get sent somewhere they shouldn’t have), and update the Controller of a target contract to a new Controller. Eventually, the plan is to remove this mode so that this functionality will no longer be available to anyone, including the Augur team. At that point, the `owner` address will only be able to the `emergencyStop` and `release` functions.
99
*/
1010

11+
import 'IAugur.sol';
1112
import 'IController.sol';
1213
import 'IControlled.sol';
1314
import 'libraries/token/ERC20Basic.sol';
@@ -178,8 +179,8 @@ contract Controller is IController {
178179
* Helper functions
179180
*/
180181

181-
function getAugur() public view returns (Augur) {
182-
return Augur(lookup("Augur"));
182+
function getAugur() public view returns (IAugur) {
183+
return IAugur(lookup("Augur"));
183184
}
184185

185186
function getTimestamp() public view returns (uint256) {

source/contracts/IAugur.sol

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
pragma solidity 0.4.18;
2+
3+
import 'reporting/IUniverse.sol';
4+
import 'libraries/token/ERC20.sol';
5+
import 'reporting/IMarket.sol';
6+
import 'trading/Order.sol';
7+
8+
9+
contract IAugur {
10+
function createChildUniverse(bytes32 _parentPayoutDistributionHash) public returns (IUniverse);
11+
function isKnownUniverse(IUniverse _universe) public view returns (bool);
12+
function trustedTransfer(ERC20 _token, address _from, address _to, uint256 _amount) public returns (bool);
13+
function logMarketCreated(bytes32 _topic, string _description, string _extraInfo, IUniverse _universe, address _market, address _marketCreator, bytes32[] _outcomes, int256 _minPrice, int256 _maxPrice, IMarket.MarketType _marketType) public returns (bool);
14+
function logMarketCreated(bytes32 _topic, string _description, string _extraInfo, IUniverse _universe, address _market, address _marketCreator, int256 _minPrice, int256 _maxPrice, IMarket.MarketType _marketType) public returns (bool);
15+
function logInitialReportSubmitted(IUniverse _universe, address _reporter, address _market, uint256 _amountStaked, bool _isDesignatedReporter, uint256[] _payoutNumerators) public returns (bool);
16+
function logDisputeCrowdsourcerCreated(IUniverse _universe, address _market, address _disputeCrowdsourcer, uint256[] _payoutNumerators, uint256 _size) public returns (bool);
17+
function logDisputeCrowdsourcerContribution(IUniverse _universe, address _reporter, address _market, address _disputeCrowdsourcer, uint256 _amountStaked) public returns (bool);
18+
function logDisputeCrowdsourcerCompleted(IUniverse _universe, address _market, address _disputeCrowdsourcer) public returns (bool);
19+
function logWinningTokensRedeemed(IUniverse _universe, address _reporter, address _market, address _reportingParticipant, uint256 _amountRedeemed, uint256 _reportingFeesReceived, uint256[] _payoutNumerators) public returns (bool);
20+
function logMarketFinalized(IUniverse _universe, address _market) public returns (bool);
21+
function logOrderCanceled(IUniverse _universe, address _shareToken, address _sender, bytes32 _orderId, Order.Types _orderType, uint256 _tokenRefund, uint256 _sharesRefund) public returns (bool);
22+
function logOrderCreated(Order.Types _orderType, uint256 _amount, uint256 _price, address _creator, uint256 _moneyEscrowed, uint256 _sharesEscrowed, bytes32 _tradeGroupId, bytes32 _orderId, IUniverse _universe, address _shareToken) public returns (bool);
23+
function logOrderFilled(IUniverse _universe, address _shareToken, address _filler, bytes32 _orderId, uint256 _numCreatorShares, uint256 _numCreatorTokens, uint256 _numFillerShares, uint256 _numFillerTokens, uint256 _marketCreatorFees, uint256 _reporterFees, bytes32 _tradeGroupId) public returns (bool);
24+
function logTradingProceedsClaimed(IUniverse _universe, address _shareToken, address _sender, address _market, uint256 _numShares, uint256 _numPayoutTokens, uint256 _finalTokenBalance) public returns (bool);
25+
function logUniverseForked() public returns (bool);
26+
function logUniverseCreated(IUniverse _childUniverse) public returns (bool);
27+
function logFeeWindowTransferred(IUniverse _universe, address _from, address _to, uint256 _value) public returns (bool);
28+
function logReputationTokensTransferred(IUniverse _universe, address _from, address _to, uint256 _value) public returns (bool);
29+
function logDisputeCrowdsourcerTokensTransferred(IUniverse _universe, address _from, address _to, uint256 _value) public returns (bool);
30+
function logShareTokensTransferred(IUniverse _universe, address _from, address _to, uint256 _value) public returns (bool);
31+
function logReputationTokenBurned(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
32+
function logReputationTokenMinted(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
33+
function logShareTokenBurned(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
34+
function logShareTokenMinted(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
35+
function logFeeWindowBurned(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
36+
function logFeeWindowMinted(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
37+
function logDisputeCrowdsourcerTokensBurned(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
38+
function logDisputeCrowdsourcerTokensMinted(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
39+
function logFeeWindowCreated(IFeeWindow _feeWindow, uint256 _id) public returns (bool);
40+
function logFeeTokenTransferred(IUniverse _universe, address _from, address _to, uint256 _value) public returns (bool);
41+
function logFeeTokenBurned(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
42+
function logFeeTokenMinted(IUniverse _universe, address _target, uint256 _amount) public returns (bool);
43+
function logContractAddedToWhitelist(address _addition) public returns (bool);
44+
function logContractAddedToRegistry(bytes32 _key, address _address, bytes20 _commitHash, bytes32 _bytecodeHash) public returns (bool);
45+
}

source/contracts/IController.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pragma solidity 0.4.18;
22

3-
import 'Augur.sol';
3+
import 'IAugur.sol';
44

55

66
contract IController {
@@ -9,6 +9,6 @@ contract IController {
99
function assertOnlySpecifiedCaller(address _caller, bytes32 _allowedCaller) public view returns(bool);
1010
function stopInEmergency() public view returns(bool);
1111
function onlyInEmergency() public view returns(bool);
12-
function getAugur() public view returns (Augur);
12+
function getAugur() public view returns (IAugur);
1313
function getTimestamp() public view returns (uint256);
1414
}

source/contracts/factories/MarketFactory.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'reporting/IMarket.sol';
66
import 'reporting/IReputationToken.sol';
77
import 'trading/ICash.sol';
88
import 'IController.sol';
9-
import 'Augur.sol';
109

1110

1211
contract MarketFactory {

source/contracts/libraries/CashAutoConverter.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity 0.4.18;
33

44
import 'trading/ICash.sol';
55
import 'Controlled.sol';
6-
import 'Augur.sol';
6+
import 'IAugur.sol';
77

88

99
/**
@@ -30,7 +30,7 @@ contract CashAutoConverter is Controlled {
3030
ICash _cash = ICash(controller.lookup("Cash"));
3131
uint256 _tokenBalance = _cash.balanceOf(msg.sender);
3232
if (_tokenBalance > 0) {
33-
Augur augur = controller.getAugur();
33+
IAugur augur = controller.getAugur();
3434
augur.trustedTransfer(_cash, msg.sender, this, _tokenBalance);
3535
_cash.withdrawEtherTo(msg.sender, _tokenBalance);
3636
}

source/contracts/reporting/FeeToken.sol

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import 'reporting/IFeeToken.sol';
44
import 'reporting/IFeeWindow.sol';
55
import 'libraries/DelegationTarget.sol';
66
import 'libraries/token/VariableSupplyToken.sol';
7+
import 'libraries/Extractable.sol';
78

89

9-
contract FeeToken is DelegationTarget, VariableSupplyToken, IFeeToken {
10+
contract FeeToken is DelegationTarget, Extractable, VariableSupplyToken, IFeeToken {
1011
IFeeWindow private feeWindow;
1112

1213
function initialize(IFeeWindow _feeWindow) public beforeInitialized returns (bool) {
@@ -32,17 +33,21 @@ contract FeeToken is DelegationTarget, VariableSupplyToken, IFeeToken {
3233
}
3334

3435
function onTokenTransfer(address _from, address _to, uint256 _value) internal returns (bool) {
35-
feeWindow.getController().getAugur().logFeeTokenTransferred(feeWindow.getUniverse(), _from, _to, _value);
36+
controller.getAugur().logFeeTokenTransferred(feeWindow.getUniverse(), _from, _to, _value);
3637
return true;
3738
}
3839

3940
function onMint(address _target, uint256 _amount) internal returns (bool) {
40-
feeWindow.getController().getAugur().logFeeTokenMinted(feeWindow.getUniverse(), _target, _amount);
41+
controller.getAugur().logFeeTokenMinted(feeWindow.getUniverse(), _target, _amount);
4142
return true;
4243
}
4344

4445
function onBurn(address _target, uint256 _amount) internal returns (bool) {
45-
feeWindow.getController().getAugur().logFeeTokenBurned(feeWindow.getUniverse(), _target, _amount);
46+
controller.getAugur().logFeeTokenBurned(feeWindow.getUniverse(), _target, _amount);
4647
return true;
4748
}
48-
}
49+
50+
function getProtectedTokens() internal returns (address[] memory) {
51+
return new address[](0);
52+
}
53+
}

source/contracts/reporting/IFeeWindow.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ import 'reporting/IReputationToken.sol';
88
import 'reporting/IFeeToken.sol';
99
import 'trading/ICash.sol';
1010
import 'libraries/token/ERC20.sol';
11-
import 'IControlled.sol';
1211

1312

14-
contract IFeeWindow is ITyped, IControlled, ERC20 {
13+
contract IFeeWindow is ITyped, ERC20 {
1514
function initialize(IUniverse _universe, uint256 _feeWindowId) public returns (bool);
1615
function noteInitialReportingGasPrice() public returns (bool);
1716
function getUniverse() public view returns (IUniverse);

source/contracts/reporting/Mailbox.sol

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import 'libraries/token/ERC20Basic.sol';
66
import 'libraries/Initializable.sol';
77
import 'reporting/IMailbox.sol';
88
import 'trading/ICash.sol';
9+
import 'libraries/Extractable.sol';
910

1011

11-
contract Mailbox is DelegationTarget, Ownable, Initializable, IMailbox {
12+
contract Mailbox is DelegationTarget, Extractable, Ownable, Initializable, IMailbox {
1213
function initialize(address _owner) public onlyInGoodTimes beforeInitialized returns (bool) {
1314
endInitialization();
1415
owner = _owner;
@@ -39,4 +40,12 @@ contract Mailbox is DelegationTarget, Ownable, Initializable, IMailbox {
3940
require(_token.transfer(owner, _balance));
4041
return true;
4142
}
43+
44+
function getProtectedTokens() internal returns (address[] memory) {
45+
address[] memory _protectedTokens = new address[](2);
46+
// address(1) is the sentinel value for Ether extraction
47+
_protectedTokens[0] = address(1);
48+
_protectedTokens[1] = ICash(controller.lookup("Cash"));
49+
return _protectedTokens;
50+
}
4251
}

source/contracts/reporting/Market.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import 'factories/MailboxFactory.sol';
2424
import 'reporting/IMailbox.sol';
2525
import 'reporting/Reporting.sol';
2626
import 'reporting/IInitialReporter.sol';
27-
import 'Augur.sol';
2827

2928

3029
contract Market is DelegationTarget, Extractable, ITyped, Initializable, Ownable, IMarket {

0 commit comments

Comments
 (0)