Chain - HogeFinance/HogeScraper GitHub Wiki
Chain.py contains an abstraction representing a connection to an individual chain. Much of its functionality is derived from web3.py, rather than reinventing the wheel web3 utilities are used wherever possible. Chain also has a convenience w3() method that will return its internal web3 object.
Methods
set_name(name: str)
Set the name to refer to the network by, used in `HogeScraper.network(name)`
name: str - The name to assign to the chain
set_provider(network: Provider)
Pass in a provider for the chain to use with its Web3 instance
network: Provider - The provider instance to assign to the chain
set_w3()
Will use the currently set provider to instantiate a new Web3 instance
add_contract(name: str, contract: Contract)
Add a new contract object to the chain instance
name: str - The name to assign to the contract
contract: Contract - The contract instance to add
add_erc20(name: str, contract: ERC20)
Add a new ERC20 contract object to the chain instance
name: str - The name to assign to the contract
contract: ERC20 - The ERC20 instance to add
add_erc721(name: str, contract: ERC721)
Add a new ERC721 contract object to the chain instance
name: str - The name to assign to the contract
contract: ERC721 - The ERC721 instance to add
remove_contract(name: str)
Remove a contract object from the chain instance
name: str - The name of the contract to remove
contract(name: str)
Return a Web3 instance of the specified contract
name: str - The name of the contract to return
contracts()
Return the dictionary of all smart contracts associated with the chain
eth()
Return the eth utility from the chains Web3 instance
name()
Return the name of the chain
api_key()
Return the api key set for the chain
provider()
Return the Provider object for the chain
w3()
Return the Web3 instance for the chain