From d81cbdd31f92dcb9ceb534a52926db694274640e Mon Sep 17 00:00:00 2001 From: Tim Moreton Date: Fri, 16 Aug 2019 12:56:18 -0700 Subject: [PATCH] Patch prod with CLI fix for contracts change --- packages/cli/src/adapters/bonded-deposit.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/adapters/bonded-deposit.ts b/packages/cli/src/adapters/bonded-deposit.ts index 395733bdc9c..263be39faed 100644 --- a/packages/cli/src/adapters/bonded-deposit.ts +++ b/packages/cli/src/adapters/bonded-deposit.ts @@ -1,9 +1,7 @@ +import { BondedDeposits } from '@celo/walletkit' import BN from 'bn.js' import Web3 from 'web3' import { TransactionObject } from 'web3/eth/types' - -import { BondedDeposits } from '@celo/walletkit' - import { Address, zip } from '../utils/helpers' export interface VotingDetails { @@ -25,6 +23,13 @@ export interface Deposits { weight: BN } } + +enum Roles { + validating, + voting, + rewards, +} + export class BondedDepositAdapter { public contractPromise: ReturnType @@ -45,7 +50,9 @@ export class BondedDepositAdapter { async getVotingDetails(accountOrVoterAddress: Address): Promise { const contract = await this.contract() - const accountAddress = await contract.methods.getAccountFromVoter(accountOrVoterAddress).call() + const accountAddress = await contract.methods + .getAccountFromDelegateAndRole(accountOrVoterAddress, Roles.voting) + .call() return { accountAddress, @@ -124,7 +131,7 @@ export class BondedDepositAdapter { const contract = await this.contract() const sig = await this.getParsedSignatureOfAddress(account, delegate) - return contract.methods.delegateRewards(delegate, sig.v, sig.r, sig.s) + return contract.methods.delegateRole(Roles.rewards, delegate, sig.v, sig.r, sig.s) } async getParsedSignatureOfAddress(address: string, signer: string) {