Skip to content
Permalink
Browse files

feat: remove conversions

  • Loading branch information...
satello committed Sep 4, 2018
1 parent b6a5c98 commit 7a5bae55cdb0cb3d2ddbd5420fc17f588f2d7b3b
@@ -29,8 +29,8 @@
"docs": "esdoc",
"prettify": "kleros-scripts prettify",
"lint": "kleros-scripts lint:js --config ./.eslintrc.js",
"ganache": "ganache-cli -a 15",
"test": "jest --config ./jest.config.js",
"ganache": "ganache-cli -a 15 -s 1",
"test": "GAS=3000000 jest --config ./jest.config.js",
"test:coveralls": "coveralls < ./coverage/lcov.info",
"commitmsg": "kleros-scripts commitmsg",
"cz": "kleros-scripts cz",
@@ -55,7 +55,7 @@
"esdoc": "^1.0.4",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0",
"ganache-cli": "^6.1.0",
"ganache-cli": "^6.1.8",
"husky": "^0.14.3",
"jest": "^22.4.2",
"kleros-scripts": "^0.4.0",
@@ -70,7 +70,7 @@
"ethereumjs-util": "^5.2.0",
"ethjs": "^0.4.0",
"kleros": "^0.0.6",
"kleros-interaction": "^0.0.18",
"kleros-interaction": "^0.0.22",
"lodash": "^4.17.4",
"minimetoken": "^0.2.0",
"truffle-contract": "^2.0.5",
@@ -63,19 +63,19 @@ class MiniMePinakion extends ContractImplementation {

/**
* Transfer ownership of the PNK contract to the kleros POC contract.
* @param {string} klerosAddress - Address of Kleros POC contract.
* @param {string} account - Address of user.
* @param {string} newControllerAddress - Address of the new controller.
* @param {string} controllerAccount - Address of the current controller. (They must sign the tx)
* @returns {object} - The result transaction object.
*/
changeController = async (
klerosAddress,
account = this._Web3Wrapper.getAccount(0)
newControllerAddress,
controllerAccount
) => {
await this.loadContract()

try {
return this.contractInstance.changeController(klerosAddress, {
from: account
return this.contractInstance.changeController(newControllerAddress, {
from: controllerAccount,
})
} catch (err) {
console.error(err)
@@ -87,20 +87,16 @@ class MiniMePinakion extends ContractImplementation {
* Approve the arbitrator contract to transfer PNK to the contract and call the arbitrators
* receiveApproval()
* @param {string} arbitratorAddress - The address of the arbitrator contract.
* @param {number} amount - The amount of PNK to transfer.
* @param {number} amount - The amount of PNK to transfer in wei.
* @param {string} account - The users account.
* @returns {bool} If the transfer succeeded or not
*/
approveAndCall = async (
arbitratorAddress,
amount,
account = this._Web3Wrapper.getAccount(0)
) => {
approveAndCall = async (arbitratorAddress, amount, account) => {
await this.loadContract()

return this.contractInstance.approveAndCall(
arbitratorAddress,
this._Web3Wrapper.toWei(amount, 'ether'),
amount,
'0x0',
{
from: account
@@ -118,6 +114,12 @@ class MiniMePinakion extends ContractImplementation {

return this.contractInstance.balanceOf(account)
}

getController = async () => {
await this.loadContract()

return this.contractInstance.controller()
}
}

export default MiniMePinakion
@@ -44,7 +44,7 @@ class PinakionPOC extends ContractImplementation {
*/
setKleros = async (
klerosAddress,
account = this._Web3Wrapper.getAccount(0)
account
) => {
await this.loadContract()

@@ -66,7 +66,7 @@ class PinakionPOC extends ContractImplementation {
*/
transferOwnership = async (
klerosAddress,
account = this._Web3Wrapper.getAccount(0)
account
) => {
await this.loadContract()

@@ -1,4 +1,4 @@
import BlockHashRNGArtifact from 'kleros-interaction/build/contracts/BlockHashRNG'
import BlockHashRNGArtifact from 'kleros-interaction/build/contracts/BlockHashRNGFallback'
import _ from 'lodash'

import * as ethConstants from '../../../constants/eth'
@@ -27,7 +27,7 @@ class BlockHashRNG extends ContractImplementation {
static deploy = async (account, web3Provider) => {
const contractDeployed = await deployContractAsync(
account,
ethConstants.TRANSACTION.VALUE,
0,
BlockHashRNGArtifact,
web3Provider
)
@@ -59,11 +59,11 @@ class ArbitrableTransaction extends Arbitrable {

/**
* Pay the party B. To be called when the good is delivered or the service rendered.
* @param {string} account - Ethereum account (default account[0]).
* @param {string} account - Ethereum address.
* @param {string} contractAddress - The address of the arbitrator contract.
* @returns {object} - The result transaction object.
*/
pay = async (account = this._Web3Wrapper.getAccount(0)) => {
pay = async account => {
await this.loadContract()

try {
@@ -79,20 +79,20 @@ class ArbitrableTransaction extends Arbitrable {

/**
* Pay the arbitration fee to raise a dispute. To be called by the party A.
* @param {string} account - Ethereum account (default account[0]).
* @param {number} arbitrationCost - Amount to pay the arbitrator. (default 0.15 ether).
* @param {string} account - Ethereum address.
* @param {number} arbitrationCost - Arbitration fee in wei.
* @returns {object} - The result transaction object.
*/
payArbitrationFeeByPartyA = async (
account = this._Web3Wrapper.getAccount(0),
arbitrationCost = 0.15
account,
arbitrationCost
) => {
await this.loadContract()

try {
return this.contractInstance.payArbitrationFeeByPartyA({
from: account,
value: this._Web3Wrapper.toWei(arbitrationCost, 'ether')
value: arbitrationCost
})
} catch (err) {
console.error(err)
@@ -102,20 +102,21 @@ class ArbitrableTransaction extends Arbitrable {

/**
* Pay the arbitration fee to raise a dispute. To be called by the party B.
* @param {string} account Ethereum account (default account[1]).
* @param {number} arbitrationCost Amount to pay the arbitrator. (default 10000 wei).
* @param {string} account Ethereum address.
* @param {number} arbitrationCost Amount to pay the arbitrator.
* @returns {object} - The result transaction object.
*/
payArbitrationFeeByPartyB = async (
account = this._Web3Wrapper.getAccount(1),
arbitrationCost = 0.15
account,
arbitrationCost
) => {
await this.loadContract()

try {
return this.contractInstance.payArbitrationFeeByPartyB({
from: account,
value: this._Web3Wrapper.toWei(arbitrationCost, 'ether')
value: arbitrationCost,
gas: process.env.GAS || undefined
})
} catch (err) {
console.error(err)
@@ -131,7 +132,7 @@ class ArbitrableTransaction extends Arbitrable {
* @param {string} url A link to an evidence using its URI.
* @returns {string} txHash Hash transaction.
*/
submitEvidence = async (account = this._Web3Wrapper.getAccount(0), url) => {
submitEvidence = async (account, url) => {
await this.loadContract()

const txHashObj = await this.contractInstance.submitEvidence(url, {
@@ -147,7 +148,7 @@ class ArbitrableTransaction extends Arbitrable {
* @param {string} account ETH address of user
* @returns {object} The result transaction object.
*/
callTimeOutPartyA = async (account = this._Web3Wrapper.getAccount(0)) => {
callTimeOutPartyA = async account => {
await this.loadContract()

const status = (await this.contractInstance.status()).toNumber()
@@ -177,7 +178,7 @@ class ArbitrableTransaction extends Arbitrable {
* @param {string} contractAddress - ETH address of contract.
* @returns {object} The result transaction object.
*/
callTimeOutPartyB = async (account = this._Web3Wrapper.getAccount(1)) => {
callTimeOutPartyB = async account => {
await this.loadContract()

const status = await this.contractInstance.status()
@@ -204,21 +205,21 @@ class ArbitrableTransaction extends Arbitrable {
/**
* Appeal an appealable ruling.
* @param {string} account Ethereum account (default account[0]).
* @param {number} appealCost Fee for the appeal
* @param {bytes} extraData for the arbitrator appeal procedure.
* @param {number} appealCost Amount to pay the arbitrator. (default 0.35 ether).
* @returns {object} - The result transaction object.
*/
appeal = async (
account = this._Web3Wrapper.getAccount(0),
extraData = 0x0,
appealCost = 0.3
account,
appealCost,
extraData = 0x0
) => {
await this.loadContract()

try {
return this.contractInstance.appeal(extraData, {
from: account,
value: this._Web3Wrapper.toWei(appealCost, 'ether')
value: appealCost
})
} catch (err) {
console.error(err)
@@ -276,8 +277,8 @@ class ArbitrableTransaction extends Arbitrable {
status: status.toNumber(),
arbitratorExtraData,
disputeId: disputeId.toNumber(),
partyAFee: this._Web3Wrapper.fromWei(partyAFee, 'ether'),
partyBFee: this._Web3Wrapper.fromWei(partyBFee, 'ether'),
partyAFee,
partyBFee,
lastInteraction: lastInteraction.toNumber(),
amount: amount.toNumber(),
evidence,
Oops, something went wrong.

0 comments on commit 7a5bae5

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