Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def get_w3_with_priv_key(priv_key: str):

import logging
from typing import Optional, List, Union
from decimal import Decimal

from human_protocol_sdk.constants import (
ESCROW_BULK_PAYOUT_MAX_ITEMS,
Expand Down Expand Up @@ -122,9 +121,9 @@ def __init__(
recording_oracle_address: str,
reputation_oracle_address: str,
exchange_oracle_address: str,
recording_oracle_fee: Decimal,
reputation_oracle_fee: Decimal,
exchange_oracle_fee: Decimal,
recording_oracle_fee: int,
reputation_oracle_fee: int,
exchange_oracle_fee: int,
manifest: str,
hash: str,
):
Expand Down Expand Up @@ -362,7 +361,7 @@ def get_w3_with_priv_key(priv_key: str):
def fund(
self,
escrow_address: str,
amount: Decimal,
amount: int,
tx_options: Optional[TxParams] = None,
) -> None:
"""
Expand Down Expand Up @@ -428,7 +427,7 @@ def store_results(
escrow_address: str,
url: str,
hash: str,
funds_to_reserve: Optional[Decimal] = None,
funds_to_reserve: Optional[int] = None,
tx_options: Optional[TxParams] = None,
) -> None:
"""
Expand Down Expand Up @@ -570,7 +569,7 @@ def bulk_payout(
self,
escrow_address: str,
recipients: List[str],
amounts: List[Decimal],
amounts: List[int],
final_results_url: str,
final_results_hash: str,
payout_id: Union[str, int],
Expand Down Expand Up @@ -679,7 +678,7 @@ def create_bulk_payout_transaction(
self,
escrow_address: str,
recipients: List[str],
amounts: List[Decimal],
amounts: List[int],
final_results_url: str,
final_results_hash: str,
payoutId: str,
Expand Down Expand Up @@ -802,7 +801,7 @@ def ensure_correct_bulk_payout_input(
self,
escrow_address: str,
recipients: List[str],
amounts: List[Decimal],
amounts: List[int],
final_results_url: str,
final_results_hash: str,
) -> None:
Expand Down Expand Up @@ -1047,7 +1046,7 @@ def get_w3_with_priv_key(priv_key: str):
except Exception as e:
handle_error(e, EscrowClientError)

def get_balance(self, escrow_address: str) -> Decimal:
def get_balance(self, escrow_address: str) -> int:
"""
Gets the balance for a specified escrow address.

Expand Down Expand Up @@ -1089,7 +1088,7 @@ def get_balance(self, escrow_address: str) -> Decimal:

return self._get_escrow_contract(escrow_address).functions.getBalance().call()

def get_reserved_funds(self, escrow_address: str) -> Decimal:
def get_reserved_funds(self, escrow_address: str) -> int:
"""
Gets the reserved funds for a specified escrow address.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def get_w3_with_priv_key(priv_key: str):
import logging
import os

from decimal import Decimal
from typing import Optional

import web3
Expand Down Expand Up @@ -133,9 +132,7 @@ def __init__(self, w3: Web3):
)

@requires_signer
def approve_stake(
self, amount: Decimal, tx_options: Optional[TxParams] = None
) -> None:
def approve_stake(self, amount: int, tx_options: Optional[TxParams] = None) -> None:
"""Approves HMT token for Staking.

:param amount: Amount to approve
Expand Down Expand Up @@ -185,7 +182,7 @@ def get_w3_with_priv_key(priv_key: str):
handle_error(e, StakingClientError)

@requires_signer
def stake(self, amount: Decimal, tx_options: Optional[TxParams] = None) -> None:
def stake(self, amount: int, tx_options: Optional[TxParams] = None) -> None:
"""Stakes HMT token.

:param amount: Amount to stake
Expand Down Expand Up @@ -238,7 +235,7 @@ def get_w3_with_priv_key(priv_key: str):
handle_error(e, StakingClientError)

@requires_signer
def unstake(self, amount: Decimal, tx_options: Optional[TxParams] = None) -> None:
def unstake(self, amount: int, tx_options: Optional[TxParams] = None) -> None:
"""Unstakes HMT token.

:param amount: Amount to unstake
Expand Down Expand Up @@ -340,7 +337,7 @@ def slash(
slasher: str,
staker: str,
escrow_address: str,
amount: Decimal,
amount: int,
tx_options: Optional[TxParams] = None,
) -> None:
"""Slashes HMT token.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def get_hmt_balance(wallet_addr, token_addr, w3):
:param token_addr: ERC-20 contract
:param w3: Web3 instance

:return: Decimal with HMT balance
:return: HMT balance (wei)
"""

abi = [
Expand Down
Loading