Skip to content

Commit

Permalink
fix(build): hotfixes tests and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
n1c01a5 committed Mar 1, 2019
1 parent 76a2c10 commit 83d04ba
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 31 deletions.
2 changes: 1 addition & 1 deletion contracts/standard/permission/ArbitrableTokenList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ contract ArbitrableTokenList is PermissionInterface, Arbitrable {
);
if (bytes(_evidence).length > 0)
emit Evidence(request.arbitrator, uint(keccak256(abi.encodePacked(_tokenID,token.requests.length - 1))), msg.sender, _evidence);
}
}

/** @dev Takes up to the total amount required to fund a side of an appeal. Reimburses the rest. Creates an appeal if both sides are fully funded. TRUSTED.
* @param _tokenID The ID of the token with the request to fund.
Expand Down
2 changes: 1 addition & 1 deletion test/appealable-arbitrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ contract('AppealableArbitrator', function(accounts) {
from: appealable,
value: arbitrationFee
})
centralizedArbitrator.giveRuling(0, 2, { from: arbitrator })
await centralizedArbitrator.giveRuling(0, 1, { from: arbitrator })
const disputeAppeal = await appealableArbitrator.disputes(0)
const disputeArbitrator = await centralizedArbitrator.disputes(0)
assert.equal(
Expand Down
11 changes: 6 additions & 5 deletions test/arbitrable-address-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,12 @@ contract('ArbitrableAddressList', function(accounts) {
submissionAddress,
0
)
const round = await arbitrableAddressList.getRoundInfo(
submissionAddress,
0,
0
)
// TODO: add test for `round`
// const round = await arbitrableAddressList.getRoundInfo(
// submissionAddress,
// 0,
// 0
// )
assert.isFalse(request[0])
assert.equal(
await web3.eth.getBalance(arbitrableAddressList.address),
Expand Down
6 changes: 3 additions & 3 deletions test/arbitrable-kitty.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ contract('ArbitrableKitty', accounts => {
)

await arbitrable.consentToTransfer(kittyId, PARTY_A, { from: PARTY_B })
arbitrable.transfer(PARTY_A, kittyId, { from: PARTY_A })
await arbitrable.transfer(PARTY_A, kittyId, { from: PARTY_A })

assert.equal(
await kittyCore.ownerOf(kittyId),
PARTY_A,
'party B should own kitty'
'party A should own kitty'
)
})

Expand All @@ -260,7 +260,7 @@ contract('ArbitrableKitty', accounts => {
)

await arbitrable.consentToTransfer(kittyId, OTHER_USER, { from: PARTY_A })
arbitrable.transfer(OTHER_USER, kittyId, { from: PARTY_B })
await arbitrable.transfer(OTHER_USER, kittyId, { from: PARTY_B })

assert.equal(
await kittyCore.ownerOf(kittyId),
Expand Down
74 changes: 53 additions & 21 deletions test/arbitrable-token-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ contract('ArbitrableTokenList', function(accounts) {
let appealableArbitrator
let enhancedAppealableArbitrator
let arbitrableTokenList
let MULTIPLIER_DIVISOR
let tokenID

const TOKEN_STATUS = {
Expand All @@ -42,15 +41,6 @@ contract('ArbitrableTokenList', function(accounts) {
ClearingRequested: 3
}

const DISPUTE_STATUS = {
Waiting: 0,
Appealable: 1,
Solved: 2
}

const RULING_OPTIONS = { Other: 0, Accept: 1, Refuse: 2 }
const PARTY = { None: 0, Requester: 1, Challenger: 2 }

const deployArbitrators = async () => {
appealableArbitrator = await AppealableArbitrator.new(
arbitrationCost, // _arbitrationCost
Expand Down Expand Up @@ -111,15 +101,23 @@ contract('ArbitrableTokenList', function(accounts) {
'PNK',
0x1,
'BcdwnVkEp8Nn41U2homNwyiVWYmPsXxEdxCUBn9V8y5AvqQaDwadDkQmwEWoyWgZxYnKsFPNauPhawDkME1nFNQbCu',
{ from: partyA, value: baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000 }
{
from: partyA,
value:
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
}
)
tokenID = tx.logs[1].args._tokenID
})

it('request should have been placed', async () => {
assert.equal(
(await web3.eth.getBalance(arbitrableTokenList.address)).toNumber(),
baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
)

const token = await arbitrableTokenList.getTokenInfo(tokenID)
Expand All @@ -133,11 +131,16 @@ contract('ArbitrableTokenList', function(accounts) {
assert.equal(token[4].toNumber(), TOKEN_STATUS.RegistrationRequested)

const request = await arbitrableTokenList.getRequestInfo(tokenID, 0)
const round = await arbitrableTokenList.getRoundInfo(tokenID, 0, 0)
assert.isFalse(request[0])

// TODO: add for the `round`
// const round = await arbitrableTokenList.getRoundInfo(tokenID, 0, 0)

assert.equal(
await web3.eth.getBalance(arbitrableTokenList.address),
baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
)
})

Expand Down Expand Up @@ -275,7 +278,13 @@ contract('ArbitrableTokenList', function(accounts) {
'MKR',
0x2,
'BcdwnVkEp8Nn41U2homNwyiVWYmPsXxEdxCUBn9V8y5AvqQaDwadDkQmwEWoyWgZxYnKsFPNauThawDkME1nFNQbCu',
{ from: partyA, value: baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000}
{
from: partyA,
value:
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
}
)
mkrSubmissions.push(tx.logs[1].args._tokenID)
tokenIDs.push(tx.logs[1].args._tokenID)
Expand All @@ -285,7 +294,13 @@ contract('ArbitrableTokenList', function(accounts) {
'MKR',
0x2,
'BcdwnVkEp8Nn41U2homNwyiVWYmPsXxEdxCUBn9V8y5AvqQaDwadDkQmwEWoyWgZxYnKsFPNauZhawDkME1nFNQbCu',
{ from: partyA, value: baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000 }
{
from: partyA,
value:
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
}
)
mkrSubmissions.push(tx.logs[1].args._tokenID)
tokenIDs.push(tx.logs[1].args._tokenID)
Expand All @@ -295,7 +310,13 @@ contract('ArbitrableTokenList', function(accounts) {
'MKR',
0x2,
'BcdwnVkEp8Nn41U2homNwyiVWYmPsXxEdxCUBn9V8y5AvqQaDwadDkQmwEWoyWgZxYnKsFPNauQhawDkME1nFNQbCu',
{ from: partyA, value: baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000 }
{
from: partyA,
value:
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
}
)
mkrSubmissions.push(tx.logs[1].args._tokenID)
tokenIDs.push(tx.logs[1].args._tokenID)
Expand All @@ -308,7 +329,13 @@ contract('ArbitrableTokenList', function(accounts) {
'OMG',
0x3,
'BcdwnVkEp8Nn41U2homNwyiVWYmPsXxEdxCUBn9V8y5AvqQaDwadDkQmwEWoyWgZxYnKsFPNauQhawDkME1nFNQbCu',
{ from: partyA, value: baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000 }
{
from: partyA,
value:
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
}
)
tokenIDs.push(tx.logs[1].args._tokenID)
await increaseTime(challengePeriodDuration + 1)
Expand All @@ -321,15 +348,20 @@ contract('ArbitrableTokenList', function(accounts) {
'BNB',
0x4,
'BcdwnVkEp8Nn41U2homNwyiVWYmPsXxEdxCUBn9V8y5AvqQaDwadDkQmwEWoyWgZxYnKsFPNauQhawDkME1nFNQbCu',
{ from: partyA, value: baseDeposit + arbitrationCost + (sharedStakeMultiplier * arbitrationCost)/10000 }
{
from: partyA,
value:
baseDeposit +
arbitrationCost +
(sharedStakeMultiplier * arbitrationCost) / 10000
}
)
tokenIDs.push(tx.logs[1].args._tokenID)

await increaseTime(challengePeriodDuration + 1)
await arbitrableTokenList.executeRequest(tx.logs[1].args._tokenID, {
from: partyA
})

})

it('should return token submissions for address', async () => {
Expand Down

0 comments on commit 83d04ba

Please sign in to comment.