@@ -22,11 +22,16 @@ contract ReputationToken is DelegationTarget, Extractable, ITyped, Initializable
22
22
string constant public symbol = "REP " ;
23
23
uint256 constant public decimals = 18 ;
24
24
IUniverse private universe;
25
+ uint256 private totalMigrated;
26
+ mapping (address => uint256 ) migratedToSibling;
27
+ uint256 private parentTotalTheoreticalSupply;
28
+ uint256 private totalTheoreticalSupply;
25
29
26
30
function initialize (IUniverse _universe ) public onlyInGoodTimes beforeInitialized returns (bool ) {
27
31
endInitialization ();
28
32
require (_universe != address (0 ));
29
33
universe = _universe;
34
+ updateParentTotalTheoreticalSupply ();
30
35
return true ;
31
36
}
32
37
@@ -42,12 +47,13 @@ contract ReputationToken is DelegationTarget, Extractable, ITyped, Initializable
42
47
IUniverse _parentUniverse = universe.getParentUniverse ();
43
48
require (ReputationToken (msg .sender ) == _parentUniverse.getReputationToken ());
44
49
mint (_reporter, _attotokens);
45
- // Award a bonus if migration is done before the fork has resolved and check if the fork can be resolved early
50
+ totalMigrated += _attotokens;
51
+ // Award a bonus if migration is done before the fork has resolved and update the universe tentative winner tracking
46
52
if (! _parentUniverse.getForkingMarket ().isFinalized ()) {
47
- mint (_reporter, _attotokens.div (Reporting.getForkMigrationPercentageBonusDivisor () ));
48
- if (supply > _parentUniverse. getForkReputationGoal ()) {
49
- _parentUniverse. getForkingMarket (). finalizeFork () ;
50
- }
53
+ uint256 _bonus = _attotokens.div (Reporting.getForkMigrationPercentageBonusDivisor ());
54
+ mint (_reporter, _bonus);
55
+ totalTheoreticalSupply += _bonus ;
56
+ _parentUniverse. updateTentativeWinningChildUniverse (universe. getParentPayoutDistributionHash ());
51
57
}
52
58
return true ;
53
59
}
@@ -64,7 +70,9 @@ contract ReputationToken is DelegationTarget, Extractable, ITyped, Initializable
64
70
IUniverse _parentUniverse = universe.getParentUniverse ();
65
71
IReportingParticipant _reportingParticipant = IReportingParticipant (msg .sender );
66
72
require (_parentUniverse.isContainerForReportingParticipant (_reportingParticipant));
67
- mint (_reportingParticipant, _amountMigrated / 2 );
73
+ uint256 _bonus = _amountMigrated / 2 ;
74
+ mint (_reportingParticipant, _bonus);
75
+ totalTheoreticalSupply += _bonus;
68
76
return true ;
69
77
}
70
78
@@ -108,6 +116,36 @@ contract ReputationToken is DelegationTarget, Extractable, ITyped, Initializable
108
116
return universe;
109
117
}
110
118
119
+ function getTotalMigrated () public view returns (uint256 ) {
120
+ return totalMigrated;
121
+ }
122
+
123
+ function updateSiblingMigrationTotal (IReputationToken _token ) public returns (bool ) {
124
+ require (_token != this );
125
+ IUniverse _supposedUniverse = _token.getUniverse ();
126
+ require (_token == universe.getParentUniverse ().getChildUniverse (_supposedUniverse.getParentPayoutDistributionHash ()).getReputationToken ());
127
+ totalTheoreticalSupply += migratedToSibling[_token];
128
+ migratedToSibling[_token] = _token.getTotalMigrated ();
129
+ totalTheoreticalSupply -= migratedToSibling[_token];
130
+ return true ;
131
+ }
132
+
133
+ function updateParentTotalTheoreticalSupply () public returns (bool ) {
134
+ IUniverse _parentUniverse = universe.getParentUniverse ();
135
+ totalTheoreticalSupply -= parentTotalTheoreticalSupply;
136
+ if (_parentUniverse == IUniverse (0 )) {
137
+ parentTotalTheoreticalSupply = Reporting.getInitialREPSupply ();
138
+ } else {
139
+ parentTotalTheoreticalSupply = _parentUniverse.getReputationToken ().getTotalTheoreticalSupply ();
140
+ }
141
+ totalTheoreticalSupply += parentTotalTheoreticalSupply;
142
+ return true ;
143
+ }
144
+
145
+ function getTotalTheoreticalSupply () public view returns (uint256 ) {
146
+ return totalTheoreticalSupply;
147
+ }
148
+
111
149
function onTokenTransfer (address _from , address _to , uint256 _value ) internal returns (bool ) {
112
150
controller.getAugur ().logReputationTokensTransferred (universe, _from, _to, _value);
113
151
return true ;
0 commit comments