Skip to content

Commit

Permalink
fix(t2cr): check that both lastAction and request length
Browse files Browse the repository at this point in the history
  • Loading branch information
eccentricexit committed Nov 22, 2018
1 parent 356babc commit 4961f4d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions contracts/standard/permission/ArbitrableTokenList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ contract ArbitrableTokenList is PermissionInterface, Arbitrable {
*/
function fundChallenger(bytes32 _tokenID) external payable {
Token storage token = tokens[_tokenID];
require(token.lastAction + request.timeToChallenge < now, "The time to challenge has already passed.");
require(!request.disputed, "The token is already disputed");
require(token.lastAction == 0 || token.requests.length == 0, "The specified token does not exist.");
require(
token.status == TokenStatus.RegistrationRequested || token.status == TokenStatus.ClearingRequested,
"Token does not have any pending requests"
);
require(token.requests.length == 0, "The specified token does not exist.");
Request storage request = token.requests[token.requests.length - 1];
require(!request.disputed, "The token is already disputed");
require(token.lastAction + request.timeToChallenge < now, "The time to challenge has already passed.");
require(request.challengeRewardBalance == request.challengeReward, "There isn't a pending request for this token.");
require(
msg.value >= request.challengeReward + request.requiredFeeStake,
Expand Down Expand Up @@ -249,7 +249,7 @@ contract ArbitrableTokenList is PermissionInterface, Arbitrable {
token.status == TokenStatus.RegistrationRequested || token.status == TokenStatus.ClearingRequested,
"Token does not have any pending requests"
);
require(token.requests.length == 0, "The specified token does not exist.");
require(token.lastAction == 0 || token.requests.length == 0, "The specified token does not exist.");
Request storage request = token.requests[token.requests.length - 1];
require(!request.disputed, "The token is already disputed");
require(request.firstContributionTime + request.arbitrationFeesWaitingTime > now, "Arbitration fees timed out.");
Expand Down Expand Up @@ -292,7 +292,7 @@ contract ArbitrableTokenList is PermissionInterface, Arbitrable {
*/
function crowdfundDispute(bytes32 _tokenID, Party _party) external payable {
Token storage token = tokens[_tokenID];
require(token.requests.length == 0, "The specified token does not exist.");
require(token.lastAction == 0 || token.requests.length == 0, "The specified token does not exist.");
Request storage request = token.requests[token.requests.length - 1];
Round storage round = request.rounds[request.rounds.length - 1];
require(
Expand Down Expand Up @@ -331,7 +331,7 @@ contract ArbitrableTokenList is PermissionInterface, Arbitrable {

function fundAppealLosingSide(bytes32 _tokenID) external payable {
Token storage token = tokens[_tokenID];
require(token.requests.length == 0, "The specified token does not exist.");
require(token.lastAction == 0 || token.requests.length == 0, "The specified token does not exist.");
Request storage request = token.requests[token.requests.length - 1];
require(
arbitrator.disputeStatus(request.disputeID) == Arbitrator.DisputeStatus.Appealable,
Expand Down Expand Up @@ -369,6 +369,7 @@ contract ArbitrableTokenList is PermissionInterface, Arbitrable {
*/
function executeRequest(bytes32 _tokenID) external {
Token storage token = tokens[_tokenID];
require(token.lastAction == 0 || token.requests.length == 0, "The specified token does not exist.");
Request storage request = token.requests[token.requests.length - 1];
require(token.lastAction + timeToChallenge > now, "The time to challenge has not passed yet.");
require(!request.disputed, "The specified token is disputed.");
Expand Down

0 comments on commit 4961f4d

Please sign in to comment.