Skip to content
Permalink
Browse files

feat: minAcivatedTokens and timePerPeriod

  • Loading branch information...
satello committed Jul 31, 2018
1 parent a75ea7d commit b49796e93d5676ae5d058cbe4d989c16f7a6d319
@@ -152,6 +152,12 @@ class ContractImplementation {
* @returns {string} - The address of the contract.
*/
getContractAddress = () => this.contractAddress

/**
* Returns the web3 wrapper
* @returns {object} - Web3 Wrapper
*/
getWeb3Wrapper = () => this._Web3Wrapper
}

export default ContractImplementation
@@ -498,6 +498,18 @@ class Kleros extends ContractImplementation {
return currentPeriod.toNumber()
}

/**
* Get min activated tokens for a session
* @returns {number} - Number of tokens
*/
getMinActivatedToken = async () => {
await this.loadContract()

const minActivatedTokens = await this.contractInstance.minActivatedToken()

return this._Web3Wrapper.fromWei(minActivatedTokens.toNumber(), 'ether')
}

/**
* Get current session of the contract.
* @returns {number} - Int indicating the session.
@@ -750,26 +762,37 @@ class Kleros extends ContractImplementation {
getData = async () => {
await this.loadContract()

const timePerPeriod = await Promise.all([
this.getTimeForPeriod(arbitratorConstants.PERIOD.ACTIVATION),
this.getTimeForPeriod(arbitratorConstants.PERIOD.DRAW),
this.getTimeForPeriod(arbitratorConstants.PERIOD.VOTE),
this.getTimeForPeriod(arbitratorConstants.PERIOD.APPEAL),
this.getTimeForPeriod(arbitratorConstants.PERIOD.EXECUTE)
])
const [
pinakionContractAddress,
rngContractAddress,
period,
session,
lastPeriodChange
lastPeriodChange,
minActivatedToken
] = await Promise.all([
this.contractInstance.pinakion(),
this.contractInstance.rng(),
this.contractInstance.period(),
this.contractInstance.session(),
this.contractInstance.lastPeriodChange()
this.contractInstance.lastPeriodChange(),
this.getMinActivatedToken()
])

return {
pinakionContractAddress,
rngContractAddress,
period: period.toNumber(),
session: session.toNumber(),
lastPeriodChange: lastPeriodChange.toNumber()
lastPeriodChange: lastPeriodChange.toNumber(),
timePerPeriod,
minActivatedToken
}
}
}
@@ -17,6 +17,7 @@ class Notifications {
storeProviderInstance
) {
this._ArbitratorInstance = arbitratorInstance
this._Web3Wrapper = this._ArbitratorInstance.getWeb3Wrapper()
this._ArbitrableInstance = arbitrableInstance
this._StoreProviderInstance = storeProviderInstance
}
@@ -471,7 +472,7 @@ class Notifications {
event.blockNumber,
event.logIndex,
notificationConstants.TYPE.TOKEN_SHIFT,
'Tokens have been redistributed',
`You have ${amount < 0 ? 'lost' : 'won'} ${this._Web3Wrapper.fromWei(amount, 'ether')} PNK.`,
{
disputeId,
arbitratorAddress,
@@ -504,7 +505,7 @@ class Notifications {
event.blockNumber,
event.logIndex,
notificationConstants.TYPE.ARBITRATION_REWARD,
'Juror awarded arbitration fee',
`You have been awarded an ${this._Web3Wrapper.fromWei(amount, 'ether')} ETH arbitration fee`,
{
disputeId,
arbitratorAddress,

0 comments on commit b49796e

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