Skip to content

Commit

Permalink
Patch prod with CLI fix for contracts change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Moreton committed Aug 16, 2019
1 parent c8f8b1f commit d81cbdd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/cli/src/adapters/bonded-deposit.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -25,6 +23,13 @@ export interface Deposits {
weight: BN
}
}

enum Roles {
validating,
voting,
rewards,
}

export class BondedDepositAdapter {
public contractPromise: ReturnType<typeof BondedDeposits>

Expand All @@ -45,7 +50,9 @@ export class BondedDepositAdapter {
async getVotingDetails(accountOrVoterAddress: Address): Promise<VotingDetails> {
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,
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit d81cbdd

Please sign in to comment.