Is it possible to get a variable state from existing contract which was not verified but I know what variables, functions etc. the contract contains?
Assume, we have the following script (using Brownie, the name of variable is variable_to_obtain
):
from brownie import Contract
from scripts.helpers import get_account
def get_variable_of_instance(instance_address):
account = get_account()
instance_contract = Contract.from_explorer(instance_address, {"from": account})
variable_to_return = instance_contract.variable_to_obtain()
return variable_to_return
def main():
var = get_variable_of_instance("address_of_instance")
print(var)
Any idea? Thank you so much.