Retrieve the contract interface of a given contract.
- Parameters: contract_entrypoint – the entrypoint of the JSON.
- Returns: The contract interface containing the contract abi.
Retrieve the ERC20 interface.
- Returns: The ERC20 interface of smart contract.
Retrieve the RewardPool interface.
- Returns: The RewardPool interface of smart contract.
Retrieve the EscrowFactory interface.
- Returns: The EscrowFactory interface of smart contract.
Get hmt balance
- Parameters:
- wallet_addr – wallet address
- token_addr – ERC-20 contract
- w3 – Web3 instance
- Returns: Decimal with HMT balance
Retrieve the KVStore interface.
- Returns: The KVStore interface of smart contract.
Retrieve the RewardPool interface.
- Returns: The RewardPool interface of smart contract.
Retrieve the Staking interface.
- Returns: The Staking interface of smart contract.
Executes the transaction and waits for the receipt.
- Parameters:
- w3 (
Web3
) – Web3 instance - tx_name (
str
) – Name of the transaction - tx – Transaction object
- exception (
Exception
) – Exception class to raise in case of error - tx_options (
Optional
[TxParams
]) – (Optional) Additional transaction parameters- If provided, can include values like ‘gas’, ‘gas_price’, ‘nonce’, etc
- If ‘gas’ is not specified or is None, it will be estimated using tx.estimate_gas()
- w3 (
- Returns: The transaction receipt
- Validate:
- There must be a default account
- Return type:
Tuple
[bool
,Optional
[int
]]
Gets the url string.
- Parameters:
url (
str
) – Public or private url address - Return type:
bool
- Returns: True if url is valid
- Raises: ValidationFailure – If the url is invalid
Retry a function
Mainly used with handle_transaction to retry on case of failure. Uses expnential backoff.
- Parameters:
- fn – to run with retry logic.
- retries – number of times to retry the transaction
- delay – time to wait (exponentially)
- backoff – defines the rate of grow for the exponential wait.
- Returns: False if transaction never succeeded, otherwise the return of the function
- Note: If the partial returns a Boolean and it happens to be False, we would not know if the tx succeeded and it will retry.