Skip to content
Permalink
Browse files

feat: normalize token units

  • Loading branch information...
epiqueras authored and satello committed Feb 14, 2018
1 parent b76e5e9 commit d0d40f8770e43b47e39b00c4c2413ddd76055020
@@ -196,7 +196,7 @@ class Notifications extends AbstractWrapper {
* Fetch all user notifications
* @param {string} account address of user
*/
getNoticiations = async (
getNotifications = async (
account
) => {
const profile = await this._StoreProvider.getUserProfile(account)
@@ -390,8 +390,8 @@ class ArbitrableTransactionWrapper extends ContractWrapper {
status: status.toNumber(),
arbitratorExtraData,
disputeId: disputeId.toNumber(),
partyAFee: partyAFee.toNumber(),
partyBFee: partyBFee.toNumber(),
partyAFee: this._Web3Wrapper.fromWei(partyAFee.toNumber(), 'ether'),
partyBFee: this._Web3Wrapper.fromWei(partyBFee.toNumber(), 'ether'),
lastInteraction,
}
}
@@ -184,7 +184,7 @@ class KlerosWrapper extends ContractWrapper {
try {
const arbitrationCost = await contractInstance.arbitrationCost(contractExtraData)

return arbitrationCost.toNumber()
return this._Web3Wrapper.fromWei(arbitrationCost.toNumber(), 'ether')
} catch (e) {
throw new Error(e)
}
@@ -380,7 +380,7 @@ class KlerosWrapper extends ContractWrapper {
numberOfAppeals: dispute[2].toNumber(),
rulingChoices: dispute[3].toNumber(),
initialNumberJurors: dispute[4].toNumber(),
arbitrationFeePerJuror: dispute[5].toNumber(),
arbitrationFeePerJuror: this._Web3Wrapper.fromWei(dispute[5].toNumber(), 'ether'),
state: dispute[6].toNumber(),
status: (await contractInstance.disputeStatus(disputeId)).toNumber()
}
@@ -585,15 +585,15 @@ describe('Kleros', () => {

expect(notifications.length).toBeTruthy()
// partyA got notifications
const allNotifications = await KlerosInstance.notifications.getNoticiations(partyA)
const allNotifications = await KlerosInstance.notifications.getNotifications(partyA)
expect(allNotifications.length).toBe(notifications.length)
let unreadNotification = await KlerosInstance.notifications.getUnreadNotifications(partyA)
expect(unreadNotification).toEqual(allNotifications)
await KlerosInstance.notifications.markNotificationAsRead(partyA, allNotifications[0].txHash, allNotifications[0].logIndex)
unreadNotification = await KlerosInstance.notifications.getUnreadNotifications(partyA)
expect(unreadNotification.length).toBe(notifications.length - 1)
// juror subscribed once drawn and got notifications
const jurorNotifications = await KlerosInstance.notifications.getNoticiations(juror)
const jurorNotifications = await KlerosInstance.notifications.getNotifications(juror)
expect(jurorNotifications.length).toEqual(4) // should have 1 notification for arbitration fee and 3 token redistribution notifications
// stop listening for new disputes
KlerosInstance.eventListener.stopWatchingArbitratorEvents(klerosCourt.address)

0 comments on commit d0d40f8

Please sign in to comment.
You can’t perform that action at this time.